Bembel-B Blog


Blocking IP Addresses with Drupal Troll Module on Byethost’s Free Webspace

I’m running some Drupal site hosted by which is more and more being overrun by spammers and harvesters. Sadly it’s not possible to block IPs with .htaccess with these free hosting plans, so I installed the Troll Module to provide IP blocking. But it was only possible to block single IPs and not whole networks. I’ve modified the Module to allow blocking whole networks, but without support for “odd” subnets.

Drupal Logo

Here’s my patch for the Drupal 4.6.x Troll Module, which might work for other versions too. I’ve submitted it on the Drupal site, so maybe it’ll be included in the official release someday.

To block all IPs 1.2.3.x for example, you’ll have to add 1.2.3 (without trailing dot!) to the IP blocking table using the Troll Module web administration pages.

Other ways I’ve tried to block spammers are not working. The great Bad Behaviour sadly isn’t working anymore since Byethost installed some transparent proxy for load balancing and caching. The Spam Module bayes filter isn’t trained enough yet. And the Spam SURBL doesn’t seem to work.
I signed in at Project Honey Pot, but I am only able to use their QuickLinks, which I’m also using on this blog. Hosting their Spam Trap scripts won’t work because of disabled PHP functions.

But for now I’m spared from those stupid spammers! :D

Create a free website or blog at