DenyHosts protects your SSH for brute-force login attempts.
Fail2Ban protects your for several services.
Installation guide for Fail2Ban
https://www.digitalocean.com/community/articles/how-to-protect-ssh-with-fail2ban-on-ubuntu-12-04
Installation guide for DenyHost
https://www.digitalocean.com/community/articles/how-to-install-denyhosts-on-ubuntu-12-04