On Mon, Aug 10, 2015 at 08:50:22PM +0000, Rosenbaum, Larry M. wrote:

> >     main.cf:
> >         indexed = ${default_database_type}:${config_directory}/
> >         virtual_alias_maps = ${indexed}virtual
> >         transport_maps = ${indexed}transport
> > 
> >     virtual:
> >         u...@mail.example.com  u...@example.com
> > 
> >     transport:
> >         example.com relay:[exch.example.com]
> > 
> > You can use LDAP to do the rewriting:
> > 
> >     http://www.postfix.org/ldap_table.5.html
> > 
> >     main.cf:
> >         ldap = proxy:ldap:${config_directory}/
> >         virtual_alias_maps = ${ldap}virtual.cf
> > 
> >     virtual.cf (owner root, mode 0700):
> >         server_host = ldap.example.com
> >         search_base = dc=example,dc=com
> >         bind_dn = ... DN of some account object ...
> >         bind_pw = ... corresponding password ...
> >         query_filter = proxyAddresses = smtp:%s
> >         result_attribute = mail
> > 
> > Test all mappings with "postmap -q".
> 
> Thanks. One more thing - there will also be other mail with a @example.com
> address that does NOT go to exch.example.com - some will go to e.g.
> list.example.com, dept.example.com, etc. So it looks like the rewriting
> and the transport/relay stuff needs to happen at the same time. Is that
> possible?

Yes, but that is more complicated.  You can use per-user transport
mappings, either indexed file or LDAP equivalent:

    transport:
        u...@example.com        relay:[exch.example.com]

Or rewrite to destination-specific sub-domains:

    virtual:
        u...@mail.example.com  u...@exch.example.com

    transport:
        exch.example.com  relay:[exch.example.com]

Then, as a best-practice, add additional transport addresses to
each exchange user account:

        mail: u...@example.com
        proxyAddresses: SMTP:u...@example.com
        proxyAddresses: smtp:u...@exch.example.com

but if that's just too difficult due to extreme bureaucratitis,
you can undo the rewrite during transmission via smtp_generic_maps

        master.cf:
            relay unix ... smtp
              -o smtp_generic_maps=$relay_generic_maps

        main.cf:
            indexed = ${default_database_type}:${config_directory}/
            relay_generic_maps = ${indexed}relay-generic

        relay-generic:
                @exch.example.com       @example.com

-- 
        Viktor.

Reply via email to