Difference between revisions of "Talk:GeoIP"

From SME Server
Jump to: navigation, search
(Installation details for GeoIP2 V2 db)
 
Line 1: Line 1:
 +
Following to be added to wiki once GeoIP2 is released
 +
 +
===Installation===
 +
The openfusion repo is required for the updated Geoip V2 db
 +
 +
yum  install smeserver-extrarepositories-openfusion
 +
signal-event yum-modify
 +
config set UnsavedChanges no
 +
yum --enablerepo=openfusion install perl-GeoIP2
 +
 +
yum install smeserver-geoip --enablerepo=smecontribs
 +
then
 +
geoipupdate -v
 +
 +
signal-event geoip-update
 +
 +
 
Blocking SPAM by country is IMHO not a very nice solution as you will also blocking legitimate users from these countries.  
 
Blocking SPAM by country is IMHO not a very nice solution as you will also blocking legitimate users from these countries.  
 
I think you might be far better of by using blacklists and bayes filtering in combination with the auto-learn feature. This way mail is checked based on their contents and flagged as SPAM. More information on the bayes filtering and autolearn features can be found here:
 
I think you might be far better of by using blacklists and bayes filtering in combination with the auto-learn feature. This way mail is checked based on their contents and flagged as SPAM. More information on the bayes filtering and autolearn features can be found here:

Latest revision as of 05:37, 9 July 2018

Following to be added to wiki once GeoIP2 is released

Installation

The openfusion repo is required for the updated Geoip V2 db

yum  install smeserver-extrarepositories-openfusion
signal-event yum-modify
config set UnsavedChanges no
yum --enablerepo=openfusion install perl-GeoIP2
yum install smeserver-geoip --enablerepo=smecontribs

then

geoipupdate -v
signal-event geoip-update


Blocking SPAM by country is IMHO not a very nice solution as you will also blocking legitimate users from these countries. I think you might be far better of by using blacklists and bayes filtering in combination with the auto-learn feature. This way mail is checked based on their contents and flagged as SPAM. More information on the bayes filtering and autolearn features can be found here:

  1. http://www.sonoracomm.com/index.php?option=com_content&task=view&id=49&Itemid=32
  2. http://wiki.contribs.org/Email#Setup_Blacklists_.26_Bayesian_Autolearning

- Cactus 09:03, 12 December 2007 (MST)

==================================

This has more implication other than blocking. It's also tracking & plotting on map. Only the last part has to do with blocking.

Even so, the reality is that not all countries have friendly intentions or have quality standards in their communication law.

Here are my stats for the last month:

#                                 Most Recent Logfile      Cumulative Totals
# Disposition (plugin)            Total       Avg/Day      Total       Avg/Day
# ----------------------------------------------------------------------------
# check_badcountries               1414  44%    21665     275083  41%    11943

So, I've been blocking 21665 messages a day. This is a big chunk of messages that never even have to be scanned on a daily basis. The number of complaints I have received are zero.

- kruhm

Nobody complaints if he can't !


your users are not aware of messages they can't read, and the one that send a message from a banned country can only be reject when he tries to mail the admin of the server !


- unnilennium


be aware that some versions of geoip will expect databases at another place, here is a modified version of cron part to avoid this :

# Updating the GeoIP database monthly on the 5th at 0:00h.
 0 0 5 * * root /usr/bin/wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz -O /var/lib/GeoIP/GeoIP.dat.gz; /bin/gunzip -f /var/lib/GeoIP/GeoIP.dat.gz; cp /var/lib/GeoIP/*.dat /usr/share/GeoIP/
 0 0 5 * * root /usr/bin/wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz -O /var/lib/GeoIP/GeoIPCity.dat.gz; /bin/gunzip -f /var/lib/GeoIP/GeoIPCity.dat.gz; cp /var/lib/GeoIP/*.dat /usr/share/GeoIP/

- unnilennium


--Stephdl (talk) 15:01, 11 September 2015 (CEST) Information removed

GeoIP plugin

We need the GeoIP package and the perl interface to the program but this isn't installed on SME Server. We'll have to grab the packages from yum. Yum has access to different public repositories where packages are available. GeoIP is in the epel repository. We'll enable the repository and install them.

yum --enablerepo=epel install perl-Geo-IP 

Yum does the magic and knows to install both the program and the interface.

GeoIP database

For the plugin to work we need the GeoIP database. This database is maintained and updated a company called MaxMind. We'll have to download it every month for the Lite version we are using here or pay for their subscription service to be as accurate as possible and download once a week.

The database needs to be in a specific location or it won't work. We'll change to that location.

cd / 
mkdir /var/lib/GeoIP
cd /var/lib/GeoIP 

Now we'll get the latest database. The database is also in the repositories but it's outdated. We'll grab the most recent directly from MaxMind.

wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz

The database is zipped. We'll have to unzip it.

gunzip GeoIP.dat.gz

Creating a cron-job

We can add a cron-job to automate the monthly process of updating the GeoIP database:

 mkdir -p /etc/e-smith/templates-custom/etc/crontab

Now we will add a custom template fragment:

 vim /etc/e-smith/templates-custom/etc/crontab/91_Update_GeoIP_db

Add the following to this fragment, this will download and extract the new database every month:

 # Updating the GeoIP database monthly on the 5th at 0:00h.
 0 0 5 * * root /usr/bin/wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz -O /var/lib/GeoIP/GeoIP.dat.gz; /bin/gunzip -f /var/lib/GeoIP/GeoIP.dat.gz

To activate the custom template fragment:

 expand-template /etc/crontab

GeoIP qpstmpd plugin

The email receiving component of SME Server is called qpsmtpd. It's great because it allows us to turn plugins on or off or create our own when we need. The GeoIP plugin is already in SME Server but it's turned off. I've created a RPM but it's not in any of the repoitories, it's attached to a bugzilla: 1866 (direct download).

NOTE As of September 5, 2015, the smeserver-geoip package is in the sme8contribs repository. Please refer to the forum issue Re:smeserver-geoip for notes on enabling the repo and downloading the package.