Possible Duplicate:
Preventing brute force attacks against ssh?

We have approximately 20 internet connected virtual machines, and just noticed that hackers are trying to brute force SSH port 22. They are trying common usernames (root, mysql, admin) and dictionary attacks.

We know one counter-measure is to run SSH on a different port, but that is not an option (must run on 22). Also, we know that disallowing passwords (only public-keys) is another counter-measure, but again, we require the ability to use password authentication.

Is there a package that can ban/block an ip-address if it tries to SSH incorrectly X number of times in a given interval?

Would be optimal if it could block for say 12 hours if 5 incorrect logins in a span of 1 minute.

Thanks.

link|improve this question

48% accept rate
and serverfault.com/a/174962/50875 – gWaldo Jan 31 at 2:54
you might need to work on that 48% accept rate ;) – Niko S P Feb 28 at 1:04
feedback

closed as exact duplicate by ErikA, Shane Madden, WesleyDavid, gWaldo, Ward Jan 31 at 3:21

This question covers exactly the same ground as earlier questions on this topic; its answers may be merged with another identical question. See the FAQ for guidance on how to improve it.

3 Answers

http://www.fail2ban.org/wiki/index.php/Main_Page
works for any log files, based on any phrases

link|improve this answer
feedback

http://denyhosts.sourceforge.net/

link|improve this answer
-1 for posting just a link. – John Gardeniers Jan 31 at 3:28
My bad, noted :) – Rikih Jan 31 at 4:19
feedback

I use the CSF (ConfigServer Security & Firewall) scripts, which not only includes IP filtering, but also a plethora of other functionality. It integrates with IP Tables nicely. I run, manage, and configure it from the command line, but for folks who have cPanel, it can also be installed via WHM's GUI.

link|improve this answer
feedback

Not the answer you're looking for? Browse other questions tagged or ask your own question.