Put the following in /etc/sysconf/iptables and /etc/sysconf/ip6tables:
-A INPUT -p tcp -m tcp --dport 22 -m state --state NEW -m recent --set --name SSH
-A INPUT -p tcp -m tcp --dport 22 -m state --state NEW -m recent --update --seconds 60 --hitcount 5 --rttl --name SSH -j DROP
-A INPUT -p tcp -m tcp --dport 22 -m state --state NEW -j ACCEPT
restart iptables
/bin/systemctl restart iptables.service
/bin/systemctl restart ip6tables.service
Leave a Reply