Outbound address rewriting

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Outbound address rewriting

Kevin Miller
Some years back a local ISP/cable company hosted the alaska.com domain.  They had just leased the domain, and a couple years ago the owners didn't renew the lease.  GCI registered a new domain, alaskan.com (note the "n" in alaskan).  When my users send to [hidden email], it bounces as there is no MX host to receive mail for that domain.  I'd like my outbound smtp server to to rewrite the to address so that [hidden email] becomes [hidden email].  What's the cleanest way to do so?  I've been reading through the postfix address rewriting pages but with so many options I'm a bit overwhelmed.  I'm leaning towards the generic table - would that be an appropriate route?

Thanks...

...Kevin
--
Kevin Miller
Network/email Administrator, CBJ MIS Dept.
155 South Seward Street
Juneau, Alaska 99801
Phone: (907) 586-0242, Fax: (907) 586-4588 Registered Linux User No: 307357

Reply | Threaded
Open this post in threaded view
|

Re: Outbound address rewriting

Wietse Venema
Kevin Miller:

> Some years back a local ISP/cable company hosted the alaska.com
> domain.  They had just leased the domain, and a couple years ago
> the owners didn't renew the lease.  GCI registered a new domain,
> alaskan.com (note the "n" in alaskan).  When my users send to
> [hidden email], it bounces as there is no MX host to receive
> mail for that domain.  I'd like my outbound smtp server to to
> rewrite the to address so that [hidden email] becomes [hidden email].
> What's the cleanest way to do so?  I've been reading through the
> postfix address rewriting pages but with so many options I'm a bit
> overwhelmed.  I'm leaning towards the generic table - would that
> be an appropriate route?

Use canonical_maps to rewrite all instances of the address
(header, envelope, sender, recipient).

Use virtual_alias_maps (not virtual_aias_domains) to rewrite
the envelope recipient only.

In both maps,

    @alaska.com @alaskan.com

would do the domain translation.

Caution: with this, Postfix will accept email for any [hidden email]
including addresses that are later found to be undeliverable. If
someone starts to send lots of mail to random addresses at alaska.com,
then your mail queue will fill up with bounce messages.

        Wietse
Reply | Threaded
Open this post in threaded view
|

Re: Outbound address rewriting

Viktor Dukhovni


> On Apr 19, 2018, at 4:24 PM, Wietse Venema <[hidden email]> wrote:
>
> In both maps,
>
>    @alaska.com @alaskan.com
>
> would do the domain translation.
>
> Caution: with this, Postfix will accept email for any [hidden email]
> including addresses that are later found to be undeliverable. If
> someone starts to send lots of mail to random addresses at alaska.com,
> then your mail queue will fill up with bounce messages.

I think in this case both domains are remote, in which case the
bounce issue may be moot.  Only users authorized to send outbound
mail can create email for the destination in question, and the
goal is to "correct" the destination domain.

--
        Viktor.

Reply | Threaded
Open this post in threaded view
|

RE: Outbound address rewriting

Kevin Miller
-----Original Message-----
> I think in this case both domains are remote, in which case the
> bounce issue may be moot.  Only users authorized to send outbound
> mail can create email for the destination in question, and the
> goal is to "correct" the destination domain.

Right.  As it stands now, the mail will sit in the outbound queue for days until it finally times out as undeliverable.  My thought is that with the rewriting, the mail will be either immediately delivered, or the sender get a 550 rejection in a timely manner.

Thank you gentlemen...

--
Kevin Miller
Network/email Administrator, CBJ MIS Dept.
155 South Seward Street
Juneau, Alaska 99801
Phone: (907) 586-0242, Fax: (907) 586-4588 Registered Linux User No: 307357

Reply | Threaded
Open this post in threaded view
|

RE: Outbound address rewriting

Kevin Miller
In reply to this post by Wietse Venema
> Use canonical_maps to rewrite all instances of the address
> (header, envelope, sender, recipient).

