0

Is it possible to throttle or ban IP address based on how much the host is using bandwidth of my webserver? In ideal situation I would like to create rules like:

if IP uses bandwidth over 1000 MB in 10 minutes, ban/throttle the IP

If it's possible, how can I achieve something like this?

I'm running apache webserver with Debian 8.

  • I don't know why I'm being down-voted :( – user1273128903 Nov 18 '18 at 14:02
  • Hey man, I hate it when they downvote with no comments... I found your question very interesting and I have been reading about this advanced traffic shaping since I saw it.. so there you have my upvote. Unfortunately I have not been able to balance work, life and traffic shaping to get to an answer, for sure people like [this guy](https://serverfault.com/a/384155/353867) can!! I promise I will keep studying and get back to you – Jorge Valentini Nov 20 '18 at 22:25

1 Answers1

0

The usual modules do not do everything that you ask. mod_bw allows by IP but does not allow a time based quota. mod_ratelimit does not limit by IP it is per request, and requires a httpd upgrade.

Or, if these are legit users, solve the problem with more bandwidth. Get faster network links on your web server, or perhaps put a CDN in front of it.

John Mahowald
  • 30,009
  • 1
  • 17
  • 32
  • Those users are not legit, that's why I would've wanted to block them. It's weird there's no mod/program to achieve something like I wanted. Thanks for the comment. – user1273128903 Nov 18 '18 at 11:38
  • I did not say there was not a way to do this via modules. Just that the common ones already packaged are relatively simple. You may want to have someone develop a fancier limit module, or go with a different solution. – John Mahowald Nov 18 '18 at 13:10
  • I see. I thought this might've been something that many people would want and modules would therefore exist, but it seems this is not the case. Are you aware of any non-apache solutions, like something which is iptables based? – user1273128903 Nov 18 '18 at 14:06