So I think I've found some sample regular expression code that *might* work in getting dspam running with postfix without PCRE... Granted I'm not sure what's happening, but I think this will break out spam-person@whoever.com, ham-person@whoever.com, and person@whoever.com ... and send them off to different parts of postfix to do handle training for dspam....
where did you put the FILTER stuff in in main.cf. If you put it in the same section as the documented filter stuff than it won't work as that filter is only hit by mail coming from the outside world and not for authenticated users !
You should put the retrain stuff in transport maps !
Oh ... I think I see what you're saying. my users won't be able to use those transports at all will they ..... can you show me how to setup the retraining as tranport maps instead?
The thing is that you are mixing up two seperate functions into one.
The listing of the PCRE filter
/./ FILTER dspam:dspam
in the option "smtpd_recipient_restrictions". Is only there to filter incoming mail only. If you leave out this option all outgoing mail will be filtered as well which is not something you would want.
The retraining transports are there for another reason, you want to feed dspam with incorrect identified emails and you don't want it delivered to a users mailbox. Therefore you define a separate transport.
In main.cf you add the following lines to do that
recipient_delimiter = -
(to separate the username from the -spam in the mail address)
#
/^spam-(.*)/ FILTER dspam-add:${1}
/^ham-(.*)/ FILTER dspam-del:${1}
/(.*)/ FILTER dspam:${1}
I'm not sure if the last one is necessary...
And then here's what goes in master.cf:
dspam-add unix - n n - - pipe
flags=Rhq user=dspam argv=/usr/bin/dspam --user ${user}@${nexthop} --class=spam --source=error
dspam-del unix - n n - - pipe
flags=Rhq user=dspam argv=/usr/bin/dspam --user ${user}@${nexthop} --class=innocent --source=error
Now I'm not sure if this regexp needs to go in transport_maps, or access, or what...
Anyone do anything like this yet?
#
You should put the retrain stuff in transport maps !
#
in main.cf I added:
check_client_access regexp:/etc/postfix/dspam_regexp
instead of the "pcre:" business...
at the bottom I put:
dspam_destination_recipient_limit =1
dspam-add_destination_recipient_limit = 1
dspam-del_destination_recipient_limit = 1
and then this went in my dspam_regexp file:
/^spam-(.*)/ FILTER dspam-add:${1}
/^ham-(.*)/ FILTER dspam-del:${1}
/^(.*)/ FILTER dspam:${1}
This way it's more like yours, but I don't have to worry about a retraining script, since I can just use these other transport methods for training.
The other part of my problem is that since I'm doing my own parsing of the user names, I had to turn off the parsing in the dspam.conf file.
g
#
g
#
The listing of the PCRE filter
in the option "smtpd_recipient_restrictions". Is only there to filter incoming mail only. If you leave out this option all outgoing mail will be filtered as well which is not something you would want././ FILTER dspam:dspamThe retraining transports are there for another reason, you want to feed dspam with incorrect identified emails and you don't want it delivered to a users mailbox. Therefore you define a separate transport.
In main.cf you add the following lines to do that
(to separate the username from the -spam in the mail address)recipient_delimiter = -and
transport_maps = hash:/etc/postfix/transportlocal_recipient_maps = proxy:unix:passwd.byname $alias_maps $transport_maps
to define the transports:
and then you ceate a file called transport and add:
spam@mydomain.tld dspam-retrain:spamham@mydomain.tld dspam-retrain:innocent
notspam@mydomain.tld dspam-retrain:innocent
do a
to convert it.sudo postmap transportand add
dspam-retrain unix - n n - 10 pipeflags=Ru user=dspam argv=/usr/local/bin/dspam-retrain $nexthop $sender $recipient
as a transport in our master.cf for retraining purposes !
The retraining shell script you can download from here.
Hope this helps !