Wow, that’s a long title, but it’s worth it! This is just a quick blog post really to vent a bit of pseudo-anger.
The problem
I have been getting a hell of a lot of spam from a certain IP address, I’m not one to point fingers, so I won’t tell you what it is *cough* 194.8.75.149 *cough*. And I’m talking about 4 or 5 spam comments an hour (which I know, on the grand scheme of things is nothing, but it’s quite over-whelming for a small time blogger like myself!). So either it’s a bot, or a person who has an extremely large supply of non-prescription drugs in his garage. Either way, I don’t want them posting spam comments on my blog. If it’s a bot, it won’t really care; if it’s a real person, f@*% you, if all you can do is post spam comments, then I don’t want you reading my blog anyway!
The solution
I’m simply going to use my great pal .htaccess to deny access to my site from the spamming IP. I realise that this is not a great solution, after all, it’s unlikely that you’ll be able to keep on-top of every single IP address of spammers, but it’s an insight into the principles, and a great way of getting rid of single troublesome IPs.
So here’s the code:
1 2 3 | Order Allow,Deny Deny from 194.8.75.149 Allow from all |
Which is as easy to understand as it looks – just give it the IP you don’t want to have access to your site, and tell apache to deny access. This is actually remarkably powerful, you can use it to conditionally serve CSS for different browsers (based on browser string), stop image hot-linking, and much much more.
Dude, just use Akismet
Yeah, I know, you’re right, Akismet is awesome! If you don’t have it installed on your blog, you should. It checks a huge (and frequently updated) database to see if a new comment looks like spam, and if so, puts it into a spam queue. But I just like to keep on top of my spam queue and keep it empty. So getting rid of this troublesome IP will save me a bit of time and trouble :)
</rant>
Have you had similar spamming IP problems? What were the addresses. Go on, name and shame!
Tags: .htaccess, akismet, apache, servers, spam
7 Comments
Interesting, although all the sites we do run on MS servers (I know I know!)
What are your thoughts on Captcha?
O.
Thanks for the comment Oli! Well, that’s what you get for not running Linux :p although I believe that there are similar technologies on IIS.
And onto THAT question – personally I think there are better ways to prevent spam than presenting the user with an unreadable, mangled word in an image. (for example, see the simple maths question on this comment form). One way that really gets me excited at the moment is adding an extra form field then, hiding it with CSS (obviously with a relevant descriptive comment for non css users) which is supposed to be submitted empty. Spambots will see it and naturally fill it in, so server side if the field has a value, it’s probably a spam submission.
Having said that, it’s not something I’ve done a lot of research into, so may well be flawed. Anyone tried this/know any more about it?
I’m not so sure about the numeric problems. JavaScript engines are perfectly capable of evaluating simple math problems, and even some more complex ones. This page gives a good demonstration of the eval() function in javascript.
http://ai.ijs.si/Mezi/pedagosko/javascript/izracun.html
Regardless, CAPTCHA’s that are image based are more likely to work, I’m surprised I haven’t seen a lot of bots get around the math problem.
da best. Keep it going! Thank you
tks for the effort you put in here I appreciate it!
I wanted to introduce myself, hello! Hope I get famous soon like you!!
@Mary-joe I don’t think I’m famous, to be frightfully honest. You too could set up a blog which gets as much spam (but I guess you’re more interested in REAL traffic, like myself ;) ) as slightlymore. The answer is to write regular and relevant content, then the googlers (and indeed spammers) will arrive!
Good luck!
One Trackback
[...] more: How to stop pesky spam by blocking IP addresses from visiting your blog Share and [...]