Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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

When using SA 3.1.0, you You can also write rules that match specific countries and add them to your /etc/mail/spamassassin/local.cf file. For example:

No Format

   header          RELAYCOUNTRY_CNBAD X-Relay-Countries =~ /CN/
   describe        RELAYCOUNTRY_CNBAD Relayed through China at some point
   score           RELAYCOUNTRY_CNBAD 3.0

   header          RELAYCOUNTRY_RUGOOD X-Relay-Countries =~ /RU^(FI|SE)/
   describe        RELAYCOUNTRY_RU Relayed through Russian FederationGOOD First untrusted relay is Finland or Sweden :-)
   score           RELAYCOUNTRY_RUGOOD -0.2.0

You can get a list of IANA 2-letter ISO 3166 country codes from SpamAssassin::EvalTests.pm] http://www.iso.org/iso/country_codes/iso_3166_code_lists/. You can get a list of countries that statistically relay most of the spam by looking at the source file for [for example from http://svnwww.apachespamhaus.org/repos/asf/spamassassin/branches/3.1/lib/Mail/SpamAssassin/EvalTests.pm and reading the comments surrounding $CCTLDS_WITH_LOTS_OF_OPEN_RELAYS.statistics/countries.lasso. Be careful not to score too much or too many, email is global by nature.

You can also Also for 3.1.0, you can apply a patch http://bugzilla.spamassassin.org/show_bug.cgi?id=3815 which will allow you to add a separate MIME header that shows all the message's relay countries, independent of the rules.:

No Format

   add_header all Relay-Country _RELAYCOUNTRY_

and this This will show up in your MIME headers as:

No Format

   X-Spam-Relay-Country: US CN RU

Note about IP::Country::Fast database

As of writing, the latest version of IP::Country::Fast is almost two years old, meaning the bundled database is as old. There is no internal update mechanism.

The database consists of files named cc.gif and ip.gif. You can find the path with this command:

No Format
   $ perl -MIP::Country::Fast -e '$_=$INC{"IP/Country/Fast.pm"};s/\.pm/\n/;print';

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.

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

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