How can I go about killing IP connections that seem to be sending a lot of requests to the same url? Let's say I have someone who requests the same url for more than 10 times in 5 seconds, I want to "cool" him off. Any ideas on how it's done?
|
On *nix, you can use fail2ban with a something like this in your jail.conf (100 requests in 30 seconds means a 5 minute ban). Of course, you'll have to adjust this for how many requests you expect from a legitimate user -- as @Jeff Ferland points out in the comments below, you need to account for the number of requests that you receive on a normal page load (e.g. you have a lot of images on the page).
and a filter like this in
This is untested -- you'll have to experiment a bit to find what works. Watch your fail2ban.log to verify that you aren't banning innocent users! An alternative would be a firewall rule that rate-limits requests from a particular IP address. |
|||||||||||
|
|
Would mod_evasive be what you're looking for? It's focused on DoS attacks and limits the number of requests to a page per second. Otherwise, you might be able to adapt fail2ban to help out. |
|||
|
|