Block ssh brute force attacks with iptables

 # iptables -N SSH_CHECK
 # iptables -I INPUT -p tcp --dport 22 -m state --state NEW -j SSH_CHECK
 # iptables -A SSH_CHECK -m recent --set --name SSH
 # iptables -A SSH_CHECK -m recent --update --seconds 180 --hitcount 5 --rttl --name SSH -j LOG --log-prefix "SSH_brute_force "
 # iptables -A SSH_CHECK -m recent --update --seconds 180 --hitcount 5 --rttl --name SSH -j DROP