Ban that bandwidth slurper
Angel, the machine that runs www.kryogenix.org (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/kryogenix.org-access.log | sort | uniq -c | sort -n | tail -5
which gave me
324 217.112.126.122
381 81.133.81.248
421 82.108.113.14
2060 213.249.154.101
2391 81.159.133.111
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} ^213.249.154.101$
RewriteRule .* - [F,L]
RewriteCond %{REMOTE_ADDR} ^81.159.133.111$
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.
Any idea what sort of content they were slurping?
14 minutes later
Looks like one of them is from a place with known tits :).
http://en.wikipedia.org/wiki/User_talk:213.249.154.101
78 minutes later
Bloody hell, what do you have to do to get a permenant ban on editing wikipedia articles?! They’re worse than the UK courts! ;)
2 hours later
Easier:
DENY FROM 213.249.154.101
or even
DENY FROM 213.249.154.
3 days later