Information Security Stack Exchange is a question and answer site for information security professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm getting a lot of hackers spamming my domain with requests for files that just don't exist. This is eating up a lot of my allotted bandwidth and I'd like to blacklist these IP addresses.

Is there is a way to automatically blacklist IP addresses in Apache once they have requested X number of files that 404 in a specified time frame?

share|improve this question
up vote 9 down vote accepted

Fail2ban does exactly what you ask.

It monitors your log files looking for certain patterns and then executes whatever action you specify. You can block an IP for a length of time.

It does require some skill in regex, but it comes packaged with regex testers.

share|improve this answer
Thanks for the quick response! – Dan Dec 22 '11 at 22:50

Your Answer


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.