Spamassassin spam filter
Spamassassin version
Tested with Spamassassin 3.0.4.
Introduction
These instructions are adapted from
this article. The result is that all mail will be filtered through Spamassassin, which adds a header like this to any messages it thinks are probably spam:
X-Spam-Flag: YES
Other programs can then treat those messages specially; see
StandardSympa.
This requires Postfix set up as in
StandardPostfix, and
StandardPerlModules.
Installing Spamassassin
Install
/usr/local/configure-wrappers/configure-spamassassin (make it world-executable).
Download the latest
Spamassassin tarball. Compile and install:
tar zxf Mail-SpamAssassin-x.y.tar.gz
cd Mail-SpamAssassin-x.y
/usr/local/configure-wrappers/configure-spamassassin
make
sudo make install
In
/etc/profile:
- Add
/usr/local/spamassassin/bin to LOCAL_PATH.
- Add
/usr/local/spamassassin/man to LOCAL_MANPATH.
- Add
/usr/local/spamassassin//share/perl/5.8.4 to PERL5LIB.
Install:
Make startup links to the init script:
sudo update-rc.d spamassassin defaults
Postfix filtering
Create a mail-filter user:
sudo adduser --system --group --home /var/spool/filter filter
Install:
Set the ownership and permissions of
filter.sh:
sudo chown root:filter /usr/local/bin/filter.sh
sudo chmod 755 /usr/local/bin/filter.sh
Tell Postfix to reload its configuration:
sudo postfix reload
Note that the
filter user will have its own Spamassassin configuration file in
/var/spool/filter/.spamassassin/user_prefs. You can edit site-wide preferences in this file, or in
/usr/local/spamassassin/etc/mail/spamassassin/local.cf. See
the Spamassassin documentation for details of what you can put in these files.
Start Spamassassin
sudo /etc/init.d/spamassassin start
Procmail filtering
If you use Procmail to filter your email, put this in your
~/.procmailrc:
:0:
* ^X-Spam-Flag: YES
$HOME/Maildir/.Spam/
Upgrading
tar zxf Mail-SpamAssassin-x.y.tar.gz
cd Mail-SpamAssassin-x.y
/usr/local/configure-wrappers/configure-spamassassin
make
sudo /etc/init.d/spamassassin stop
sudo make install
sudo /etc/init.d/spamassassin start
to top