Bottom Feeder Filter
Background of Drupal SEO Spam Issue:
We host another drupal site (saveagallon.org) that recently became inundated with SEO spammers (A.K.A. Link farm and Spamdexing) that only wanted to add their spammy links to the user profile page. Analytics showed us that most of this traffic was coming from the Philippines, India and Pakistan. Suddenly our site jumped from 5 new accounts a day to over 50 then 75. I love Drupal, but the User Administration was not designed to easily check and disable these type of accounts. At first we assumed they were automated bots.- Naturally our first response was:
- Activated email verification.
- Added Recaptcha.
Neither of these (I know they should have already been deployed) slowed them down at all. These were real people signing up and could get through any defense we added. In fact many of them tailored their profile to match the site. Some even posted relevant comments.
Pulling out the Big Guns
Along with good Drupal User Management practices including recaptcha and email verification you might want to block access from problem countries. I don't recommend this option lightly, but it did give us breathing room to figure out a solution. If your site will be fine without traffic from these problem countries just block the entire IP range. I found a list of country specific IP ranges on this site:http://www.countryipblocks.net
Select the countries you want to block from the list, specify the format as ".htaccess deny" then open your .htaccess file, paste in the new denied list at the bottom, save and upload. This cut our SEO spam by around 90%. I suspect the issue will come back around as more sites do this and these guys figure out a way to hide their originating ip addresses.
Management is still going to be important.
Even if you block the major offenders, some will still get through. The procedure we created, is simple.- Check all accounts that were recently accessed for links in their profiles.
- Make a list showing what we found.
- Click the "block user" button.
- We change the users status to "blocked."*
- Grab the users IP address.
- Add an access rule to the drupal database banning that IP.**
** I realize it's probably futile to ban the individual IP, but it still feels good... After a week or so go back, sort that table by IP and then modify the rules to block a wider range.
Disclaimer:
This code was done in a fit of desperation at 3am. We've made it generic enough to share, but it might not apply to all sites. Please also note that we're sure it violates all kinds of "Drupal rules" but like we said we were desperate, and had not written a module for drupal yet and fell back on what we can do, regular old php. Eventually, with enough feedback We hope to make BFF available as a Module, but for now if you are desperate enough this is how it works.This is the node code.
We limit access to this page by using an "admin" role. Change "admin" to what ever you need and set the "input format" to php.Here are the functions:
Feedback?
Got questions, problems or a better idea?Email them to me!
