Transform sender addresses |
V8.8 and above |
The User Database (userdb) allows recipient addresses to be changed so
that they can be delivered to new hosts. For example,
[email protected] can be transformed with the User
Database into [email protected]. The
genericstable provides the same type of
transformation on the sender's address.
To begin, create a file of the form:
user [email protected]
[email protected] [email protected]
In it, each line begins with the old address, either the user part
alone, or the full address. On the right is the new address for that
sender. One example of a use for this table might be to make the user
news always appear as though it was from the
news machine:
news [email protected]
[email protected] [email protected]
Note that the bare user part (news in the first
line) is looked up only if sendmail considers it
to be in the local domain. If a domain is listed (as in the second
line in the preceding example) that entry is looked up only if it is
in a special class defined with the GENERICS_DOMAIN
mc macro (Section 4.8.1). If you
want subdomains to also match, you must declare the
generics_entire_domain feature (FEATURE(generics_entire_domain)). Ways to list domains in that special class
are outlined later in this chapter.
The makemap(1) program (Section 5.5) is then used to convert this file into a
database:
makemap hash db_file < text_file
Here, db_file is the name you give to the
created database, and text_file is the
name of the source text file.
Note that local and nonlocal hosts can appear in the special class
defined with the GENERICS_DOMAIN mc macro. Also
note that the members of $=w are
not automatically placed into this special
class.
The genericstable feature enables this lookup by
including a K configuration command:
Kgenerics hash /etc/mail/genericstable
The form of the genericstable
feature's declaration is:
FEATURE(`genericstable')
The genericstable feature is one of those that can
take an argument to specify a different form of, or a different name
for, the database:
FEATURE(`genericstable',`dbm -o /etc/mail/genericstable')
The extra argument causes the earlier K command to
be replaced with the following one:
Kgenerics dbm -o /etc/mail/genericstable
See -o for a description of the
K command -o switch.
You can also provide an extra argument that is a literal LDAP:
FEATURE(`domaintable', `LDAP')
The default in this instance becomes the following (we have wrapped
the lines to fit the page):
Kgenerics ldap -1 -v sendmailMTAMapValue -k (&(objectClass=sendmailMTAMapObject)
(|(sendmailMTACluster=${sendmailMTACluster})(sendmailMTAHost=$j))
(sendmailMTAMapName=generics)(sendmailMTAKey=%0))
See ldap (was ldapx) for a description of the
ldap database type and its -1,
-v, and -k switches.
The genericstable should be enabled only if you
intend to use it. It causes every sender to be looked up in that
database.
GENERICS_DOMAIN mc macro
Beginning with V8.8 sendmail, a new
mc macro was introduced to make it easier to
list domains for use with the genericstable
feature. Called GENERICS_DOMAIN, it is used like this:
GENERICS_DOMAIN(`domain1 domain2 etc.')
Each domain that you intend to list should be listed individually and
separated from the others by spaces. Multiple GENERICS_DOMAIN lists
can be declared in your mc file:
GENERICS_DOMAIN(`domain1')
GENERICS_DOMAIN(`domain2')
GENERICS_DOMAIN(`etc.')
If you are currently declaring the $=G class
directly under the LOCAL_CONFIG mc macro, you
are encouraged to convert to this new mc macro.
Use of it will insulate you from change in the future if a different
sendmail class is ever used.
GENERICS_DOMAIN_FILE mc macro
Beginning with V8.8 sendmail, a new
mc macro was introduced to make it easier to
list domains with the genericstable feature.
Called GENERICS_DOMAIN_FILE, it is used like this:
GENERICS_DOMAIN_FILE(`/etc/mail/genericdomains')
This declaration causes the list of domains to be read from the file
/etc/mail/genericdomains. Because
GENERICS_DOMAIN_FILE is implemented with an F
configuration command (Section 22.1.2), you can add
whatever F command arguments you desire. For
example:
GENERICS_DOMAIN_FILE(`-o /etc/mail/genericdomains')
Here, the -o switch makes the presence of the
/etc/mail/genericdomains file optional.
If you are currently reading a list of domains from a file declared
with an FG configuration command, you are
encouraged to convert to this new macro. Use of it will insulate you
from change in the future if a different class is ever used.
|