Up SpamAssassin Relaydelay.MC Example

Installing SpamAssassin

(see also http://www.vanadac.com/~dajhorn/projects/lmsw/10%20Spam/)

 

Install SpamAssassin RPM

Install SpamAss-Milter RPM

Install Razor RPM

Modify sendmail.mc file:

INPUT_MAIL_FILTER(`spamassassin', `S=/var/run/spamass.sock, F=, T=C:15m;S:4m;R:4m;E:10m')dnl
define(`confMILTER_MACROS_CONNECT',`b, j, _, {daemon_name}, {if_name}, {if_addr}')dnl

Modify spamassassin/local.cf file

required_hits 4

rewrite_subject 1

subject_tag [SPAM]

allow_user_rules 0

blacklist_from <insert known baddies here>

whitelist_from *@goodnets.net *@goodnest.com and other known OK domains...

use_terse_report 1

spam_level_stars 0

defang_mime 0

use_razor2 1

razor_timeout 15

rbl_timeout 20

dns_available yes

bayes_path /var/lib/spamassassin/

header RCVD_IN_BNBL eval:check_rbl('bl', 'bl.blueshore.net.')

describe RCVD_IN_BNBL Listed by BNBL

tflags RCVD_IN_BNBL net

score RCVD_IN_BNBL 2

Create spamd user

adduser --system --home /var/lib/spam --shell /bin/false --disabled-password --disabled-login spamd

Run razor-admin –register as spamd user

Run razor-client –create as spamd user

Modify spamassassin startup script data

OPTIONS="-d -a -x -u spamd"

Modify spamass-milter startup script data

SM_EXTRA_FLAGS="-r 10 -i 192.168.10.0/24"

Add spam and not-spam mailboxes to all users

su $USER –c “mkdir /usr/home/$USER/mail; \

touch /usr/home/$USER/mail/spam; \

touch /usr/home/$USER/mail/not-spam; \

echo mail/spam >> /usr/home/$USER/.mailboxlist; \

echo mail/not-spam >> /usr/home/$USER/.mailboxlist”

Add sa-learn cron job

for foo in /home/*; do

  if [ -x $foo/mail ]; then

    if [ -f $foo/mail/spam ]; then

      user=`basename $foo`

      echo "Learning for user " $user

      /bin/su -l $user -c "/usr/bin/sa-learn --spam --norebuild --mbox $foo/mail/spam"

      /bin/su -l $user -c "/usr/bin/sa-learn --ham --norebuild --mbox $foo/mail/notspam"

    fi

  fi

  /bin/su -l $user -c "/usr/bin/sa-learn --rebuild"

done

  Test SpamAssassin:

zcat /usr/share/doc/spamassassin/sample-spam.txt.gz | spamc | more

Optional: add link to spam folder and Rules Wizard rule to Outlook clients

Another howto: http://www.mail-archive.com/spamassassin-talk@lists.sourceforge.net/mail5.html#29562

Mayn Idea and the M-Light logo are trademarks of Mayn Idea Inc.
Copyright (C) 2009 Mayn Idea, Inc.
All rights reserved.

Last modified 01 Aug 2009