Update Spamassassin

Spammers tricks for getting round spam filters changes very fast. SpamAssassin is a great spam fighting tool, which I use to effectively eliminate most spam, however, there is no point in running a spam filter if it doesn’t catch the latest spam techniques. SpamAssassin comes with a great tool for keeping on top of the latest spammer techniques called sa-update. sa-update downloads new configuration files (rules, scores, etc,) so that SpamAssassin will use them to better catch spam and/or to avoid catching ham messages.

sa-update comes as a standard part of SpamAssassin, so if you’ve got SpamAssassin up and running, you should have sa-update ready and waiting for “activation”. sa-update is a commandline application, so it is ideal for running as a cron-job (a scheduled task).

To run sa-update daily at 4am, you need to add a line to the crontab file for root. You can do this using:

sudo crontab -e
Password:

This will open up your default editor (and depending on whether you’ve added cron jobs previously) an empty file or a file with a few lines that look like something a bit like this:

0,20,40 8-17 * * 1-5 /usr/lib/sa/sa1 1200 3 &
0 * * * 0,6 /usr/lib/sa/sa1 &
0 18-7 * * 1-5 /usr/lib/sa/sa1 &
5 18 * * 1-5 /usr/lib/sa/sa2 -s 8:00 -e 18:01 -i 3600 -ubcwyaqvm &

To make sa-update run at 4am each day, you need to add the following line to root’s crontab:

0 4 * * * sa-update && /etc/init.d/spamd restart

This will run the sa-update program, and if successful restart the SpamAssassin daemon with the newly downloaded rules.