College Logo

Rules Du Jour

There are many extra rules which can be used by Spamassassin to make MailScanner even more effective. One of the easiest ways to get hold of a good set of them is to use the RulesDuJour script

cd /usr/local/bin
wget http://sandgnat.com/rdj/rules_du_jour
chmod +x rules_du_jour
mkdir /etc/rulesdujour
edit /etc/rulesdujour/config

My file is shown below; make sure that the locations are correct for your system (and that it shows your email address!

TRUSTED_RULESETS="TRIPWIRE ANTIDRUG SARE_EVILNUMBERS0 SARE_EVILNUMBERS1 \
SARE_EVILNUMBERS2 RANDOMVAL BOGUSVIRUS \
SARE_ADULT SARE_FRAUD SARE_FRAUD_PRE25X SARE_BML SARE_BML_PRE25X \
SARE_RATWARE SARE_SPOOF SARE_BAYES_POISON_NXM SARE_OEM SARE_RANDOM \
SARE_HEADER SARE_HEADER0 SARE_HEADER1 SARE_HEADER2 SARE_HEADER3 \
SARE_HEADER_ENG SARE_HEADER_X264_X30 SARE_HEADER_X30 SARE_HTML \
SARE_HTML0 SARE_HTML1 SARE_HTML2 SARE_HTML3 SARE_HTML4 SARE_HTML_ENG \
SARE_HTML_PRE300 SARE_SPECIFIC SARE_OBFU SARE_OBFU0 SARE_OBFU1 SARE_OBFU2 \
SARE_OBFU3 SARE_REDIRECT SARE_REDIRECT_POST300 SARE_SPAMCOP_TOP200 \
SARE_GENLSUBJ SARE_GENLSUBJ0 SARE_GENLSUBJ1 SARE_GENLSUBJ2 \
SARE_GENLSUBJ3 \
SARE_GENLSUBJ_X30 \
SARE_GENLSUBJ_ENG \
SARE_HIGHRISK \
SARE_UNSUB \
SARE_URI0 \
SARE_URI1 \
SARE_URI2 \
SARE_URI3 \
SARE_URI_ENG \
SARE_WHITELIST \
SARE_WHITELIST_PRE30"

SA_DIR=/usr/local/etc/mail/spamassassin
EMAIL_RDJ_UPDATE_ONLY=
SINGLE_EMAIL_ONLY=true
MAIL_ADDRESS=postmaster@domain
SA_LINT="spamassassin --lint"
SA_RESTART="/usr/local/etc/rc.d/mailscanner.sh restart"
TMPDIR="${SA_DIR}/RulesDuJour"

rules_de_jour has a hard coded path to Bash which is wrong for FreeBSD - edit the file and change the first line so that it says:

#!/usr/local/bin/bash

Now run it to see if it works -

bash /usr/local/bin/rulesdujour

If all's well then you'll see it update and you'll get an email telling you what's happened. Finally, you need to add an entry to crontab so that the script runs once a day. You are asked to pick a random time to avoid overloading the servers

#update rules_du_jour at 19:58 each day
58      19      *       *       *       root    /usr/local/bin/rules_de_jour

(Thanks to Leif Neland for pointing out a mistake in that line)