Spam filtering - Spamassassin and Procmail on Redhat Linux

Spamassassin filters out allmost all spam without user made rules. This document (or mini-howto) explains how to install spamassin system wide in redhat.

Install spamassassin

If you are using yum, install with

yum -y install spamassassin procmail

Spamassassin is invoked by procmail when new mail arrives. Add spamasssain to all users by editing nano /etc/procmailrc

# /etc/procmailrc for redhat (c) 2003 Tero.Karvinen atsign iki.fi
DROPPRIVS=1

:0fw:spamassassin.lock
* < 256000
|/usr/bin/spamassassin

:0
* ^X-Spam-Status: Yes
$HOME/mail/spam

If you don't want to force you users to filtering spam, you can just tag spam in /etc/procmailrc by commenting out the $HOME/mail/spam rule (last 3 lines). Users can then use $HOME/.procmailrc to handle spam as they see fit.

If your system has a lot of users, consider using spamd.

Rules improved

Spamassassin works great out of the box, no user configuration needed. Especially, there is no reason to create large blacklists of hosts you don't want to receive mail from.

Improved rules:

# /etc/mail/spamassassin/local.cf (c) 2003 Tero Karvinen
# Local.cf must be world readable (chmod a+r local.cf)
# Users can override settings with $HOME/.spamassassin/user_prefs

# required_hits 5
# whitelist_from *@somewhere.com

# Image link to track mail viewing - score WEB_BUGS -0.430
# Default rule is too narrow: /<\s*img\s[^>]*src[^>]+\?/i
score WEB_BUGS 2.5

# HTML-only mail, with no text version - score CTYPE_JUST_HTML 1.665
score CTYPE_JUST_HTML 3

# HTML attachment - score __CTYPE_IS_HTML 0
score __CTYPE_IS_HTML 0.6

# Message includes Microsoft executable program - score MICROSOFT_EXECUTABLE 0.100
MICROSOFT_EXECUTABLE 2

# Osirusoft is closed and blocks the world
score RCVD_IN_OSIRUSOFT_CO­M 0.0
score X_OSIRU_DUL 0.0
score X_OSIRU_DUL_FH 0.0
score X_OSIRU_OPEN_RELAY 0.0
score X_OSIRU_SPAMWARE_SIT­E 0.0
score X_OSIRU_SPAM_SRC 0.0

Links

See Mika Hirvonen's website for improved Spamassassin rpms and baynesian filtering.

Adminstrivia

Todo: Write guide to some baynesian filter, they get better results nowadays.

This howto was tested with redhat 9.0.

Copyright 2003-mm-dd, 2003-09-28 Tero Karvinen. GNU Free Documentation Licence. XHTML Basic 1.0