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.

Is there any tool on Linux to automatically modify iptables so as to block a troublesome client based on an analysis of the Apache log? I help run a site that sometimes get overwhelmed by requests from a particular user. The only solution is to add an entry in iptables to block the offending client. Its usually too late by the time I can react manually - hence, I would like some rule based mechanism to modify the iptables. I would guess that some kind of fuzzly logic or statistical analysis would be necessary.

share|improve this question

3 Answers 3

up vote 10 down vote accepted

You can use something like fail2ban, which IIRC, has an Apache log checker built in.

share|improve this answer
    
fail2ban comes very close to doing what I want. Looks like I'll have to dig through the source a bit. –  Rangachari Anand Apr 30 '09 at 18:51

Check out OSSEC. Best log file analyzer I've used. It also supports active response based on analysis.

share|improve this answer

You might want to consider using iptables to rate-limit incoming connections. Which in its most basic setting will give you the ability to limit incoming connections to a number per minute.

For example, you might want to only allow 10 pings per minute from a single IP address. It does get a little more sophisticated than that, with the option to set burst limits on top of long term average limits.

Some good instructions on setting it up http://kevin.vanzonneveld.net/techblog/article/block_brute_force_attacks_with_iptables/

share|improve this answer
    
Excellent - I had no idea that iptables could even do that. This could be very useful. –  Rangachari Anand Apr 30 '09 at 18:50
    
I'll dig out an excellent guide i read recently on it –  Guy C Apr 30 '09 at 18:50
    

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.