On Wed, Mar 13, 2013 at 12:58:16PM -0400, Wietse Venema wrote:

> > Analogous to Noel's suggestion, one possibility is that you list
> > bare usernames (without @example.com etc.) in relay_recipient_maps.
> > It's not documented, but I could add that note since the behavior is
> > not going to change.
> 
> This requires that the @domain matches mydestination, so that is
> unlikely to work.

One can list all the relay domains in mydestination, configure
local_recipient_maps (instead of relay_recipient_maps) as specified,
and then either:

        main.cf:
                remap = pcre:${config_directory}/
                indexed = ${default_database_type}:${config_directory}/

                local_transport = relay:[relay.example.com]
                local_recipient_maps = ${indexed}usernames
                transport_maps = ${indexed}transport
                mydestination = ${remap}localdomains.re

        localdomains.re:
                /(^|\.)example\.com$/   LOCAL

        usernames:
                larry   LOCAL
                curly   LOCAL
                moe     LOCAL

        transport:
                # Optional exceptions to inbound relaying of local mail.
                # localhost             local
                # hostname.example.com  local
                # ...

Since the OP has a completely flat namespace, there is unlikely to
be any difference between the parent example.com domain and its
"relay" children.

This recipe is not "rigid", there is some room for additional tweaks
if the requirements are more complex. 

For my $0.02, I abandoned inbound masquerading a long time ago,
who needs every email address of the form:

        u...@your-mother-has-big-email-addresses.example.com

I masquerade sender addresses at the internal MSA so only the
primary addresses of users leak out to the outside world, and *only*
accept primary addresses.  Inbound masquerading is a legacy of
times long gone by.  The fact that Postfix supports for this is a
bit clunky is more of a signal about the feature than about Postfix.

[ Admittedly, it would probably be helpful to have some 1-to-1 rewriting
  support in smtpd(8) that happens before address validation.  That
  would make the wildcard canonical maps folks happy, and inadvertantly
  "fix" masquerading. ]

-- 
        Viktor.

Reply via email to