Rewriting question

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Rewriting question

Adrian P. van Bloois-3
Hi All,
I'd like to catch ALL mail addressed to [hidden email] and
rewrite that to something@certaindomain.
The point is .bla, I don't know what's in front of this. rH
how can I best do that?

        Regards
                Adrian


--
        Adri P. van Bloois
        Antonlaan 104 email: [hidden email]
        3701 VG Zeist voice: +31-(0)-30-6912741
        The Netherlands fax: NONE

52 05'15.77"N 5 4'44.56"E
QTH-locater JO 22 OC

The whole point of cooking is to get as much flavour out of the
ingredients as possible.
        -- Delia Smith


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Reply | Threaded
Open this post in threaded view
|

Re: Rewriting question

Stan Hoeppner
On 11/15/2011 3:44 AM, Adrian P. van Bloois wrote:
> Hi All,
> I'd like to catch ALL mail addressed to [hidden email] and
> rewrite that to something@certaindomain.
> The point is .bla, I don't know what's in front of this. rH
> how can I best do that?

The first step is to coherently explain to us exactly what you are
trying to accomplish.

--
Stan
Reply | Threaded
Open this post in threaded view
|

Re: Rewriting question

Claudio Kuenzler-2
Hi Adrian

You can try to do this with smtp_generic_maps or if you only want to rewrite the recipient address you can also use recipient_canonical_maps. There's a lot of possibilities how to do that, depends on what you want to achieve in detail.

http://www.postfix.org/postconf.5.html#smtp_generic_maps
http://www.postfix.org/postconf.5.html#recipient_canonical_maps

On Tue, Nov 15, 2011 at 12:34 PM, Stan Hoeppner <[hidden email]> wrote:
On 11/15/2011 3:44 AM, Adrian P. van Bloois wrote:
> Hi All,
> I'd like to catch ALL mail addressed to [hidden email] and
> rewrite that to something@certaindomain.
> The point is .bla, I don't know what's in front of this. rH
> how can I best do that?

The first step is to coherently explain to us exactly what you are
trying to accomplish.

--
Stan

Reply | Threaded
Open this post in threaded view
|

Re: Rewriting question

Noel Jones-2
In reply to this post by Adrian P. van Bloois-3
On 11/15/2011 3:44 AM, Adrian P. van Bloois wrote:

> Hi All,
> I'd like to catch ALL mail addressed to [hidden email] and
> rewrite that to something@certaindomain.
> The point is .bla, I don't know what's in front of this. rH
> how can I best do that?
>
> Regards
> Adrian
>
>


The general answer is to use a regexp or pcre table.  For a more
specific answer, we would need to know *exactly* what you're trying
to rewrite and why it needs rewriting.

http://www.postfix.org/ADDRESS_REWRITING_README.html
http://www.postfix.org/regexp_table.5.html
http://www.postfix.org/pcre_table.5.html



  -- Noel Jones
Reply | Threaded
Open this post in threaded view
|

Re: Rewriting question

Dilip Harishchandra
Sorry for jumping in guys but I seem to face a similar problem where there are domains which gets changed. For eg: some may move from abc.net to abc.org etc. 

What I need is to replace such domains on my MTA's. How should I perfectly achieve it? Also, how long could be the file?

On Tue, Nov 15, 2011 at 7:29 PM, Noel Jones <[hidden email]> wrote:
On 11/15/2011 3:44 AM, Adrian P. van Bloois wrote:
> Hi All,
> I'd like to catch ALL mail addressed to [hidden email] and
> rewrite that to something@certaindomain.
> The point is .bla, I don't know what's in front of this. rH
> how can I best do that?
>
>       Regards
>               Adrian
>
>


The general answer is to use a regexp or pcre table.  For a more
specific answer, we would need to know *exactly* what you're trying
to rewrite and why it needs rewriting.

http://www.postfix.org/ADDRESS_REWRITING_README.html
http://www.postfix.org/regexp_table.5.html
http://www.postfix.org/pcre_table.5.html



 -- Noel Jones



--
Incase of any further queries, Please feel free to mail me or contact me on the numbers provided below.

Thanks & Regards,
Dilip H.Mishra
Server Administrator

Viva Infomedia Pvt. Ltd.
242, Oshiwara Industrial Centre,
Opp. Oshiwara Bus Depot, New Link Road,
Goregaon West, Mumbai 400104.

Direct: +91.22.4293 0162
Board: +91.22.4293 0100


Viva Infomedia: Awarded as Best SME (E-Commerce) at CNBC Emerging India Awards 2009

