In this recipe, we will learn how to install and set up a well-known e-mail filtering program, spam-assassin.
You will need access to a root account or an account with sudo
privileges.
You need to have Postfix installed and working.
Follow these steps to filter mail with spam-assassin:
Install spam-assassin with the following command:
$ sudo apt-get update $ sudo apt-get install spamassassin spamc
Create a user account and group for spam-assassin:
$ sudo groupadd spamd $ sudo useradd -g spamd -s /usr/bin/nologin \ -d /var/log/spamassassin -m spamd
Change the default settings for the spam daemon. Open
/etc/default/spamassassin
and update the following lines:ENABLED=1 SAHOME="/var/log/spamassassin/" OPTIONS="--create-prefs --max-children 5 --username spamd --helper-home-dir ${SAHOME} -s ${SAHOME}spamd.log" PIDFILE="${SAHOME}spamd.pid" CRON=1
Optionally, configure spam rules by changing values in
/etc/spamassassin/local.cf
:trusted_networks...