On Mon, Sep 01, 2014 at 02:57:51PM +1000, Valdemar Jakobsen wrote:

> The problem I am having is that any mail that is submitted locally
> on the gateway mail servers (Ubuntu, /usr/bin/mail - tested all 3
> packages providing /usr/bin/mail) behaves as if sender_canonical_classes
> is not configured --- i.e. default configuration behaviour of
> "sender_canonical_classes = envelope_sender, header_sender" --- as
> both the envelope and header addresses are being rewritten.  I have
> also tested with canonical_maps and canonical_classes configured
> appropriately the same behaviour is observed.

When original submission does not explicitly set a "From:" header,
the header is automaticaly added by Postfix, the automatic value
is unsurprisingly equal to the envelope sender (after various
rewrites).  You need to include a explicit "From:" header in the
message passed to sendmail(1).

> # /etc/postfix/main.cf (excerpt)
> canonical_classes = envelope_sender
> sender_canonical_classes = envelope_sender
> sender_canonical_maps = regexp:/etc/postfix/sender_canonical.regexp
> 
> The regexp canonical map rules:
> 
> # /etc/postfix/sender_canonical.regexp (excerpt)
> # rewrite all addresses to any variant of (*.|)mydomain.com(|.*) to 
> realuser+user%[email protected]
> /^(.*)@(.+\.mydomain\.com(\.[^\.]*)?)$/          
> realuser+${1}%${2}@mydomain.com

Boldly claiming your domain in all current and future TLDs.  That
may be reasonable, however,  user%[email protected] is not
a good SPF rewriting strategy.  You need a proper SPF/SRS rewrite
content filter or milter.

Such a source-routed address will be rejected by your system as an
unauthorized relay attempt if bounced back to you by any systems
that don't support the '% hack'.

-- 
        Viktor.

Reply via email to