Disclaimer:
This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies and the original message. Any unauthorized review, use, disclosure,dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly prohibited and may be unlawful. The recipient acknowledges that Viva Infomedia Pvt.Ltd. or its subsidiaries and associated companies are unable to exercise control or ensure or guarantee the integrity of/over the contents of the information contained in e-mail transmissions and further acknowledges that any views expressed in this message are those of the individual sender and no binding nature of the message shall be implied or assumed unless the sender does so expressly with due authority of Viva Infomedia Pvt.Ltd. Before opening any attachments please check them for viruses and defects.


Reply | Threaded
Open this post in threaded view
|

Re: Rewriting question

Claudio Kuenzler-2
Take a look at this: http://www.postfix.org/ADDRESS_REWRITING_README.html
There are a lot of examples and you'll find what you're looking for.

If you want to change the domain for incoming and outgoing e-mails you can do this with canonical_maps. If you only want to apply the rules for incoming mails, use recipient_canonical_maps or for outgoing mails sender_canonical_maps.
The table/file you define after the parameter can contain the complete domain name (as wildcard) or full e-mail address which you want to rewrite:

canonical_map:
@abc.net             @abc.org                   <- for all e-mail addresses of abc.net
[hidden email]      [hidden email]          <- only single e-mail address


On Fri, Nov 18, 2011 at 7:35 AM, Dilip Mishra // Viva <[hidden email]> wrote:
Sorry for jumping in guys but I seem to face a similar problem where there are domains which gets changed. For eg: some may move from abc.net to abc.org etc. 

What I need is to replace such domains on my MTA's. How should I perfectly achieve it? Also, how long could be the file?


On Tue, Nov 15, 2011 at 7:29 PM, Noel Jones <[hidden email]> wrote:
On 11/15/2011 3:44 AM, Adrian P. van Bloois wrote:
> Hi All,
> I'd like to catch ALL mail addressed to [hidden email] and
> rewrite that to something@certaindomain.
> The point is .bla, I don't know what's in front of this. rH
> how can I best do that?
>
>       Regards
>               Adrian
>
>


The general answer is to use a regexp or pcre table.  For a more
specific answer, we would need to know *exactly* what you're trying
to rewrite and why it needs rewriting.

http://www.postfix.org/ADDRESS_REWRITING_README.html
http://www.postfix.org/regexp_table.5.html
http://www.postfix.org/pcre_table.5.html



 -- Noel Jones



--
Incase of any further queries, Please feel free to mail me or contact me on the numbers provided below.

Thanks & Regards,
Dilip H.Mishra
Server Administrator

Viva Infomedia Pvt. Ltd.
242, Oshiwara Industrial Centre,
Opp. Oshiwara Bus Depot, New Link Road,
Goregaon West, Mumbai 400104.

Direct: <a href="tel:%2B91.22.4293%200162" value="+912242930162" target="_blank">+91.22.4293 0162
Board: +91.22.4293 0100


Viva Infomedia: Awarded as Best SME (E-Commerce) at CNBC Emerging India Awards 2009

Disclaimer:
This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies and the original message. Any unauthorized review, use, disclosure,dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly prohibited and may be unlawful. The recipient acknowledges that Viva Infomedia Pvt.Ltd. or its subsidiaries and associated companies are unable to exercise control or ensure or guarantee the integrity of/over the contents of the information contained in e-mail transmissions and further acknowledges that any views expressed in this message are those of the individual sender and no binding nature of the message shall be implied or assumed unless the sender does so expressly with due authority of Viva Infomedia Pvt.Ltd. Before opening any attachments please check them for viruses and defects.



Reply | Threaded
Open this post in threaded view
|

Re: Rewriting question

Viktor Dukhovni
On Fri, Nov 18, 2011 at 07:56:07AM +0100, Claudio Kuenzler wrote:

> Take a look at this: http://www.postfix.org/ADDRESS_REWRITING_README.html
> There are a lot of examples and you'll find what you're looking for.

Yes, the document is a good place to start.

> If you want to change the domain for incoming and outgoing e-mails you can
> do this with canonical_maps.

No, this advice is probably not wise.

> The table/file you define after the parameter can contain the complete
> domain name (as wildcard) or full e-mail address which you want to rewrite:
>
> canonical_map:
> @abc.net             @abc.org                   <- for all e-mail addresses
> of abc.net
> [hidden email]      [hidden email]          <- only single e-mail address

Wildcard canonical mappings break recipient validation and are strongly
discouraged.

> If you only want to apply the rules for
> incoming mails, use recipient_canonical_maps or for outgoing mails
> sender_canonical_maps.

This is really quite wrong, as sender_canonical_maps applies to the
"From:" and envelope sender addresses regardless of whether the message
is incoming or outgoing.

Likewise "recipient_canonical_maps" applies to the "To:/Cc:" and
envelope recipient addresses regardless of whether the message is
incoming or outgoing.

Finally, it is almost always wrong to apply different rewriting
rules to "From:" vs. "To:/Cc:" headers. Rather there is a normal
form for headers one to present to the outside world, and sometimes
a different form for internal consumption.

