Adding the following rules to the iptables will limit SSH access to 5 connections within a 60 second period. This should be more than enough for normal usage but is far too limiting to allow a brute-force dictionary attack. This must be installed as root.
iptables -A INPUT -i eth0 -p tcp –dport 22 -m state –state NEW -m recent –set –name SSH
iptables -A INPUT -i eth0 -p tcp –dport 22 -m state –state NEW -m recent –update –seconds 60 –hitcount 5 –rttl –name SSH -j DROP
Important
If you're experimenting with iptables, you should add this to the crontab first:
*/10 * * * * /sbin/iptables -F
This will reset all rules every 10 minutes just in case you add something dumb and lock yourself out.