On Wed, Jan 29, 2014 at 10:06:26PM +0000, Viktor Dukhovni wrote:

> On Wed, Jan 29, 2014 at 10:47:07PM +0100, Klavs Klavsen wrote:
> 
> > I currently employ generic rewriting of sourceaddresses, like this:
> > smtp_generic_maps = hash:/etc/postfix/generic
> > regexp:/etc/postfix/generic_regexp
> 
> As described in http://www.postfix.org/ADDRESS_REWRITING_README.html
> and in http://www.postfix.org/postconf.5.html#smtp_generic_maps,
> generic(5) rewring is done post-queue in the smtp(8) delivery agent
> during message delivery.
> 
> While milter processing happens pre-queue as the message is received.
> 
> You can either move the rewriting upstream by using virtual(5)
> instead (which happens before milters process the message content),
> or you can postpone milter processing by implementing a two stage
> delivery pipeline with outbound messages forwarded to a DKIM-signing
> MTA instance after generic rewriting.

Sorry, I neglected to notice that you want header rewriting with
smtp_generic_maps, but virtual(5) rewrites only the envelope
recipient.  So you'd need canonical(5) rewriting instead, possibly
followed by virtual(5) to unrewrite the envelope recipient if need
be.  Avoid wildcard rewrites, these would cause backscatter.

    main.cf:
        canonical_maps = ...
        virtual_alias_maps = ...

    canonical:
        larry@internal.local    la...@example.com
        moe@internal.local      m...@example.com
        ...

    virtual:
        la...@example.com       larry@internal.local
        m...@example.com                moe@internal.local

-- 
        Viktor.

Reply via email to