Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

One IP address was accessing my site too frequently to be a real user, it was accessing so much that it caused site to slow down. Is there any application that can automatically block IP, if it is accessing too frequently to my site? My server is Linux Debian.

share|improve this question
add comment

3 Answers

You can use fail2ban to do this. You will probably have to write a custom jail for it, to read your server log and determine how many attempts is too many. Be careful that you don't ban legitimate users.

share|improve this answer
add comment

You can use iptables for this.

iptables -I INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m recent --set

iptables -I INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m recent --update --seconds 60 --hitcount 4 -j DROP

These two rules will limit incoming connections to port 22 to 3 attemps in a minute, any more than that will be dropped.

See source.

share|improve this answer
add comment

I can see, that Snort can do it too and a lot more. http://manual.snort.org/node201.html

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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