Changes

From SME Server
Jump to navigationJump to search
5,904 bytes added ,  13:14, 21 January 2019
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,openfusion
 +
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:
Line 35: Line 52:  
   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/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/
 
   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/
 +
 +
- [[User:unnilennium|unnilennium]]
 +
---------------------
 +
--[[User:Stephdl|Stephdl]] ([[User talk: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]] ([http://bugs.contribs.org/attachment.cgi?id=3539 direct download]).
 +
 +
'''NOTE''' As of September 5, 2015, the smeserver-geoip package is in the sme8contribs repository. Please refer to the forum issue [http://forums.contribs.org/index.php/topic,51375.msg261678.html#msg261678 Re:smeserver-geoip] for notes on enabling the repo and downloading the package.
 +
 +
---------------------------
 +
 +
== geoip2 for php ==
 +
 +
the following allows to install geoip2 support for php
 +
 +
of course you will need the db ...
 +
 +
yum install php*-php-maxmind* --enablerepo=epel
 +
 +
Installation:
 +
php54-php-maxminddb                                      x86_64                                      1.4.1-1.el6.remi                                        remi-safe                                      16 k
 +
php55-php-maxminddb                                      x86_64                                      1.4.1-1.el6.remi                                        remi-safe                                      16 k
 +
php56-php-maxminddb                                      x86_64                                      1.4.1-1.el6.remi                                        remi-safe                                      16 k
 +
php70-php-maxminddb                                      x86_64                                      1.4.1-1.el6.remi                                        remi-safe                                      16 k
 +
php71-php-maxminddb                                      x86_64                                      1.4.1-1.el6.remi                                        remi-safe                                      16 k
 +
php72-php-maxminddb                                      x86_64                                      1.4.1-1.el6.remi                                        remi-safe                                      16 k
 +
php73-php-maxminddb                                      x86_64                                      1.4.1-1.el6.remi                                        remi-safe                                      16 k
 +
Installation pour dépendance:
 +
libmaxminddb                                            x86_64                                      1.1.1-5.el6                                            epel                                            17 k
 +
 +
 +
Then you need the db.
 +
(not required if you have installed smeserver-geoip2 because the new geoipupdate tool will download and update the databases)
 +
 +
# yum install geolite2-* --enablerepo=epel
 +
 +
Installation:
 +
geolite2-city                                            noarch                                        20181204-1.el6                                        epel                                          21 M
 +
geolite2-country                                        noarch                                        20181204-1.el6                                        epel                                        1.1 M
 +
 +
for base php , we would need to built it...
 +
[[User:Unnilennium|Unnilennium]] ([[User talk:Unnilennium|talk]]) 05:41, 21 January 2019 (CET)

Navigation menu