automatic qmail spamassassin rules update with sa-update

1. this tutorial is for qmail + qmail-scanner + spamassassin on Fedora Core or Redhat, assumming those three work fine. this tutorial only covers how to update spamassassin rules using sa-update automatically via crontab. for this to work, use at least SpamAssassin versions 3.1.4

2. $ cd /etc/mail/spamassassin
$ mkdir sa-update-keys
$ cd sa-update-keys
$ locate sa-update-pubkey.txt
/usr/share/spamassassin/sa-update-pubkey.txt

$ sa-update –import /usr/share/spamassassin/sa-update-pubkey.txt
$
wget http://daryl.dostech.ca/sa-update/sare/GPG.KEY
$
sa-update –import GPG.KEY
$ cd /etc/mail/spamassassin
$ locate sa-update

/usr/bin/sa-update
$ vi getruleupdate.sh

#!/bin/sh

HOMEDIR=/usr/local/etc/mail/spamassassin/sa-update-keys

# Retrieve updates to SpamAssassin’s rules.
# Rules go into the default directory of /var/lib/spamassassin/.

/usr/bin/sa-update –channelfile $HOMEDIR/update-channels.txt –gpghomedir $HOMEDIR –gpgkey 856AA88A -D

# Restart spamd after an update.

service spamassassin restart

3. $ vi /etc/mail/spamassassin/sa-update-keys/update-channels.txt

updates.spamassassin.org
70_sare_stocks.cf.sare.sa-update.dostech.net
70_sare_oem.cf.sare.sa-update.dostech.net
70_sare_adult.cf.sare.sa-update.dostech.net

4. getruleupdate.sh script first run will force sa-update to download rules to the default directory /var/lib/spamassassin

5. $ vi /etc/crontab

# check for SpamAssassin rule updates once a week
20 2 * * 4 root /etc/mail/spamassassin/getruleupdate.sh


6. $ vi /etc/mail/spamassassin/local.cf
required_hits 2

7. $ vi /var/qmail/bin/qmail-scanner-queue.pl
find
my $sa_delete
and change the value to
my $sa_delete=’1′;

8. $ /etc/mail/spamassassin/getruleupdate.sh

9. source :

  • http://daryl.dostech.ca/sa-update/sare/sare-sa-update-howto.txt
  • http://daryl.dostech.ca/sa-update/sare
  • http://www.rulesemporium.com/rules.htm
  • http://www.arda.homeunix.net/spamassassin.html