From: per@erix.ericsson.se (Per Hedeland)
Message-ID: <8ag1td$i8n$1@news.du.uab.ericsson.se>
Newsgroups: comp.mail.sendmail
Subject: Re: masquerade problem (sendmail 8.9.3)
Date: 12 Mar 2000 12:17:49 GMT
Organization: Ericsson Utvecklings AB, Stockholm, Sweden

In article <38cabf9b.11578529@pc1> nomail@please.txs (Doogle) writes:
>I'd like all the internal mail to be masqueraded as 'user@my.domain' but all
>external mail to be masqueraded as 'user@myisp.com.

This is the problematic part of course, and the question you should ask
yourself is *why* do you want to do this? What's the point of users
having two different mail addresses, with all the ensuing risk for
confusion (e.g. internal addresses "leaking" to the outside in forwarded
messages)? It can be done (of course), but not with the pre-packaged m4
features. Much better is to decide that users should always have their
"external", "official" addresses, and teach sendmail which of those are
actually "local", to avoid the unnecessary roundtrip to the ISP.

The latter can be done e.g. by turning on aliasing for the SMTP mailers,
with define(`SMTP_MAILER_FLAGS', `A') in your .mc - then you can put
entries like

user@myisp.com: user

in your normal alias file. Another possibility is to upgrade to 8.10 and
use VIRTUSER_DOMAIN[_FILE]() to list myisp.com and the other external
domains that need to be handled this way, and put

user@myisp.com user

in the virtusertable - any xxx@myisp.com not found in the virtusertable
will then "fall through" to normal remote delivery.

To do what you actually asked for, you could use a modified copy of
either the local or smtp mailer definitions instead of the standard one,
either included directly in your .mc after a MAILER_DEFINITIONS line or
perhaps as a separate file included e.g. via HACK(). The details of the
modifications needed are left as an exercise etc, but the masquerading/
genericsizing happens in ruleset 93 (MasqHdr in 8.10), which is called
(possibly indirectly) by one or more of the rules indicated by the R=
and S= fields of the mailer definitions.

--Per Hedeland
per@erix.ericsson.se


