summary refs log tree commit diff
path: root/noarch/firewall-suse
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-suse
Initial commit HEAD main
Diffstat (limited to 'noarch/firewall-suse')
-rwxr-xr-xnoarch/firewall-suse39
1 files changed, 39 insertions, 0 deletions
diff --git a/noarch/firewall-suse b/noarch/firewall-suse
new file mode 100755
index 0000000..509eb56
--- /dev/null
+++ b/noarch/firewall-suse
@@ -0,0 +1,39 @@
+SERVICE_DIR="/etc/sysconfig/SuSEfirewall2.d/services"
+SERVICE_FILE="${SERVICE_DIR}/smfp"
+
+plug_hifw_suse() {
+	# check direstory exists
+	if ! [ -d "$SERVICE_DIR" ]; then
+		return 1
+	fi
+
+	# turn off our servcie
+	yast2 firewall services remove zone=EXT service=service:smfp
+		
+	# delete our service  
+	rm -f "$SERVICE_FILE"	
+}
+
+make_hifw_suse() {
+# $1 port	
+	# check direstory exists
+	if ! [ -d "$SERVICE_DIR" ]; then
+		log_message "cannot find directory $SERVICE_DIR"
+		return 1
+	fi
+
+	# create new service  
+	touch "$SERVICE_FILE"
+	if ! [ -f "$SERVICE_FILE" ] ; then 
+		return 1
+	fi
+	
+	# full new service file	
+	echo "## Name: SMFP device discovery" > "$SERVICE_FILE"
+	echo "## Description: Open UPD port for answers to broadcast requests coming through SNMP protocol" >> "$SERVICE_FILE"
+	echo "UDP=\"$1\"" >> "$SERVICE_FILE"
+		
+	# turn on new servcie
+	yast2 firewall services add zone=EXT service=service:smfp
+}
+