![]() | ![]() |
|
sendmail address rewriting mini-HOWTOThomas Roessler, roessler@guug.dev0.0, 6 May 1998This document is a brief description of how to set up sendmail's configuration file for the home user's dial-up access.
1. Introduction
2. File Roadmap
3. Configuring sendmail
4. Further reading1. IntroductionWe assume that you have the kind of Internet access which seems to be most common at universities and online services nowadays: You dial into your provider's network using PPP over a serial connection. Your incoming mail is spooled at the provider's POP or IMAP server, while outgoing messages are to be sent via SMTP. You don't have a domain name of your own, so everything has to use one address.
We assume that you have already installed a fairly recent version of Eric Allman's sendmail (version 8.8.8 is current at the time of this writing and should work fine).
This document is partially referring to specific properties of Debian GNU/Linux systems; users of different distributions will have to take some care.
Make sure you have the following information at hand:
The configuration we are planning has two main goals:
To achieve this, we will make use of sendmail's
2. File RoadmapWe will put all of sendmail's configuration files in a
separate directory under
The following files will populate
Some of these files will be accompanied by
We assume that the
3. Configuring sendmail3.1 The main configuration fileSendmail uses a highly complex rule system for it's
configuration. While you can do lots of neat tricks with
this stuff, writing a
Instead of hand-crafting these rules, we will rely on
the
Let's look at the first lines of the
include(/usr/lib/sendmail.cf/m4/cf.m4) VERSIONID(`sendmail.mc - roessler@guug.de') OSTYPE(debian) define(`ALIAS_FILE',`/etc/mail/aliases') In the beginning,
The following lines tell sendmail to use the
FEATURE(masquerade_envelope) FEATURE(genericstable, `hash -o /etc/mail/genericstable') GENERICS_DOMAIN_FILE(`/etc/mail/genericsdomain') The masquerade_envelope feature tells sendmail to
apply header rewriting to the envelope sender of a
message. This is the mail address to which external mail
delivery subsystems will direct their delivery failure
reports and warning messages. The generics* files
will be explained below.
Now, we have to define a so-called smart host, that is, a machine which will handle outgoing mail for your system. Note that this machine may be different from your ISP's POP and IMAP servers. If in doubt, contact the hotline. The code in the master configuration file: define(`SMART_HOST',`mail-out.your.provider') Please replace mail-out.your.provider by the fully qualified hostname of your internet service provider.
The final two lines include the "mailer" definitions which are needed by sendmail to find out how to handle various types of mail: MAILER(local) MAILER(smtp)
To generate the # m4 sendmail.mc > _sendmail.cf # mv -f _sendmail.cf sendmail.cf Note the technique of writing m4 's output to a
temporary file which is thereafter moved to the proper
place. This helps us to prevent sendmail from reading
partially written configuration files.
3.2 Address rewritingFirst, we have to tell sendmail what addresses are to
be considered local (and thus should be subjected to the
rewriting). This is quite simple: Just put the fully
qualified host name of your machine into the file
$ hostname -f
Now, let's come to the rewriting table proper:
harry harryx@your.isp maude maudey@her.isp root fredx@your.isp news fredx@your.isp Note that there should be one entry for each account on the local machine, so that automatically generated mail which leaks out of the local system carries correct header information.
For performance reasons, sendmail won't use this text file directly, but rely on a "hashed" version instead. To generate it, type the following command:
# makemap -r hash genericstable.db < genericstable
Note that the rewriting rules from the
3.3 AliasesThe aliases file contains additional local names which
are only valid for local messages. This is useful for
administrative accounts like
A reasonable start for
root: fred news: root postmaster: root mail: root www: root nobody: /dev/null MAILER-DAEMON: nobody This example will forward local mail for the
Just like the
4. Further readingThe sendmail source distribution includes quite a bit
of documentation. Read it, especially the file
If you are interested to dive deeper into sendmail's configuration options, you want to get the "Bat Book" from O'Reilly: Bryan Costales, Eric Allman, and Neil Rickert: "sendmail". O'Reilly, 1993.
|
![]() |