Ban that bandwidth slurper

Angel, the machine that runs (among other sites) is being rather slow. On investigation of my logs, it appears that that’s quite possibly because it’s being hammered by people. I deleted my log and then waited an hour to see if I was being hit a lot (the log was 200MB! in less than an hour!) and then pulled out the 5 most persistent offenders with

cut -d" " -f1 /var/log/apache2/ | sort | uniq -c | sort -n | tail -5

which gave me


Those last two are a bit high, I think; two thousand hits in an hour? I mean, I appreciate all you people reading the good word of the Langridge, but I’m not that good a writer. So, they get banned, which is nice and easy. Following Mark Pilgrim’s explanation, I added the following lines to .htaccess:

# all your DoS are belong to us. Ban ban ban.
RewriteCond %{REMOTE_ADDR} ^$
RewriteRule .* - [F,L]
RewriteCond %{REMOTE_ADDR} ^$
RewriteRule .* - [F,L]

and…no more hits from those IPs. Beware, people sucking down my bandwidth: I have plenty of room in .htaccess for more of those lines.

More in the discussion (powered by webmentions)

  • (no mentions, yet.)