Re: E-Mail services on personal workstation



On 17 Sep 2007 01:11:49 +0200, michaelgrunewald@xxxxxxxx (Michaël Grünewald) wrote:
Warren Block <wblock@xxxxxxxxxxx> writes:
* the machine uses the ``outgoing mail server'' managed by my ISP.

That's the

define(`SMART_HOST', `relay.example.net')

line in the Handbook entry above. Of course, you'd use the smarthost
provided by your ISP instead of relay.example.net.

Thank you very much for your precise answer.

Now the mail system on the workstation ``just works'' and I am pretty
satisfied with it. However, I would like to add a final touch: I gave
names to computers on my private (home) network, but these names are
not meaningful on the public side of the network. It would be clean
style to prevent sendmail let mail with private hostnames in the
envelope slip out to the ISP mail-hub. If I could I would tell him
``blindly change local addresses to mg@xxxxxxxx on outgoing messages''
but I have no idea how to do this.

This is called ``address masquerading'' in Sendmail.

I dived into `/usr/share/sendmail/cf/README', but didn't find anything
suiting my wishes (the closer thing seems the MASQUERADE_AS option,
but it is actually quite distant).

Yup, that's it.

Perhaps it will help to have a look at the comments I keep locally for
my masquerading and `genericstable' setup?

Lines that begin with `dnl ' below are comments, and you should try to read
these before copying the relevant bits in your `hostname.mc' file.

dnl Snippers from `/etc/mail/kobe.mc' on `kobe.laptop'.

dnl ...

dnl This is a generic configuration file for FreeBSD 6.X and later
dnl systems. It has been customized for a roaming network setup,
dnl directing all outgoing email to `igloo.linux.gr', through SMTP AUTH.
dnl -- Giorgos Keramidas <keramida@xxxxxxxxxxxxxxx>
dnl
dnl The best documentation for this .mc file is:
dnl /usr/share/sendmail/cf/README or
dnl /usr/src/contrib/sendmail/cf/README

dnl ...

dnl === Outgoing email relay ===
dnl
dnl All outgoing email is sent to igloo.linux.gr through the `relay'
dnl mailer. Exceptions, i.e. for any domains which need special handling,
dnl use `esmtp' or another mailer, through `mailertable'.

define(`SMART_HOST', `igloo.linux.gr')
define(`RELAY_MAILER_ARGS', `TCP $h 587')

dnl ...

dnl === Address masquerading ===
dnl
dnl Making sure that all email that passes through my desktop's Sendmail
dnl installation is masqueraded as coming from `kobe.laptop', even if its
dnl original address is something slightly different (i.e. `ftp.laptop' or
dnl `mail.laptop'), is ok here. It ensures that address rewriting and
dnl translation through `genericstable' will also work for all `*.laptop'
dnl host names.
dnl
dnl To make sure that remote hosts don't get a MAIL FROM address from a
dnl hostname that doesn't resolve, envelope addresses are masqueraded too,
dnl and then get rewritten by `genericstable' to real-world addresses,
dnl i.e. `keramida@xxxxxxxxxxxxxxx'.

MASQUERADE_AS(`kobe.laptop')
FEATURE(`masquerade_entire_domain')
FEATURE(`masquerade_envelope')

dnl === Address rewriting ===
dnl
dnl Rewriting the envelope-from address of all outgoing messages through a
dnl `genericstable' lookup, ensures that envelope-from addresses seen by
dnl relay hosts are real, i.e. `keramida@xxxxxxxxxxxxxxx' instead of the
dnl default envelope-from of `keramida@xxxxxxxxxxx' that Sendmail would
dnl use. This is required some times, to avoid getting bounces for
dnl messages from ISP mail relays that are misconfigured or are too strict
dnl about what can appear in a MAIL FROM command.

FEATURE(`genericstable', `hash -o /etc/mail/genericstable')
GENERICS_DOMAIN(`kobe.laptop')
FEATURE(`generics_entire_domain')

dnl ...

After you read the comments, try to adapt the non-commented lines, to match
your preference for the setup you want to install. Some tips for setting up
the non-commented lines are below:

* Set SMART_HOST to your ISP's mail relay

I think you have already done this, if you have a setup that's working per
the suggestions of other posters elsethread.

* You probably don't really care about RELAY_MAILER_ARGS

I am using SMTP authentication, to forward all my outgoing email to
`igloo.linux.gr', a mail server for which I am partly responsible.
Normally, it is ok to leave this part out, and let the `relay' mailer use
the default SMTP port (TCP port 25) for outgoing email traffic.

* The MASQUERADE_AS hostname should be tweaked

My laptop's hostname is `kobe.laptop', so you will probably have to tweak
a bit the hostname at the MASQUERADE_AS line, to match the _domain_ name
of your local network. This way, if your hostname is `foo.domain' and
there are also hosts called `bar.domain' and `baz.domain', you can
masquerade all these hostnames to `domain' with:

MASQUERADE_AS(`domain')
MASQUERADE_DOMAIN(`domain')

* The GENERICS_DOMAIN needs similar tweaking

It's probably easier for now to keep the GENERICS_DOMAIN the same as the
value of MASQUERADE_DOMAIN.

* You will have to create a `genericstable'

The `genericstable' feature line at:

FEATURE(`genericstable', `hash -o /etc/mail/genericstable')

makes Sendmail look up outgoing email addresses in a disk file and rewrite
them with the right-hand side of this file. This file is located at
`/etc/mail/genericstable' on my laptop, and it contains entries like:

#
# Outgoing email address rewriting.
#
keramida@localhost keramida@xxxxxxxxxxxxxxx
keramida@xxxxxxxxxxxxxxxx keramida@xxxxxxxxxxxxxxx
keramida@kobe keramida@xxxxxxxxxxxxxxx
keramida@xxxxxxxxxxx keramida@xxxxxxxxxxxxxxx

You will have to create a similar `address map' with your own email
addresses, putting at the right-hand the *real* email address that you
want visible in outgoing messages.

After you create the `/etc/mail/genericstable' file, you can run
makemap(1) on this file with:

# cd /etc/mail
# makemap hash genericstable < genericstable

* Now you should be ready to regenerate the Sendmail config files in
`/etc/mail' and restart it:

# cd /etc/mail
# make all && make install
# make restart

With the `hostname.mc' options described above, and the genericstable map
shown above, Sendmail will start `masquerading' or `rewriting' outgoing email
addresses to the ones you configured at the right-hand side of the
`genericstable' map.

I hope this helps a bit, but if you have problems getting it to work, please
feel free to ask for more details.

- Giorgos

.



Relevant Pages

  • Re: sendmail/mail/Mail
    ... The host name is myhost. ... I realize I have to change the hostname to myhost.Acme.COM but I cant' change the hostname ... the mail command just calls sendmail, it has no means of setting from. ... removing the leading dnl and replacing mydomain.com with something that is internet-legal. ...
    (Fedora)
  • RE: sendmail domain name
    ... the hostname is being masqueraded as ... Assuming that your SMTP is sendmail, you need to masquerade your ... dnl # The following example makes mail from this host and any additional ...
    (RedHat)
  • Re: sendmail version 8.13.6
    ... We are using Sendmail for the purpose with Mail Transfer Agent. ... After installation it works fine except ... it adds hostname in the email address. ... dnl MASQUERADE_ASdnl ...
    (comp.mail.sendmail)
  • Re: sendmail version 8.13.6
    ... We are using Sendmail for the purpose with Mail Transfer Agent. ... it adds hostname in the email address. ... dnl MASQUERADE_ASdnl ... to translate into your mailing domain name. ...
    (comp.mail.sendmail)
  • No AUTH available / No secret found in database
    ... We are using Sendmail 8.13.4/8.13.4 and Cyrus-SASL 2.1.19. ... authentication configuration information to the .mc file, ... Somehow, I managed to add something else to the configuration, either ... dnl # General defines ...
    (comp.mail.sendmail)