SpamAssassin

From Gentoo Wiki
Jump to: navigation, search

Configuration

SpamAssassin comes with a number of modules (or plugins) that can be enabled or disabled via configuration files. These files can be found under /etc/mail/spamassassin. When new plugins appear in a release of SpamAssassin, they are configured in a file named (for example) v341.pre, which corresponds to SpamAssassin v3.4.1 and contains configuration for new plugins as of that version.

Your local configuration belongs in local.cf; however, any file with a .cf suffix (in that same directory) will be loaded by SpamAssassin.

Bayes SQL database

By default, SpamAssassin comes configured to use BerkeleyDB (USE=berkdb) for its bayes database. If you chose some other database (e.g. USE=mysql, USE=postgres, or USE=sqlite), then you will need to configure SpamAssassin to use that database before SpamAssassin will run.

Detailed instructions are provided with SpamAssassin and can be found in README.bayes within your SpamAssassin documentation directory (something like /usr/share/doc/spamassassin*/README.bayes).

Spam detection rules

Our SpamAssassin ebuilds do not ship any rules. You need to download these yourself after SpamAssassin has been installed. The simplest way to do this is to run sa-update, but first, you need to download and install the SpamAssassin project's GPG key (so that the authenticity of the rules can be verified).

To install the GPG key,

root #sa-update --import GPG.KEY

Now you should be able to download the rules:

root #sa-update

To improve performance, you may also wish to compile the rules:

root #sa-compile

(that should output a bunch of junk).

Daily updates

The SpamAssassin project regularly releases new and updated rules. It is a good idea to schedule your updates (at least) daily, so that your rules are never out of date. A cron job is ideal for this, and newer revisions supply one. Just set USE=cron and re-emerge mail-filter/spamassassin.