Skip to content. | Skip to navigation

Navigation

Personal tools

Mail Applications

Building a mail system

SpamAssassin

Perl based anti-SPAM functionality

SpamAssassin is very popular and does a pretty good job when trained.

That said, training it can be a pain (so you might as well let it just learn as you go) and the mercurial interests of the SPAM producers means your training is likely out of date already (and you've not started yet).

One particularly troublesome problem with training is how to have it happen automatically for incoming email. Here's the scenario: incoming mail is filtered by Postfix through AMaViS which in turn invokes SpamAssassin. SpamAssassin does what it can and labels the mail appropriately (you'll see extra headers in the email if the SPAM rating goes above 2 -- above 7 and it's rejected!). As it's going along SpamAssassin updates it's knowledge of the world (in the AMaViS user's home directory).

So far, so good. However, SpamAssassin will be letting through SPAM that it can't decide on absolutely. We, the user (and administrator) can see this growing pile of known SPAM and want to educate SpamAssassin about these new facts. However, if we, the user, run sa-learn it'll update our own SpamAssassin knowledgebase but not the AMaViS user's knowledgebase. After all, why should sa-learn update an aritrary user's knowledgebase?

We also get bitten by a couple of permission problems:

  1. AMaViS creates some knowledgebase files with 0600 permissions
  2. All email is stored in an 0600 permission'ed hierarchy (and as a different user)

Any solution would have to involve going into every user's email hierarchy (as root) and copy files out of a well known subdirectory (Junk, say) then chowning the lot to the AMaViS user and running sa-learn on the lot. Making sure we keep track of previously seen emails etc., if we're feeling keen.

It's not easy, whatever you think.

Anyway, installing SpamAssassin is pretty straightforward, noting you'll almost certainly have to install a couple of dependent modules:

perl -MCPAN -e shell

install Digest::SHA1
install HTML::Parser

install Mail::SpamAssassin

With SpamAssassin 3.2.4 hiding in the output was the need for:

install Net::DNS

Document Actions