linux - IPtables : Limit number of new ssh connections per minute -
i need ensure on server maximum new ssh connections per minute not more 5.
sudo /sbin/iptables -a input -p tcp --syn --dport 22 -m connlimit --connlimit-above 5 -j reject
above iptables rule work me, not allow new connections after 1 minute.
any pointers how achieve this?
# ssh anti-bruteforce # next create limiting rule. limit 3 hits in 60 seconds ssh /sbin/iptables -a input -p tcp --dport 22 -m state --state new -m recent --set --name ssh /sbin/iptables -a input -p tcp --dport 22 -m state --state new -j ssh-whitelist /sbin/iptables -a input -p tcp --dport 22 -m state --state new -m recent --update --seconds 60 --hitcount 3 --rttl --name ssh -j log --log-level info --log-prefix "anti ssh-bruteforce: " /sbin/iptables -a input -p tcp --dport 22 -m state --state new -m recent --update --seconds 60 --hitcount 3 --rttl --name ssh -j drop
Comments
Post a Comment