Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: [Original edit by HenrikKrohns]

Using the RelayCountry plugin

The RelayCountry plugin exposes the countries that a mail was relayed from – turn it on by reading that documentation page, installing the required CPAN module IP::Country::Fast(see below), and uncommenting the 'loadplugin' line in the /etc/mail/spamassassin/init.pre file for Mail::SpamAssassin::Plugin::RelayCountry.

Required CPAN module dependencies, choose one:

GeoIP2::Reader::Database

Supported since SpamAssassin 3.4.2

IP::Country::DB_File

Supported since SpamAssassin 3.4.2

Geo::IP

Supported since SpamAssassin 3.4.0

IP::Country::Fast

Not recommended, outdated

Country metadata will also be added The RelayCountry plugin will add metadata to the Bayesian filtering process, allowing the Bayesian filters it to learn information based on countries.

...

No Format
   X-Spam-Relay-Country: US CN RU

Note about GeoIP2::Reader::Database and Geo::IP

Perhaps the easiest to install, since most distributions package these.

Note about IP::Country::

...

DB_File

This module does not come with a database or update mechanism, but it is quite easy and fast to create yourself (it does need a bit of hacking, mentioned urls are outdated).

Easier way is to download a daily generated database, sponsored by HenrikKrohns:

http://mailfud.org/ip-country-dbfile/

The gunzipped file can be placed anywhere, just let SpamAssassin know where it is (country_db_path setting).

Note about IP::Country::Fast

As of writing, the latest included database is from 2013 is three years old, meaning the bundled database is as old. There is no internal update mechanism.

...

Updating the database files requires entering dbmScripts directory in IP::Country::Fast sources and running whois_filenames, ipcc_loader.pl and ipcc_maker.pl scripts in that order. Note that the build can use up to 2GB of system memory. The files must be put in directory mentioned above, it is not configurable.

Alternatively, Here you can download premade occasionally updated files provided by Hege. These should be updated once a month or sosponsored by HenrikKrohns:

http://mailfud.org/ip-country-fast/Note: Geo::IP support was recently added to SpamAssassin 3.4 trunk, so you should use that if possible!