> On Apr 23, 2017, at 7:12 AM, Dennis Weber <[email protected]> wrote:
>  
> I am currently working on a project for a rewriting gateway with postfix, 
> which shall mask two independent internal domains behind a third external DNS 
> name. In general it should accept mails from @internal1.com and 
> @internal2.com as a Smarthost, rewrite the addresses with a new @newcorp.com 
> domain and send it to the public network. Besides the outgoing rewrite it 
> also needs to rewrite incoming mail to both internal domains and transport 
> them to the right Exchange organizations.

See http://www.postfix.org/SOHO_README.html#fantasy

> I managed to rewrite the outgoing messages with the “generic_maps” and a 
> simple filetable

Good, that's the right thing to do outbound, but you should configure the
"smtp_generic_maps" parameter separately for inbound and inbound mail:

        main.cf:
                indexed = ${default_database_type}:${config_directory}/
                relay_generic_maps =
                smtp_generic_maps = ${indexed}generic
                transport_maps = ${indexed}transport
                virtual_alias_maps = ${indexed}virtual
                virtual_alias_domains = example.com

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

        transport:
                # Inbound mail uses the "relay" transport which
                # avoids the outbound "generic" rewrite.
                # Add optional nexthop gateways as appropriate
                internal1.example       relay
                internal2.example       relay

        virtual:
                # Map external *envelope recipient* addrs to internal
                [email protected]       [email protected]
                [email protected]       [email protected]
                ...

        generic:
                # Map internal addrs to external in envelope and headers
                [email protected] [email protected]
                [email protected] [email protected]       
        
>       • Messages rewritten with “header_checks” cannot be delivered too, 
> because of the same reason mentioned above

NEVER EVER ATTEMPT OR EVEN THINK ABOUT using header checks for address
rewriting.

-- 
        Viktor.

Reply via email to