[lug] Header problems on Postfix pipes with optional spam filtering
Ben Luey
bluey at iguanaworks.net
Mon Jun 14 20:42:31 MDT 2010
I think I have a simple question. Is there a simple way to setup a
dummy / echo transport in postfix? I want to just add the
"X-Original-To" header to email BEFORE it goes for delivery. Here's why
(the problem): Mail comes into postfix, it expands the aliases and
delivers the emails one at a time to dspam via a transport pipe. Then
dspam hands it back and postfix sends it to deliver (dovecot's delivery
agent). I've got the dspam pipe setup to add the "X-Original-To" and the
deliver pipe set not to add the "X-Original-To" since by the time it
gets the mail the address is already expanded:
dspam unix - n n - 10 pipe
flags=RO user=dspam argv=/usr/bin/dspam --deliver=innocent,spam --user
$user -i -f $sender -- $recipient
dovecot unix - n n - - pipe
flags=DRh user=vmail:vmail argv=/usr/lib/dovecot/deliver -s -f
${sender} -d ${user}@${nexthop} -m ${extension}
This all works perfectly. But I want to skip the dspam part for local
mails and mails from authenticated users. I can do this with a
smtpd_client_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
check_sender_access pcre:/etc/postfix/dspam_filter,
(deliver is called via: virtual_transport = dovecot )
but when I do that, emails don't get the proper "X-original-to" because
the dovecot pipe doesn't add that header. If I have dovecot pipe add
that header, then for emails that go through dspam, they get two of
those headers, one right, one potential already expanded.
Maybe there is a better solution, but I'm thinking of having all emails
go through a simple echo pipe with the flags=O option to add that header
and then neither dspam for dovecot will have to do more header stuff.
Any idea on how to do this? Or maybe there is a better way? Ideas?
Thanks,
Ben
More information about the LUG
mailing list