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
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/)
#2
Doh! I swapped the original and modified versions in my diff/patch. Here is the right one.
Regards
FrankZabbath (http://bembelbee.wordpress.com/)
#3
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
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.
#5
I didn't use the patch, but I am adding a textarea to import IP blocks through a textarea.
#6
Automatically closed -- issue fixed for 2 weeks with no activity.
#7
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