summary refs log tree commit diff
path: root/noarch/firewall-firewalld
diff options
context:
space:
mode:
Diffstat (limited to 'noarch/firewall-firewalld')
-rwxr-xr-xnoarch/firewall-firewalld51
1 files changed, 51 insertions, 0 deletions
diff --git a/noarch/firewall-firewalld b/noarch/firewall-firewalld
new file mode 100755
index 0000000..5753cc4
--- /dev/null
+++ b/noarch/firewall-firewalld
@@ -0,0 +1,51 @@
+plug_hifw_firewalld() {
+# plug hifw - plug hole in firewall for Fedora 18
+# $1 - port
+	local FIREWALL_CMD=firewall-cmd
+	local FIREWALL_OFFLINE_CMD=firewall-offline-cmd
+	if ! which "$FIREWALL_CMD" ; then
+		log_message "cannot find file FIREWALL_CMD"
+		return 1
+	fi
+
+
+	if "$FIREWALL_CMD" --state ; then
+		"$FIREWALL_CMD" --permanent --remove-port=${1}/udp
+		"$FIREWALL_CMD" --remove-port=${1}/udp
+	else
+		if ! which "$FIREWALL_OFFLINE_CMD" ; then
+			log_message "cannot find file FIREWALL_OFFLINE_CMD"
+			return 1
+		else
+			"$FIREWALL_OFFLINE_CMD" --remove-port=${1}/udp
+		fi
+	fi
+}
+
+
+make_hifw_firewalld() {
+# mhifw - make hole in firewall for Fedora 18
+# $1 - port
+	local FIREWALL_CMD=firewall-cmd
+	local FIREWALL_OFFLINE_CMD=firewall-offline-cmd
+
+	plug_hifw_firewalld $1
+
+	if ! which "$FIREWALL_CMD" ; then
+		log_message "cannot find file FIREWALL_CMD"
+		return 1
+	fi
+
+	if "$FIREWALL_CMD" --state ; then
+		"$FIREWALL_CMD" --permanent --add-port=${1}/udp
+		"$FIREWALL_CMD" --add-port=${1}/udp
+	else
+		if ! which "$FIREWALL_OFFLINE_CMD" ; then
+			log_message "cannot find file FIREWALL_OFFLINE_CMD"
+			return 1
+		else
+			"$FIREWALL_OFFLINE_CMD" --add-port=${1}/udp
+		fi
+	fi
+}
+