Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Banning by Country
PostPosted: 2009-12-14 02:43 
Senior user
Senior user
User avatar

Joined: 2009-07-01 20:46
Posts: 453
Elo,

Done a script to ban IP ranges by country.

http://forum.ianbradshaw.co.uk/viewtopic.php?f=19&t=62

Needs perl and the required modules installed (see entry).

Beware : TEST THIS FIRST ... if you screw up the config file you will screw up your install. Make a database backup first!

I assume that if you select a lot of countries then the server will slow down ... so be sensible.

Suggest running it monthly as thats when the maxmind database gets updated ... any more is a waste of time unless you change your blocked countries.

S.


Top
 Profile  
 
 Post subject: Re: Banning by Country
PostPosted: 2009-12-14 02:50 
Senior user
Senior user
User avatar

Joined: 2009-07-01 20:46
Posts: 453
doh ... just realised percepts had done this using scripts ... meh

probably better to use the scripts than fill the database with blocked ip ranges ...

/me must check forum before doing something

S.


Top
 Profile  
 
 Post subject: Re: Banning by Country
PostPosted: 2009-12-14 07:16 
Senior user
Senior user
User avatar

Joined: 2005-10-13 21:28
Posts: 2486
Location: Lithuania
http://spameatingmonkey.com/geobl/usage.html

are you sure that you can't find working RBL with country blacklists


Top
 Profile  
 
 Post subject: Re: Banning by Country
PostPosted: 2009-12-14 10:56 
Senior user
Senior user
User avatar

Joined: 2009-07-01 20:46
Posts: 453
Never said you couldnt?

I was assuming (maybe wrongly) ... that i would be faster to do it locally than via another external connection for each mail check ... and guessed the IP range would kick in before rules / BL were processed.

S.


Top
 Profile  
 
 Post subject: Re: Banning by Country
PostPosted: 2009-12-15 11:22 
New user
New user

Joined: 2009-12-15 11:19
Posts: 1
Wouldn't it just be easier to download the data from http://files.spameatingmonkey.com/public/countries/ instead of trying to parse the maxmind data?


Top
 Profile  
 
 Post subject: Re: Banning by Country
PostPosted: 2009-12-15 11:37 
Site Admin

Joined: 2005-07-29 16:18
Posts: 13628
Location: UK
Parsing maxmind data is easy once you add it to a database and takes only a minute to add the whole list to a database. Downloading all those files from spameatingmonkey once a week / month and parsing them seems very overcomplicated and long winded to me.

_________________
If at first you don't succeed, bomb disposal probably isn't for you! ヅ


Top
 Profile  
 
 Post subject: Re: Banning by Country
PostPosted: 2009-12-15 13:02 
Senior user
Senior user
User avatar

Joined: 2009-07-01 20:46
Posts: 453
I used maxmind as I think it's quite reliable ... not found another source as good yet (thats my view, so thats what I coded, I'm sure other people have other views!).

The whole thing is automated - it downloads the maxmind data, unpacks it, parses it, adds it to the HMS ip ranges and blocks them.

Downloading a lot of individual files and parsing them seperately, converting the subnets etc is all just hassle when the maxmind stuff gives you one download and simple IP ranges.

Whats easier? ... depends on how you code ... everyone will code the same thing a million different ways ... and this is the one I knew.

Doesn't matter, unless you don't trust the maxmind data - in which case need to write your own one / adapt this one to use a different data source. Most of the code should be reuseable.

S.


Top
 Profile  
 
 Post subject: Re: Banning by Country
PostPosted: 2012-05-06 05:24 
New user
New user

Joined: 2010-12-19 10:54
Posts: 7
My preference is to go by IP Range by "region" and reduce the number of entries. You can look up the IP blocks at http://www.iana.org/assignments/ipv4-address-space/ipv4-address-space.xml These blocks don't go through significant and frequent changes.

AfriNIC Africa, portions of the Indian Ocean
APNIC Portions of Asia, portions of Oceania
ARIN US, Canada, many Caribbean and North Atlantic islands
LACNIC Latin America, portions of the Caribbean
RIPE Europe, the Middle East, Central Asia

On Ver 5.4-B2012021601:
.
Image


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 


Who is online

Users browsing this forum: No registered users and 1 guest



Search for:
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group