Therefore, rewriting of all headers should as necessary depend on
the destination, and so must happen in the delivery agent, via
"smtp_generic_maps". One can use different smtp delivery agent
instances for inbound vs. outbound delivery.

Wildcard rewrites in smtp_generic_maps happen long after recipient
validation, and pose no issues.

--
        Viktor.
Reply | Threaded
Open this post in threaded view
|

Re: Rewriting question

Claudio Kuenzler-2
Victor, take a look at my e-mail sent 3 days ago in the same thread. I already mentioned the smtp_generic_maps there (order before canonical).

Now it depends on what Dilip wants to achieve, we didn't get enough details.
smtp_generic_maps won't work, if you still need to receive e-mails for the old domain (here abc.net) and forward them to a remote host where the mailboxes are stored.
If the mailboxes are stored on the postfix server then this should be smtp_generic_maps, I agree.

On Fri, Nov 18, 2011 at 8:06 AM, Viktor Dukhovni <[hidden email]> wrote:
On Fri, Nov 18, 2011 at 07:56:07AM +0100, Claudio Kuenzler wrote:

> Take a look at this: http://www.postfix.org/ADDRESS_REWRITING_README.html
> There are a lot of examples and you'll find what you're looking for.

Yes, the document is a good place to start.

> If you want to change the domain for incoming and outgoing e-mails you can
> do this with canonical_maps.

No, this advice is probably not wise.

> The table/file you define after the parameter can contain the complete
> domain name (as wildcard) or full e-mail address which you want to rewrite:
>
> canonical_map:
> @abc.net             @abc.org                   <- for all e-mail addresses
> of abc.net
> [hidden email]      [hidden email]          <- only single e-mail address

Wildcard canonical mappings break recipient validation and are strongly
discouraged.

> If you only want to apply the rules for
> incoming mails, use recipient_canonical_maps or for outgoing mails
> sender_canonical_maps.

This is really quite wrong, as sender_canonical_maps applies to the
"From:" and envelope sender addresses regardless of whether the message
is incoming or outgoing.

Likewise "recipient_canonical_maps" applies to the "To:/Cc:" and
envelope recipient addresses regardless of whether the message is
incoming or outgoing.

Finally, it is almost always wrong to apply different rewriting
rules to "From:" vs. "To:/Cc:" headers. Rather there is a normal
form for headers one to present to the outside world, and sometimes
a different form for internal consumption.

Therefore, rewriting of all headers should as necessary depend on
the destination, and so must happen in the delivery agent, via
"smtp_generic_maps". One can use different smtp delivery agent
instances for inbound vs. outbound delivery.

Wildcard rewrites in smtp_generic_maps happen long after recipient
validation, and pose no issues.

--
       Viktor.

Reply | Threaded
Open this post in threaded view
|

Re: Rewriting question

Viktor Dukhovni
On Fri, Nov 18, 2011 at 08:30:37AM +0100, Claudio Kuenzler wrote:

> Victor, take a look at my e-mail sent 3 days ago in the same thread. I
> already mentioned the smtp_generic_maps there (order before canonical).

Regardless of past thread history, advice to use wildcard canonical
mappings on internet-facing Postfix servers is still bad.

Likewise, one should avoid sender_canonical_maps and
recipient_canonical_maps. If it were not an incompatible change,
I'd suggest we should remove these parameters from Postfix.

--
        Viktor.
Reply | Threaded
Open this post in threaded view
|

Re: Rewriting question

Claudio Kuenzler-2
I'd be strongly against the removal of these parameters. In an installation I once had to make I was absolutely dependent on the sender_canonical_maps due to a one-way rewrite:

Quote from documentation:
Example: you want to rewrite the SENDER address "[hidden email]" to "[hidden email]", while still being able to send mail to the RECIPIENT address "[hidden email]".

smtp_generic_maps didn't work in that particular case because this setting rewrites the e-mail address for ANY remote host, in my example this was the local Exchange server. So the rewritten addresses were logically not accepted by the Exchange server.
For special cases like this the sender_canonical_maps is the perfect solution.


On Fri, Nov 18, 2011 at 6:01 PM, Viktor Dukhovni <[hidden email]> wrote:
On Fri, Nov 18, 2011 at 08:30:37AM +0100, Claudio Kuenzler wrote:

> Victor, take a look at my e-mail sent 3 days ago in the same thread. I
> already mentioned the smtp_generic_maps there (order before canonical).

Regardless of past thread history, advice to use wildcard canonical
mappings on internet-facing Postfix servers is still bad.

Likewise, one should avoid sender_canonical_maps and
recipient_canonical_maps. If it were not an incompatible change,
I'd suggest we should remove these parameters from Postfix.

--
       Viktor.