> Use virtual_alias_maps (not virtual_aias_domains) to rewrite
> the envelope recipient only.

Quick question:  In the docs I don't see a reference to a line in main.cf.  Will postfix pick up on the existence of the table automatically once I hash it, or do I need to add something along the lines of:
  virtual_alias_maps = hash:/etc/virtual
in main.cf?

Thanks again...

...Kevin
--
Kevin Miller
Network/email Administrator, CBJ MIS Dept.
155 South Seward Street
Juneau, Alaska 99801
Phone: (907) 586-0242, Fax: (907) 586-4588 Registered Linux User No: 307357
Reply | Threaded
Open this post in threaded view
|

Re: Outbound address rewriting

Tom Hendrikx
In reply to this post by Kevin Miller
On 19-04-18 23:26, Kevin Miller wrote:
> -----Original Message-----
>> I think in this case both domains are remote, in which case the
>> bounce issue may be moot.  Only users authorized to send outbound
>> mail can create email for the destination in question, and the
>> goal is to "correct" the destination domain.
>
> Right.  As it stands now, the mail will sit in the outbound queue for days until it finally times out as undeliverable.  My thought is that with the rewriting, the mail will be either immediately delivered, or the sender get a 550 rejection in a timely manner.
>

You could also simply reject inbound messages to the non-existent domain
with a somewhat helpful reject message, explaining that the sender
should use the new domain. That way users will learn very quickly to
update their address book.

Kind regards,
        Tom


signature.asc (817 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Outbound address rewriting

/dev/rob0
In reply to this post by Kevin Miller
On Thu, Apr 19, 2018 at 09:47:27PM +0000, Kevin Miller wrote:
> Quick question: In the docs I don't see a reference to a line in
> main.cf.  Will postfix pick up on the existence of the table
> automatically once I hash it, or do I need to add something along
> the lines of:
>   virtual_alias_maps = hash:/etc/virtual
> in main.cf?

For backward compatibility, the default value for virtual_alias_maps
is "$virtual_maps".  If that's not set (and in 2018 it certainly
should NOT be set) the default is empty.  You seem to have missed
postconf.5.html#virtual_alias_maps somehow.

You do indeed need to set something for virtual_alias_maps if you
intend to use the feature.

You might also be interested in the command line postconf(1) tool:
"postconf virtual_alias_maps" will show what you have set for
virtual_alias_maps.
--
  http://rob0.nodns4.us/
  Offlist GMX mail is seen only if "/dev/rob0" is in the Subject:
Reply | Threaded
Open this post in threaded view
|

RE: Outbound address rewriting

Kevin Miller
Thanks for the feedback.  It's working as advertised although in the end I used the canonical map.

...Kevin
--
Kevin Miller
Network/email Administrator, CBJ MIS Dept.
155 South Seward Street
Juneau, Alaska 99801
Phone: (907) 586-0242, Fax: (907) 586-4588 Registered Linux User No: 307357


-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of /dev/rob0
Sent: Thursday, April 19, 2018 3:10 PM
To: [hidden email]
Subject: Re: Outbound address rewriting

On Thu, Apr 19, 2018 at 09:47:27PM +0000, Kevin Miller wrote:
> Quick question: In the docs I don't see a reference to a line in
> main.cf.  Will postfix pick up on the existence of the table
> automatically once I hash it, or do I need to add something along
> the lines of:
>   virtual_alias_maps = hash:/etc/virtual
> in main.cf?

For backward compatibility, the default value for virtual_alias_maps
is "$virtual_maps".  If that's not set (and in 2018 it certainly
should NOT be set) the default is empty.  You seem to have missed
postconf.5.html#virtual_alias_maps somehow.

You do indeed need to set something for virtual_alias_maps if you
intend to use the feature.

You might also be interested in the command line postconf(1) tool:
"postconf virtual_alias_maps" will show what you have set for
virtual_alias_maps.
--
  http://rob0.nodns4.us/
  Offlist GMX mail is seen only if "/dev/rob0" is in the Subject: