Spamassassin setup and config
Installing and Setting up Spamassassin
Not done yet.
User Setup #1
Spamassassin is called by procmail. A .procmailrc in a users home directory forwards/filters emails via spamassassin. The default lines for spamassassin to be included into .procmailrc are:
#SPAM :0fw | spamc #forward all emails and pipe them via spam catcher #make sure spamc is executable on the mail server. #put in the entire path to spamc if required, e.g. /usr/local/bin/spamc :0: * ^X-Spam-Status: Yes .Spam/ #If spamassassin detects a spam email - it includes a Spam header entry. If this Spam header=yes - then the email can be put into a special spam folder to be checked infrequently. The above .Spam/ folder is a Maildir folder.
User Setup #2
The above Step #1 is all that should be needed. Send an email to yourself next. Check the headers, you should see something similar to:
X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on mail.server.com X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=ALL_TRUSTED,HTML_30_40, HTML_MESSAGE,MIME_HTML_MOSTLY autolearn=ham version=3.0.3
Note: autolearn is working.
What should also happen:
A .spamassassin folder should be created in your home directory, with ~3-4 default files in it. A spamassassin default file may or may not be created. To copy one from the examples:
cp /usr/share/spamassassin/user_prefs.template /home/$USER/.spamassassin/user_prefs
A user can edit this user_prefs file adding a white and black list etc. etc.
Sample user_prefs Spamassassin User Config
The global spamassassin file is located in /etc/spamassassin/local.cf. However a normal user cannot change this. Instead, the users spamassassin config in /home/$USER/.spamassassin/user_prefs can be edited, and different scores can be used, alongside further tests etc. to be carried out. The following are increased scores for tests I consider to be spam catching:
score RCVD_IN_BL_SPAMCOP_NET 2.5 score RCVD_IN_SBL 2.0 score URIBL_SBL 1.5 score URIBL_OB_SURBL 2.5
My thinking is that - if the email is in a Spam BlackList - then its spam, and thus I wanted to give them higher scores than the default. I would consider Bouncing these emails, however I will leave it collect in the Spam folder for the time being.
User Setup #3
Getting and teaching learn and sa_learn to get better at detecting spam emails. See: http://spamassassin.apache.org/full/3.1.x/doc/sa-learn.html
More Info on User Config at: http://www.stearns.org/doc/spamassassin-setup.current.html
http://people.debian.org/~andrelop/txt/spamassassin-debian.txt = basic procmail integration
Updating Spamassassin Rules
Note: this was tested and run on ubuntu/ hardy (prob work the same on debian lenny). I needed to update spamassassin rules recently after the following was been matched: FH_DATE_PAST_20XX now that its 2010. These updates are not installed via apt-get but via spamassassin's own sa-update. Here is how:
sa-update -D #-D is for showing debug/log info /etc/init.d/spamassassin restart #I sent another email to me, checked the header, and FH_DATE_PAST_20XX no longer showed up.