I think one more optimization is needed. By adding the '-n' option, reverse DNS lookups are prevented. Without this option, (re-)starting the daemon may take a very long time.

So I propose to change the two lines to:

iptables -n -L INPUT | grep -q sshguard || iptables -w -I INPUT -j sshguard 2> /dev/null ip6tables -n -L INPUT | grep -q sshguard || ip6tables -w -I INPUT -j sshguard 2> /dev/null

Reply via email to