From 813748d3646027818294d193a6b6b305a9597c27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Leite=20Gon=C3=A7alves?= Date: Wed, 21 Jul 2021 13:40:13 +0000 Subject: [PATCH] Bug Fix - Clear custom chains --- install.sh | 4 ++-- rules.sh | 14 +++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index f3d34bd..870e17d 100755 --- a/install.sh +++ b/install.sh @@ -57,10 +57,10 @@ if [ ! -f /etc/network/firewall/firewall.cfg -o "$1" == "-f" ] ; then fi echo "" -echo !!! Please revise configuration files: +echo !!! Please check configuration files: echo $trusted echo $trusted6 echo /etc/network/firewall/firewall.cfg echo /etc/network/firewall/rules.sh -file /etc/network/firewall/config.d -type f +find /etc/network/firewall/config.d -type f echo "" diff --git a/rules.sh b/rules.sh index c26b550..f4d4f44 100755 --- a/rules.sh +++ b/rules.sh @@ -8,10 +8,22 @@ trusted6=/etc/network/firewall/trustedips6.conf #--------------------------------------------------------------------------- input="INPUT-CUSTOM" +# Clear chains iptables -F $input iptables -F DOCKER-USER ip6tables -F $input +# Clear custom chains +#--------------------- +iptables -F PING-DEATH +#ip6tables -F DEATH-PING6 +iptables -F syn-flood +#ip6tables -F syn-flood6 +iptables -F SSH-BRUT-FORCE +ip6tables -F SSH-BRUT-FORCE6 +#--------------------- + + # Open ipv4 trusted IPs for i in $(egrep -v "^#|^$" $trusted ); do iptables -A $input -s $i -j ACCEPT -m comment --comment "Trusted ipv4 ($i)" @@ -68,7 +80,7 @@ if [ "X$WAN" != "X" ]; then # ip6tables -A $input -i $WAN -p tcp --syn -j syn-flood6 # ip6tables -A syn-flood6 -m limit --limit 1/s --limit-burst 4 -j RETURN # ip6tables -A syn-flood6 -j DROP -if +fi #Block ssh brute force (the $WAN variable is required) if [ "X$WAN" != "X" ]; then