summary refs log tree commit diff
path: root/noarch/firewall.sh
diff options
context:
space:
mode:
authorStarfall <us@starfall.systems>2024-01-08 09:40:24 -0600
committerStarfall <us@starfall.systems>2024-01-08 09:40:24 -0600
commita91d41375fc87c958f0b4b2ec09d5bfa2bab9414 (patch)
tree5ecf2d3f5b5962bb2d317ad4ce1fddd88e8b0ed7 /noarch/firewall.sh
Initial commit HEAD main
Diffstat (limited to 'noarch/firewall.sh')
-rwxr-xr-xnoarch/firewall.sh49
1 files changed, 49 insertions, 0 deletions
diff --git a/noarch/firewall.sh b/noarch/firewall.sh
new file mode 100755
index 0000000..f760593
--- /dev/null
+++ b/noarch/firewall.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+#
+# @Usage:
+#
+# . ./firewall/firewall.sh
+# make_hole_in_firewall [ port ]
+# make_hole_in_firewall [ port ]
+#
+
+DEFAULT_SNMP_BROADCAST_PORT="22161"
+FIREWALL_NAME_TEMPL="firewall-"
+
+make_hole_in_firewall() {
+	local path="."
+	if [ -n "$1" ]; then
+		path="$1"
+	fi
+	local PORT=$DEFAULT_SNMP_BROADCAST_PORT
+	local FILE_LIST="$(ls "$path/$FIREWALL_NAME_TEMPL"*)"
+
+	for i in $FILE_LIST	; do
+		. $i
+		make_hifw_${i#*${FIREWALL_NAME_TEMPL}} $PORT
+	done
+}
+
+plug_hole_in_firewall() {
+	local path="."
+	if [ -n "$1" ]; then
+		path="$1"
+	fi
+	local PORT=$DEFAULT_SNMP_BROADCAST_PORT
+	local FILE_LIST="$(ls "$path/$FIREWALL_NAME_TEMPL"*)"
+
+
+	for i in $FILE_LIST	; do
+		. "$i"
+		plug_hifw_${i#*${FIREWALL_NAME_TEMPL}} $PORT
+	done
+}
+
+test_iptables() {
+	log_message "TEST IPTABLES"
+	/sbin/iptables -L
+	log_message "TEST IP6TABLES"
+	/sbin/ip6tables -L
+}
+
+