I have a Drupal 7 website on a shared hosting account that uses an Apache server. It is getting continuously battered by spam bots who try to post junk comments and create fake accounts. What methods can I use to block them from accessing the site and/or doing any operations there.

Currently, I have the following modules installed to block and combat spam:

Spambot - https://drupal.org/project/spambot

Spamicide - https://drupal.org/project/spamicide

Hashcash - https://drupal.org/project/hashcash

AntiSpam - https://drupal.org/project/antispam

Cloudflare - https://drupal.org/project/cloudflare

I tried installing Bad Behavior (https://drupal.org/project/badbehavior), but there appears to be some error in its installation procedure.

I do not want to use captcha to block spambots.

  • 1
    Not much that you can automate these days. Have a look at this question.
    – Triskelion
    Commented Jun 29, 2013 at 19:03
  • The best way is to block the IP address or IP ranges at the firewall, before it even gets to Drupal. Commented Jun 29, 2013 at 22:36
  • 4
    This question appears to be off-topic because it is about Apache crashes due to spambot attacks, something that may really be solved only on Apache level, not Drupal one. Spam flow can be stopped at web application level, but if the very server crashes, you need to fight it on lower levels.
    – Mołot
    Commented Jun 29, 2013 at 22:53
  • 1
    @Mołot, I am on a shared host and cannot do much at the Apache level. I was therefore looking for solutions to the problem at Drupal's level.
    – bcosynot
    Commented Jun 30, 2013 at 6:59
  • 3
    If we start using this logic for ontopic/offtopic, then we may as well shut down Drupal Answers. This is an honest question about a problem with a Drupal site, and the OP is asking for a Drupal solution. A proper answer would address the OP's concerns on the Drupal side, and then offer advice as to why this may be better served with an Apache solution.
    – mpdonadio
    Commented Jun 30, 2013 at 18:02

5 Answers 5


This is better solved at the Apache level. The industry standard method for doing this is to create a honeypot directory, make it off-limits to bots in robots.txt, then logging the IP-address of those who still go there, and block it.

For an example of this, see the this page: http://www.kloth.net/internet/bottrap.php. You can set up this on shared hosting as long as you can edit .htaccess.

For a more sophisticated solution, take a look at Project Honeypot (NB: no relation to the Drupal Honeypot module). There is already an Apache module which interfaces with Project Honeypot's IP blacklist. To install this, you ned to have access to the Apache config (usually not available on cheap shared hosting).

Edit: There already exists a Drupal module, http:BL, that uses Project Honeypot's IP blacklist, that may save you some time setting this up (thanks to @vr3690 for pointing this out).

  • Nifty. Do you know of a Drupal module to manage this?
    – mpdonadio
    Commented Jun 30, 2013 at 2:17
  • There is a module that uses Project Honeypot's IP blacklist - drupal.org/project/httpbl. It also automatically adds a honeypot link to your footer that you can create using Project Honeypot's website. I unfortunately cannot make changes to my Apache installation other than making changes to the .htaccess file as I am on shared hosting.
    – bcosynot
    Commented Jun 30, 2013 at 6:57
  • Project Honeypot requires a bit of DNS play, that may be impossible on shared hosting with DNS+server bundle. Actually it is impossible on most shared hostings below "small business" level I ever used.
    – Mołot
    Commented Jun 30, 2013 at 8:56
  • @GisleHannemyr Cool. I was thinking more of using Drupal to handle the IP logging for a standalone honeypot app.
    – mpdonadio
    Commented Jun 30, 2013 at 18:42

We have had great success with uncpatchalous and its successor http://dgo.to/BOTCHA. What's nice about these is that they do not impact "normal" users.

Disclaimer: our site doesn't allow comments or registration, but since installing the above on our Contact form, all bot-initiated SPAM has gone away.

  • This looks good. Will give it a shot.
    – bcosynot
    Commented Jul 13, 2013 at 7:28

Give the BadBot module a try. I'm the developer of it, and can pretty much guarantee it'll block spam registrations. Functionality for other form submissions isn't in place yet, but will be.

Jan 2nd, 2014 edit: BadBot now supports all Drupal forms.


I have recently started using the Bad Behavior module, which not only used Project Honeypot Blacklist feature but also allows from IP tracking and reasons WHY an IP was blocked. It has a few more features than the honeypot module by itself and combines those rather nicely.

Alternatively there is also the goAway module which lets you see the IP addresses of any comment or posts made on your site and block them directly via a link or a form in the admin section.

And then there is Mollum.com, which does all this 'sort of stuff' in the back and only presents you with a confirmation if it cannot determine if content added is spam or not. Free only for personal sites, but very affordable for organizations, etc.

Hope this helps.

  • I wasn't able to install the Bad behavior module. Kept on giving errors. I already have mollom in place, but it can only do so much. It only prevents spam comments and registrations from being accepted. With every form submission by these spam bots, server resources are being used and I would like to prevent that.
    – bcosynot
    Commented Jul 13, 2013 at 7:23

I have the same issues. I was fighting with spam bot for 2 days, but now it's come to an end.

When I said end, its mean completely stop, spambot no longer able to access my site.

I use two module, mollom and honeypot.

Honeypot is the key here, the trick is to install honeybot and also create a rules which ban the spam bot IP when it fails in honeypot.

You just create a rules to trigger the IP ban when it fails to comply with honeypot.

On my site "recent log message" page, I was sit back and smile, when I saw the spam bot get banned many many times by my honeypot rules.

Hope it will help.

Not the answer you're looking for? Browse other questions tagged or ask your own question.