From 2ce3f4c9e80c959ae49cd0464416d51047a9a234 Mon Sep 17 00:00:00 2001 From: iamromulan <50184035+iamromulan@users.noreply.github.com> Date: Tue, 2 Jan 2024 00:40:11 -0500 Subject: [PATCH] Create simplefirewall.sh --- simplefirewall/simplefirewall.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 simplefirewall/simplefirewall.sh diff --git a/simplefirewall/simplefirewall.sh b/simplefirewall/simplefirewall.sh new file mode 100644 index 0000000..409ef31 --- /dev/null +++ b/simplefirewall/simplefirewall.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Define the ports you want to block +PORTS=("80" "8080" "8088" "443") # Default ports, will be modified by the install script + +# Block specified ports on all interfaces except bridge0, eth0, and tailscale0 +for port in "${PORTS[@]}"; do + iptables -A INPUT -i bridge0 -p tcp --dport $port -j ACCEPT + iptables -A INPUT -i eth0 -p tcp --dport $port -j ACCEPT + iptables -A INPUT -i tailscale0 -p tcp --dport $port -j ACCEPT + iptables -A INPUT -p tcp --dport $port -j DROP +done