WordPress spam…

So, I was looking at the start of the year about 8% of my stats was SPAM.yuck. Then something insane happened this week, it jumped to 28%.

So I crossed that point when something would have to be done!

I’ve already installed stuff to detect the spam, and it does a good overall job.  But I wanted to take it to the next level and block all traffic from the spammers! Anyone who SPAM’s probably is engaged in other nonsense that makes me not want their traffic.

Thankfully for me and this brave new era of google, I could quickly find someone has done 99% of the leg work for me right here! Thanks to Sakis’s hard work I was able to add some minor tweaks, and generate a full iptables config, flush & add the new rules, then have cron run it every few minutes.

Pretty cool stuff if I do say so myself!

Since the primary site is now offline, I’ve updated with an archive.org link. For what it’s worth, here is the meat of the article in question:

Dodging WordPress comment spammers

I admit: Allowing anyone to post comments is bad practice. Though, I’ve got my reasons to stand my ground. I’ve many times read something on a blog and to some of them I even had something to add. Could potentially help blog’s author or future visitors by sharing my own experience or request a solution to one of my problems by posting a question. Guess what? I am so lazy that I rarely go through registration procedure, just to enable me posting a comment.

I am one of those that insist dialog and discussion is always constructive as long as both ends feel like establishing it. I do not want to lose the opinion and comments of stopping-by visitors, just because I want a “safe” thing that runs on its own. But, “buts” exist. My blog is currently one month old, still it manages to receive 300+, in average, spam-oriented comments per day, while I’ve even witnessed a 1k/day.

Thank god, WordPress provides blacklist features based both on IP addresses and comment content. And it really does a good job: After messing around with your recent “spam” you can easily end up with a list that accurately detect a non constructive comment. However, you’ve not solved all your problems this way:

  • New comments still come. They are just automatically rated as spam.
  • Your database fills with garbage.
  • Your web traffic statistics are spoiled.
  • You waste bandwidth.
  • You waste CPU time.
  • If your spammer ever stop selling drugs and starts advertising flesh, all your content matching rules go away.
  • If your spammer loose interest into being a blog spammer and switch to a port-scanner, you will receive that too.

How about you refuse them a spare TCP socket? Besides, you don’t even wanna know them. All their connection attempts will end-up to void. Time for some “iptables” magic.

WordPress has already stored their IP addresses within its database. Consult that wp-config.php file you lately edit when you firstly installed WordPress, and refresh your memory on what your database name, username and password is. Mine are:


$ grep "DB_" wp-config.php

define('DB_NAME', 'mywordpress');

define('DB_USER', 'sakis');

define('DB_PASSWORD', 'myextrastrongpassword');

define('DB_HOST', 'localhost');

define('DB_CHARSET', 'utf8');

You now have to use that information into constructing this single-row command:

Check my example:

$ mysql -f -p --user=sakis mywordpress <<<"select distinct CONCAT('iptables -A INPUT -s ',comment_author_IP,'/32 -j DROP') from wp_comments where comment_approved='spam' order by 1 asc" | grep -v "^CONCAT" >> THEY_BOTHER_ME
Enter password:
$ head THEY_BOTHER_ME
iptables -A INPUT -s 113.161.128.232/32 -j DROP
iptables -A INPUT -s 117.121.208.254/32 -j DROP
iptables -A INPUT -s 118.141.141.7/32 -j DROP
iptables -A INPUT -s 118.194.1.157/32 -j DROP
iptables -A INPUT -s 119.235.27.100/32 -j DROP
...

You now have a simple recipe, named “THEY_BOTHER_ME”, ready to be executed (as root):

$ su

# . ./THEY_BOTHER_ME

Make sure you hook “THEY_BOTHER_ME” at your system’s start-up procedure and construct a cron/at job to periodically refresh it.

I’ve created a file named /etc/cron.daily/update_spammers.sh, with the following contents:

#!/bin/sh

fileloc="/etc/THEY_BOTHER_ME"

before=`cat "${fileloc}" | wc -l`
before=`echo ${before}`

