From LedHed's Wiki
Revision as of 18:40, 21 August 2008 by Ledhed (Talk | contribs)

Jump to: navigation, search

References

DSpam README (3.6.7) Section 5. Aliases
DSpamWiki Section Reporting Mistakes


Overview

DSpam must be notified of classification mistakes. There are several methods to do this. This article will cover the "Forwarding Method". When you receive a SPAM Message in your InBox you can forward the message back to DSpam for reclassification. You must forward the mail as an attachment. Inline forwarding will not work! This article will focus specifically on my implementation which uses Postfix Virtual Users stored in a MySQL database.


Postfix Master.cf

You will need to create the following pipe in your master.cf.

#
# DSpam-Retrain
#
dspam-retrain   unix    -       n       n       -       10      pipe
  flags=Ru user=dspam argv=/usr/local/bin/dspam --user ValidUser --class=$nexthop --source=error
#
# ====================================================================

Note:
$nexthop = a variable passed by the transport. Leave it as $nexthop
ValidUser = any dspam account that has preferences setup. For example: [email protected]


Postfix Main.cf

You will need to map your transports to MySQL.

transport_maps = mysql:/etc/postfix/mysql_virtual_transport_maps.cf

Creating the Transport Table

This step assumes you know how to create tables and add records to a MySQL Database. If you don't the MySQL Online Documentation is very helpful.

Login to the Mail database with your favorite MySQL Client. From Command Line:

mysql -u root -p mail

-u = user with appropriate permissions
-p = Prompt for Password
mail = Database you want to connect to


Creating the table

CREATE TABLE `transport` (
  `domain` varchar(255) NOT NULL,
  `transport` varchar(255) NOT NULL,
  PRIMARY KEY  (`domain`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;


Adding the Transport Records

INSERT INTO transport (domain,transport) VALUES("[email protected]","dspam-retrain:spam");
INSERT INTO transport (domain,transport) VALUES("[email protected]","dspam-retrain:innocent");

Note:
The transport = PIPE-NAME:$nexthop
In this case the PIPE-NAME = 'dspam-retrain' as outlined in the Master.cf step.
and the $nexthop variable which is passed to the PIPE = 'spam' or 'innocent'


Creating the Global SPAM and HAM Aliases

For 'Forward Training' to work you have to create a legitimate virtual account and aliases for SPAM@ and HAM@ otherwise postfix will be unable to deliver the message because it can't find the recipient.