SpamAssassin

in

Installation

Install and run the daemon

yum install -y spamassassin

Configure daemon options in /etc/sysconfig/spamassassin (SPAMDOPTIONS=...):

  • -d - daemonize
  • -c - create user preferences
  • -m5 - allow 5 children maximum
  • -H - use the spamc caller’s home directory
  • -D - print debugging information
  • -s daemon - syslog facility

Run daemon

chkconfig spamassassin on
service spamassassin restart

Configuration

Edit /etc/mail/spamassassin/local.cf (options, all config files):

The bayes_path options refers to a file under /var/lib/spamassassin.

Rules by Michael Verbitsky

Scores for Michael Verbitsky's /etc/mail/spamassassin/local.cf (list of tests):

Rules by Alan Makoev

Download the rule file in /usr/share/spamassassin/99_russian_re.cf

Fix for weblancer.net etc mail feeds: score BODY_KOI8_RASSJLO4 1 2, score BODY_WIN1251_RASSJLO4 1 2

User preferences in database

Create database tables in mysql for spamassassin parameters

mysql -uroot -pPASS < [[#spamassassin.sql|/usr/share/cgpav/spamassassin.sql]]

Add this to /etc/mail/spamassassin/local.cf:

# userprefs in mysql
user_scores_dsn          DBI:mysql:spamassassin:localhost
user_scores_sql_username spamassassin
user_scores_sql_password spampass

Simple test

Verify that it works correctly

$ cd /group/public/anti
$ spamc -c < sample-nonspam.txt
0.0/5.0
$ spamc -c < sample-spam.txt
1000.0/5.0 $ spamc -c < sample-spam2.txt
7.7/5.0 $ spamassassin < sample-spam2.txt | head -5
X-Spam-Flag: YES
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on localhost
X-Spam-Level: **************************************************
X-Spam-Status: Yes, score=1000.0 required=5.0 tests=GTUBE,
               NO_RECEIVED,NO_RELAYS autolearn=no version=3.2.5

Tricks

By default sa-learn created databases in ~/.spamassassin,but spamd takes them from /var/spool/mail/.spamassassin'.Therefore, run sa-learn with --dbpath=/var/spool/mail/.spamassassin

Possible fix: increase score for bayes filters, like

score BAYES_99 5.0
score BAYES_95 4.5
score BAYES_80 4.0
score BAYES_60 3.0
score BAYES_50 2.0

Attachments

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
To prevent automated spam submissions leave this field empty.