Thursday, June 24, 2004

SpamAssasin, Postfix and RedHat Enterprise Linux 3

Configured Postfix and SpamAssassin under RHEL 3.0 as a DMZ SMTP Proxy. Simple bidirectional relay to keep the Exchange server off the Internet.

Got postfix functioning as the relay. I wanted SpamAssassin to be configured without the requirement for a downloaded ruleset, and without the overheads of AMAVIS or RAZOR.
Found my kind of howto, short and sweet: Postfix and SpamAssassin Howto [Link Updated 21st Dec 2004]

Because we are not using per user spam prefs, we need to tell spamassassin that we do not want per user configs. Modify the /etc/sysconfig/spamassassin file, and change the "-c" flag to "-x". (man spamd for more details)

Once that is done, I created 2 mailboxes on the local system, SPAM and NOTSPAM. Users can resend (not forward, more on this later) spam or ham messages to these mail accounts to train the system. A simple cron job was set up to "learn" about the contents of the appropriate mailboxes:

as-learn --mbox -c /path/to/shared/config --spam /var/spool/mail/spam
as-learn --mbox -c /path/to/shared/config --ham /var/spool/mail/notspam

I then set up the spam whitelist to include the domain in use, and the major business partners in /etc/mail/spamassassin/local.cf.

Important to mention, there is a big difference between forwarding email to the spam filter, and resending it. SpamaAssasin.org has a great wiki on resending mail with headers.

Enjoy!

No comments: