0% found this document useful (0 votes)
5 views

Appendix b

The document provides a guide on managing virtual domains with sendmail V8, focusing on mapping email addresses to system mailboxes. It outlines the steps for creating a database to map email addresses to mailboxes and modifying sendmail rulesets for proper email delivery. The technique simplifies the management of multiple domains by allowing external mapping, making it easier to maintain email configurations.
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Appendix b

The document provides a guide on managing virtual domains with sendmail V8, focusing on mapping email addresses to system mailboxes. It outlines the steps for creating a database to map email addresses to mailboxes and modifying sendmail rulesets for proper email delivery. The technique simplifies the management of multiple domains by allowing external mapping, making it easier to maintain email configurations.
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

#ToC Index Next Previous

Apache Server Survival Guide asgxb.htm

Previous Page TOC Next Page


_________________________________________________________________

* Managing Several Domains


+ Building the Database
+ Configuring sendmail to Use the Mailbox Database
o Editing the Rulesets
+ Restarting sendmail
* Summary
_________________________________________________________________

Managing Virtual Domains with sendmail V8

The technique described in this chapter will help you map e-mail
addresses to a system mailbox. While in most installations you won't
have to worry about this because UNIX will handle this for you, more
complex installations that make use of virtual do mains will probably
require you to provide some sort of e-mail address support.

An Internet e-mail address can be divided into two components: the


username and the domain name ([email protected]).

The user portion usually matches the login name of a local user. It
can also be an alias to a different user or a distribution list for
many other users in the system. As you may be aware, you cannot create
two identical login names on the same machine under UNIX. It would
also be unwise to create an alias that matched an existing user's
login name. If you did create such an inconsistency, the results will
be unexpected and more than likely not be what you want. Mail
addressed to the user will e nd up delivered to someone else.

While under typical installation, this is never a problem. When it


comes to dealing with virtual domain names and virtual Web sites, it's
like you will run into a problem. Someone responsible for handling
e-mail for one of your virtual domains will wan t you to provide the
ability to redirect mail written to [email protected] to be mapped to
his e-mail account on your system or forwarded elsewhere. For
addresses such as [email protected], you can easily see the
problem. sendmail, b y default, doesn't make a distinction between
e-mail accounts destined to different domains. To sendmail, if the
domain in question is not forwarded elsewhere, it must belong to the
user addressed in the envelope, regardless of the domain name.

The following article is reprinted and enhanced from a posting made on


November 10, 1995, to comp.mail.sendmail by Johan Svensson
(<[email protected]>). He granted kind permission for the inclusion of
this article. It describes how to handle this sit uation by allowing
each domain to have standard e-mail addresses, which are forwarded to
the appropriate user based on the domain name information.

Managing Several Domains


If you want to provide e-mail to several domains and be able to use
identical usernames across different domains such as in

[email protected] [email protected]

[email protected] [email protected]

[email protected] [email protected]

you'll need a way to map the full e-mail address to use an external
database. You will also need to do some minor Ruleset rewriting in the
sendmail.cf. Many Internet Service Providers have asked for a general
solution to this problem, and here's the so lution.

This process involves two major steps:


1. 1. Creating a database to map from an e-mail address to a mailbox.
2. 2. Modifying a sendmail ruleset so that it uses the e-mail to
mailbox database to figure out where to deliver the e-mail.

Building the Database

The database is compiled out of an American Standard Code of


Information Interchange (ASCII) file that has the following structure
(the incoming e-mail address and the destination mailbox, which can be
in a totally different system or machine):

[email protected] [email protected]

[email protected] [email protected]

[email protected] [email protected]

The left column contains the e-mail address of a particular user, and
the right column contains the corresponding mailbox. If you maintain
several domains, you may want to create several databases (one per
domain) and cat them together (using th e UNIX cat program) prior to
compilation. This may make it easier to maintain domain aliases for a
domain in the future because maps for each domain are saved on their
own file.

The following example may closely match your needs. Some of the
destination addresses are forwarded to other domains for resolution
([email protected]). Others will be remapped to other addresses
that will require reprocessing and derefencing the ad dress several
times before arriving at the final mailing address
([email protected]):

[email protected] [email protected]

[email protected] [email protected]

[email protected] [email protected]

[email protected] [email protected]

[email protected] [email protected]

[email protected] joeuser
Note that you need to write the complete e-mail address in the left
column. The right column entry can be a local address (for example
johan if that account exists) or a complete e-mail address on another
system (or a domain the server recognizes as lo cal).

After you build the ASCII representation of the database, you'll need
to compile it into a more efficient lookup table using the makemap
utility that came with your sendmail distribution (if your system
supports hash, dbm or btree, you can use those co mmands instead).
Your command will look something like the following:

makemap hash mbt.db <mbt

The resulting hashed database in this example is called mbt.db. The


input ASCII database is called mbt.

Configuring sendmail to Use the Mailbox Database

In /etc/sendmail.cf, add the following line right after the DM entry.


You'll need to replace method with the type of database it is (use
hash for makemap files, dbm -o for dbm files, or btree for a
btree-generated databases):

Kmbt method /etc/sendmail/mbt.db

Editing the Rulesets

Edit the ruleset 98 section (S98) and add the following inside the
ruleset. Which modifications you make will depend on the version of
sendmail you are using.

For sendmail versions prior to 8.7.1, add the following:

R$+ < @ $+ . > $: $1 < @ $2 > .

R$+ < @ $+ > $* $: $(mbt $1@$2 $: $1 < @ $2 > $3 $)

R$+ < @ $+ > $* $: $(mbt $2 $: $1 < @ $2 > $3 $)

R$+ < @ $+ > . $: $1 < @ $2 . >

For sendmail versions later than 8.7.1, add this instead:

R$+< $+. > $1< $2 >

R$+< $+ > $: < > $(mbt $1$2 $)

R< > $+ @ $* $: < $1 > $(mbt * @ $2 $)

R< > $* $: $>3 $1

Restarting sendmail

Finally, restart sendmail to see your changes. You must do this in


order to reread the configuration file and test with sendmail -bv or
sendmail -bt.

Summary
This technique will make it easier for you to support multiple info
and webmaster mailboxes for the various domains you host. Because the
various mapping are external to the sendmail configuration file,
adding and deleting entries are much easier to ma intain than would
otherwise be possible.

Previous Page Page Top TOC Next Page

You might also like