From 34636d0faa11d14f13444229b30e3c7047f546b8 Mon Sep 17 00:00:00 2001 From: Alfonso Date: Sun, 19 Apr 2020 22:33:43 +0200 Subject: [PATCH] Update blocklist-update.sh --- blocklist-update.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/blocklist-update.sh b/blocklist-update.sh index 3d7908b..f99a192 100644 --- a/blocklist-update.sh +++ b/blocklist-update.sh @@ -99,8 +99,14 @@ then # Create the one and only firewall rule $IPTABLES_PATH -I $CHAINNAME -m set --match-set $CHAINNAME src -j $ACTION >>$MAILLOG 2>&1 fi + echo "Adding the return statement to the chain. We do not want to accept a non-matching ip; think about fail2ban" >>$MAILLOG -$IPTABLES_PATH -A $CHAINNAME -j RETURN >>$MAILLOG 2>&1 +if [ `$IPTABLES_PATH -L $CHAINNAME | grep RETURN | wc -l` -eq 0 ] +then + # Create the one and only firewall rule + $IPTABLES_PATH -A $CHAINNAME -j RETURN >>$MAILLOG 2>&1 +fi + ## Read all IPs from the downloaded IP list and fill up the ipset filter set echo "" >>$MAILLOG