Postfix/Exim sender address rewriting (was: Postfix ... ComCast port 587)

Bill McGonigle bill at bfccomputing.com
Thu Jan 22 13:05:40 EST 2009


On 2009-01-21 1:06 PM, Ben Scott wrote:
>    So, what I want to do is tell my MTA to rewrite<bscott>  and some
> variants to<dragonhawk at gmail.com>.  My MTA can keep on using
> <blackfire.local.bscott>  for its hostname, but I want it to modify the
> reverse-path.
>

OK, at work now, so I can check my server... here's what I've got (as an 
example):

virtual_alias_maps = ... regexp:/etc/postfix/virtual-regexp
recipient_delimiter = +

and in /etc/postfix/virtual-regexp:
...
/(.*)\-(.*)@bfccomputing.com/           ${1}+${2}@bfccomputing.com

This example rewrites (using 'example' in place of 'bfccomputing' for 
spam harvesting reasons) bill-gnhlug at example.com to 
bill+gnhlug at example.com.  The recipient_delimiter allows 
bill+gnhlug at example.com to be delivered to bill at example.com, though 
that's extraneous to the original example.  Most web forms fail to 
properly encode their input, and they assume + means %20 due to 
historical insanity.

So, given a working knowledge of PCRE, the above should work fine in 
most scenarios.  I think it works in both directions, as I've got:

#/(.*)\-(.*)@(.*)/                      ${1}+${2}@${3}

commented out due to hosing outbound mail.

Remember to postmap(1) your regex file.

-Bill

P.S. Has anybody thought of setting up spam traps with bait addresses 
that would evaluate to destructive system calls?

-- 
Bill McGonigle, Owner           Work: 603.448.4440
BFC Computing, LLC              Home: 603.448.1668
bill at bfccomputing.com           Cell: 603.252.2606
http://www.bfccomputing.com/    Page: 603.442.1833
Blog: http://blog.bfccomputing.com/
VCard: http://bfccomputing.com/vcard/bill.vcf


More information about the gnhlug-discuss mailing list