Postfix/Exim sender address rewriting (was: Postfix ... ComCast port 587)

Ben Scott dragonhawk at gmail.com
Wed Jan 21 13:06:38 EST 2009


  At least one person is confused here (me); possibly everybody.  :-)

  The scenario here (for me, and I believe the OP) is rewriting email
addresses, not masquerading as a different host.

  Two have people suggested a config directive for Postfix:

	myhostname = foo.example.com

  Now, I don't know Postfix, but I'm guessing that sets the hostname.
:)  Since confusion over hostname and reverse-path was seen earlier,
and is being seen here, I am going to spell things out step-by-step,
in the hope of establishing mutual understanding.  :)

  The sender's email address is given in the MAIL FROM verb when
handing off mail to another MTA or MSA. This is also called the
"reverse-path".  The reverse-path is used to route DSNs ("bounce
messages" and "return receipts").  Other than as described below, the
MTA's hostname has nothing to do with the reverse-path.

  The hostname is what an MTA identifies itself as.  That will get
used in HELO (or EHLO).  The HELO name normally has no bearing on mail
routing; it's just a protocol feature for diagnostic convenience.

  In particular, in the original poster's scenario, and to the best of
my knowledge, Comcast's relay servers do not appear to care about the
HELO name.

  However, Comcast *will* reject on a reverse-path which specifies a
domain which does not resolve to something which can receive mail.
This makes sense; if the reverse-path is invalid, the sender cannot be
contacted, so they have no business sending email.

  In particular, using <c-99-999-999-999.hsd1.nh.comcast.net> as the
domain part of the reverse-path isn't a particularly good idea, unless
one has a static IP address.

  Now, the hostname does have one connection to the reverse-path: It
is usually used to build the revere-path when an MUA submits a message
to the MSA or MTA.  A bare Unix username like <bscott> is not an email
address.  By default, most MTAs canonicalizize the Unix hostname into
a FQDN, and then append that to the username to get an email address.

  Example: My PC's hostname is <blackfire>.  I've got an /etc/hosts
entry that will cause that to canonicalizize to
<blackfire.local.bscott>.  So when my MTA (Sendmail) talks to Comcast,
it HELO's as <blackfire.local.bscott>.

  My user account is <bscott>.  By default, my MTA would build my
email address as <bscott at blackfire.local.bscott>.  That's obviously
invalid outside my LAN.

  My public email address right now is <dragonhawk at gmail.com>.
Changing my MTA's idea of my hostname to <gmail.com> would yield
<bscott at gmail.com>, which doesn't help.

  I could rename my account.  But then if I wanted to switch to my
Comcast address (which is <bscott192 at comcast.net>), I'd have to change
everything again.  If I get my vanity domain working again, I'd have
to rename my local account to "public", so my default email address
would be <public at dragonhawk.org>.  My account name is used in config
files all over my PCs; this would be a mess.

  So, what I want to do is tell my MTA to rewrite <bscott> and some
variants to <dragonhawk at gmail.com>.  My MTA can keep on using
<blackfire.local.bscott> for its hostname, but I want it to modify the
reverse-path.

  Do do that, I add an entry to the Sendmail /etc/mail/genericstable,
which looks like this:

	bscott	dragonhawk at gmail.com

  For a hypothetical other user on my PC, I could add:

	bobama	president at whitehouse.gov

  The scenario here (for me, and the OP) is rewriting email addresses,
not masquerading as a different host.  :)

  So, {can, how would} this be done in Postfix and/or Exim?

-- Ben


More information about the gnhlug-discuss mailing list