|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: mouss (mouss
netoyen.net)
Date: Wed Mar 26 2008 - 13:19:06 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Sandy Drobic wrote:
> Mark Goodge wrote:
>> Hi,
>>
>> I'm relatively new to Postfix (I'm more familiar with Exim and (spit)
>> Sendmail), so it's possible that the answers to both of these
>> questions are staring me in the face if only I'd read the
>> documentation correctly (or possibly the answers are "it can't be
>> done with Postfix"), but either way I'd appreciate the necessary
>> pointers :-)
>>
>>
>> Anyway, my questions are:
>>
>> 1. How can I configure Postfix to forward, rewrite or redirect
>> (whatever the correct terminology is) mail so that only the domain
>> part changes. That is, I want to configure it so that
>> $local_part
example.com is rewritten to $local_part
example.co.uk and
>> then handed off to whatever mail server is responsible for
>> example.co.uk (assuming that my server is primary MX for example.com,
>> but some other mail server is primary MX for example.co.uk). For
>> those familiar with Exim, what I'm looking for is the Postfix
>> equivalent of this configuration:
>>
>> redirect_example:
>> driver = redirect
>> domains = example.com
>> data = ${quote:$local_part}
example.co.uk
>> no_more
>>
>> Does that make sense? If that's possible with Postfix, what should I
>> be looking for to configure it?
>
> As usual, there are several ways to do this:
>
> - you can use the action REDIRECT in a check:
>
> /etc/postfix/main.cf:
> smtpd_recipient_restrictions =
> permit_mynetworks,
> reject_unauth_destination,
> reject_unlisted_recipient
> check_recipient_access pcre:/etc/postfix/recipient_redirect
>
> /etc/postfix/recipient_redirect:
> /(.+)
example\.com$/ redirect $1
example.co.uk
>
This is wrong. redirect will apply to the message as a whole. in the
case of multiple recipients, only the last one will receive the message.
http://www.postfix.org/access.5.html
> - as an alternative you could also use smtp_generic_maps. It is
> applied by the smtp client, so you can use wildcard address rewrite
> without destroying recipient validation.
>
> /etc/postfix/main.cf:
> smtp_generic_maps = pcre:/etc/postfix/generic.pcre
>
> /etc/postfix/generic.pcre:
> (.+)
example\.com$/ $1
example.co.uk
>
generic rewrite doesn't change the transport.
virtual_alias_maps is the way to go. note however that wildcard aliases
break recipient validation, so it is recommended to build a map
containing each user (use a script or use sql/ldap). if address
validation is implemented via other means, wildcard aliases are ok.
> [snip]
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]