Setup SpamAssassin anti-spam

From OpenFSG

Jump to: navigation, search

Contents

Having your own mailserver sitting right there in your study is kinda cool. But you might find yourself missing the anti-spam protection you enjoy with commercial email services. Fret no more! SpamAssassin isn't too scary to get going.

NOTE these steps tested on v3.1.29 only. Feel free to play on yours. Or donate a couple of FSGs and I'll play with them ;)

First Steps

These are the easy bits! Open up an SSH session and su to root.

ipkg install spamassassin
ipkg install procmail

Perl support is required, but mine already had it and I don't recall adding it manually, so I suspect it's supplied with the distro.

Time to get your hands dirty

We need to do some configuration work now, and most of it has to be done per user/mailbox, I'm afraid. Unless somebody can come up with a clever script to automate that?

For each user:

  • Create a file called ".forward" (without the quotes) in the user's home directory, containing the following text (INCLUDING the quotes!)
    "|IFS=' ' && exec /opt/bin/procmail -f- || exit 75 username"
    but replace username with the user's actual name.
  • Create a file called ".procmailrc" (without the quotes) in the same directory, containing
:0fw: spamassassin.lock
| /opt/bin/spamassassin
(I guess this file can be the same for every user)
  • You probably now want to switch on the header-rewrite, so that SPAM is clearly visible...
cd /opt/etc/spamassassin
vi local.cf
and uncomment (by removing the hash) the line:
# rewrite_header Subject *****SPAM*****
and probably remove a few of those asterisks too! But that's just personal taste.

And you're done

OK, that's a lie, you still need to test it! From another account, send yourself:

  • A non-spammy, plain-text email.
  • A non-spammy, HTML email.
  • A spam-test email. Best bet for this is to send an email with
    XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X
    in the body - this is a published test string that spam-catchers check for

and check the results. With a little luck, only the third one will be tagged as SPAM.

Personal tools