Block an IP address range

jacauc - April 14, 2007 - 06:09
Project:Troll
Version:6.x-1.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

Is it possible to block an IP address range?
I keep getting comment spam from 81.177.38.0/24 and 81.177.15.0/24

Is there an easy way to do a "blanket" block for these subnets, instead of manually adding the IPs one by one? If so, how/where?
If not... Can we reassign this as a feature request.

Thanks
jacauc

#1

anonymous@tempo... - April 28, 2007 - 22:13
Version:5.x-1.1» 4.6.x-1.x-dev
Component:Miscellaneous» Code

Hi there!

I was missing this feature too. So I played a little with the PHP code (Troll Module for Drupal 4.6!) and it seems to work that way. Now I can simply add a shortened IP address to the ip ban table like "81.177.38" or "81.177.15". Note the IP address may not end with a dot!
The user account I'm currently using here at drupal.org isn't my own; I simply took one from bugmenot.com - hope thats okay! I've attached a patch file and you can find a diff at http://www.pastebin.ca/463277.

Regards
FrankZabbath (http://bembelbee.wordpress.com/)

AttachmentSize
troll-4.6.x-ban_ip_nets.patch 884 bytes

#2

anonymous@tempo... - April 28, 2007 - 22:43

Doh! I swapped the original and modified versions in my diff/patch. Here is the right one.

Regards
FrankZabbath (http://bembelbee.wordpress.com/)

AttachmentSize
troll-4.6.x-ban_ip_nets_0.patch 884 bytes

#3

jacauc - May 8, 2007 - 05:21
Version:4.6.x-1.x-dev» 5.x-1.x-dev

Thanks!
Unfortunately I am not a coder, so I would not even know where to start to convert this patch to a drupal 5 compatible patch.
Would someone be so friendly as to submitting a D5.1 patch please

thanks again
jacauc

#4

jaydub - March 12, 2008 - 09:43
Status:active» needs review

I've rewritten to allow for setting an IP block as _either_ a whitelist or a blacklist.

Basically I just took the code already used to create whitelist IP blocks and generalized it to be used
for either white or blacklists.

See attached patch.

AttachmentSize
troll.module.136225.patch 6.01 KB

#5

deekayen - May 9, 2009 - 05:12
Version:5.x-1.x-dev» 6.x-1.x-dev
Status:needs review» fixed

I didn't use the patch, but I am adding a textarea to import IP blocks through a textarea.

#6

System Message - May 23, 2009 - 05:20
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

#7

AppleBag - September 10, 2009 - 19:49

Was this ever added to the release? I have the latest 5.x version and just tried to add 208.53.133 to the IP blocking, and it just gave me an error saying invalid IP. I'm trying to block an anon proxy service who's IP always changes at the last octet. Not quite clear on how to use the blacklist to manually insert one range?

also, is it possible to use troll to automatically detect and block ALL proxies?

TIA

 
 

Drupal is a registered trademark of Dries Buytaert.