Training DSPAM from the output of your current Anti-Spam Solution

In setting up our DSPAM installation, we wanted our users to have an "out of box" experience similar to our current Spam Assassin filtering. While we knew the filtering could be better than Spam Assassin, we wanted to start out at least that good. This required doing some pre-training.

Configuring DSPAM

First, we had to configure DSPAM to use a global group for users that had not built up their own dictionaries. As documented, place this line in $DSPAM_HOME/group, which in this case would be /var/spool/dspam/group:

groupname:classification:*globaluser

Set up two training aliases for this user in your /etc/aliases file:

train-spam: "|/usr/bin/dspam --user globaluser --class=spam   --source=corpus --mode=teft"
train-ham: "|/usr/bin/dspam --user globaluser --class=innocent   --source=corpus --mode=teft"

Make sure you run newaliases after this, or whatever command is needed to make your MTA realize there were config changes.

Since we don't want the training aliases to acquire their own dictionaries, run these two commands:

dspam_admin add preference train-ham optOut on
dspam_admin add preference train-spam optOut on

If you are running in "Opt In" mode, run those two commands, but change the command to "optIn off" just to be safe.

In your dspam.conf file, make sure there is a line that says:

Trust username

where "username" is the name of the user as which your MTA runs the scripts. In the case of Postfix, all scripts spawned by Postfix are run as user "nobody."

Configuring Amavis

In our case, we were moving away from Amavis and Spam Assassin, so the instructions will be centered around that fact. Please add other solutions as well.

We wanted all mail that has been through Amavis to be forwarded to our training aliases. To enable this "clean quarantine" feature, Amavis 2.4.1 or later must be used.

Add, or change, these lines in your Amavis config to read:

$spam_quarantine_method = 'local:spam/spam-%b-%i-%n';
$spam_quarantine_to = 'train-spam@your.host.com';
$clean_quarantine_method = 'local:clean-%m';
$clean_quarantine_to  = 'train-ham@your.host.com';

NOTE: We are doing the training via forwarding to another box. If you are trying to forward back to the same box, you may need to make some adjustments to make sure the mail is not re-filtered. You might be able to avoid filtering by using the username@ syntax for the quarantine_to parameter (see the Amavis config file for more information).

Another option for doing the training on the same box would be to save all spam and clean e-mail to files and then run those files through dspam via its dspam_train command.

last edited 2006-06-23 18:54:24 by JoshuaKugler