From LedHed's Wiki
Jump to: navigation, search
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
== References ==
 
== References ==
 
 
[http://dspam.nuclearelephant.com/text/README-3.6.7.txt DSpam README (3.6.7)] '''Section 5. Aliases'''<br>
 
[http://dspam.nuclearelephant.com/text/README-3.6.7.txt DSpam README (3.6.7)] '''Section 5. Aliases'''<br>
 
[http://dspamwiki.expass.de/Installation/Postfix/NealesSetup DSpamWiki] '''Section Reporting Mistakes'''<br>
 
[http://dspamwiki.expass.de/Installation/Postfix/NealesSetup DSpamWiki] '''Section Reporting Mistakes'''<br>
 +
  
  
Line 8: Line 8:
 
DSpam must be notified of classification mistakes. There are several methods to do this. This article will cover the "Forwarding Method".
 
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.
 
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!
+
'''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.
 
This article will focus specifically on my implementation which uses Postfix Virtual Users stored in a MySQL database.
 +
  
  
Line 25: Line 26:
 
$nexthop = a variable passed by the transport. Leave it as $nexthop<br>
 
$nexthop = a variable passed by the transport. Leave it as $nexthop<br>
 
''ValidUser'' = any dspam account that has preferences setup. For example:  [email protected]<br>
 
''ValidUser'' = any dspam account that has preferences setup. For example:  [email protected]<br>
 +
  
  
Line 30: Line 32:
 
You will need to map your transports to MySQL.
 
You will need to map your transports to MySQL.
 
  transport_maps = mysql:/etc/postfix/mysql_virtual_transport_maps.cf
 
  transport_maps = mysql:/etc/postfix/mysql_virtual_transport_maps.cf
 +
 +
''mysql_virtual_transport_maps.cf'' contains:
 +
user = root
 +
password = ****
 +
hosts = localhost
 +
dbname = mail
 +
query = SELECT transport FROM mail.transport WHERE domain='%s'
 +
 +
  
 
== Creating the Transport Table ==
 
== Creating the Transport Table ==
Line 49: Line 60:
 
   PRIMARY KEY  (`domain`)
 
   PRIMARY KEY  (`domain`)
 
  ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 
  ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 +
  
  
Line 60: Line 72:
 
In this case the ''PIPE-NAME'' = 'dspam-retrain' as outlined in the Master.cf step.<br>
 
In this case the ''PIPE-NAME'' = 'dspam-retrain' as outlined in the Master.cf step.<br>
 
and the ''$nexthop'' variable which is passed to the PIPE = 'spam' or 'innocent'<br>
 
and the ''$nexthop'' variable which is passed to the PIPE = 'spam' or 'innocent'<br>
 +
  
  

Latest revision as of 18:49, 21 August 2008

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

mysql_virtual_transport_maps.cf contains:

user = root
password = ****
hosts = localhost
dbname = mail
query = SELECT transport FROM mail.transport WHERE domain='%s'


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.