cp "${fileloc}" /tmp/BOTHERS.$$

mysql -f --user=sakis --password=myextrastrongpassword mywordpress <<<"select distinct CONCAT('iptables -A INPUT -s ',comment_author_IP,'/32 -j DROP') from wp_comments where comment_approved='spam' order by 1 asc" | grep -v "^CONCAT" >> /tmp/BOTHERS.$$

sort /tmp/BOTHERS.$$ | uniq > "${fileloc}"
rm -f "/tmp/BOTHERS.$$"

. "${fileloc}"

after=`cat "${fileloc}" | wc -l`
after=`echo ${after}`

di=`expr ${after} - ${before}`
di=`echo ${di}`

printf "[%s] Spammers updated. Added %d new spammer(s) (Before: %d, After: %d)\n" "`date`" ${di} ${before} ${after}

And sadly, his original script is now offline.  This should be enough for anyone to get going on this exciting spam adventure…

So I got to play with a ‘surface’ yesterday

Honestly it’s not that bad, the UI is surprisingly snappy.  The thing has a quad core processor, 2GB of ram..  the bundled keyboard… sucks. badly.  I don’t even know why they even made it.

Surprisingly, there is adobe flash on the platform.  Getting to the command prompt was pretty trivial, although I didn’t have any pure unsigned .net exe’s on me to test..  I forgot to check if the runtime included csc.exe …

The price is just too high for the platform to be compelling to be honest, it would have been a contender around the time the iPad launched, but true to MS’s nature they always let others lead before they enter the market.

Maybe after Christmas sales, or the lack of, there will be some motivation on Microsoft’s part to price it more competitively.

Also DOSBox would be a nice to have for Windows RT … but if it is all walled garden crap who knows if that’ll happen easily…

I just saw an uptick in traffic from Oldlinux.org

And even a quick shout out!

2012-10-21
A long time passed! I found someone is also interested in the old things. Neozeed built some Linux 0.00, 0.1x images running on Qemu emulator . I also put them HERE for people to find them easily. Thanks Neozeed. And during this period of time, I also find some valuable old things. The first is the source code of lib-0.12 for kernel 0.12. The other is the full ancient Linux system using kernel 0.98 patchlevel 1 released early by SLS, the 0.98pl1 system .

For anyone who doesn’t know, oldlinux.org is a historical repository for the early start of the now wide spread Linux operating system.  In a somewhat ironic sense of being available on the internet much of the early stuff is lost, however thanks to the work of these fine folks, and some less than scrupulous shovelware dealers, and hoarders much of it has been pieced back together.

I suppose much of it is really of no practical use today, although at the same time the pre 2.0 linux stuff was incredibly small.. And capable of running in ultra minimal configurations.

So I had to move providers again.

I don’t know what on earth is going on with all these VPS providers getting DDOS’d as of late.. So here I am on VPS #4.  I lost my last post so I’ll have to recreate it later on.

Right now I’m just trying to get my old vpsland archive back online.  Sadly my DSL is rate limited to a whopping 64KB/sec so this will take … a long long while.

Thankfully I had a recent-ish backup of my blog, so all is well there!

Just to let people know I’m still alive!

Sorry I’ve spent so much time looking for that old OS/2 beta stuff, I didn’t realize it has been a while since I posted…

In the meantime I was working up something about the evolution of Windows 3.0, to 3.0a and the multimedia version, along with what features I’ve been able to discern about the OS/2 2.0 beta..  Like did you know that MS was going to put TrueType fonts in it?  I guess that is why IBM went with Adobe..

And of course there was no plans for SOM, or the Object desktop in OS/2 2.0 it was going to look/feel more like OS/2 1.21 or Windows 3.0 than what eventually shipped as OS/2 2.0  .

I don’t know what it is interesting about that time period… And I scored a real copy of OS/2 2.0 for $5, I was going to do more of a teardown of that, once I get some kind of scanner… Or maybe try to flip it on ebay in some kind of workable manner vs being old dead stuff in a box?

I donno.