Cover | Table of Contents | Colophon
$ ls sendmail-8.12.9 Build doc INSTALL libsmdb mailstats praliases sendmail cf editmap KNOWNBUGS libsmutil Makefile README smrsh contrib FAQ libmilter LICENSE makemap RELEASE_NOTES test devtools include libsm mail.local PGPKEYS rmail vacation
$ ls sendmail-8.12.9 Build doc INSTALL libsmdb mailstats praliases sendmail cf editmap KNOWNBUGS libsmutil Makefile README smrsh contrib FAQ libmilter LICENSE makemap RELEASE_NOTES test devtools include libsm mail.local PGPKEYS rmail vacation
ftp://ftp.sendmail.org/, from http://www.sendmail.org/current-release.html,
or from one of a large number of mirror sites. A link to the mirror
sites is found on the http://www.sendmail.org/ home page. The
Discussion section provides an example of downloading the sendmail
source code distribution via ftp.# cd sendmail-8.12.9 # ./Build
# grep smmsp /etc/passwd smmsp:x:25:25:Mail Submission:/var/spool/clientmqueue:/sbin/nologin # grep smmsp /etc/group smmsp:x:25:
# ./Build install
site.OS
.m4,
where OS is the name of the
computer's operating system,
sendmail
-bt
-d0.1 to check the sendmail compiler options. If
the string LDAPMAP appears in the
"Compiled with:" list, there is no
need to recompile sendmail. If LDAPMAP does not
appear in the "Compiled with:"
list, recompile sendmail to add LDAP support.# cd /usr/local/src/sendmail-8.12.9/devtools/Site # cat >> site.config.m4 APPENDDEF(`confMAPDEF', `-DLDAPMAP') APPENDDEF(`confLIBS', `-lldap -llber') Ctrl-D # cd /usr/local/src/sendmail-8.12.9 # ./Build -c
# ./Build install
include to the
/etc/openldap/slapd.conf file:include /etc/openldap/schema/sendmail.schema
# ps -ax | grep slapd 1426 ? S 0:00 /usr/sbin/slapd -u ldap # kill -TERM 1426 # /usr/sbin/slapd -u ldap
regex
map type must be compiled into
sendmail if the error message "class regex not
available" is displayed when sendmail is run.MAP_REGEX to the
confMAPDEF
compiler
variable in the site.config.m4 file and then
recompile sendmail. Here is an example:# cd /usr/local/src/sendmail-8.12.9/devtools/Site # cat >> site.config.m4 APPENDDEF(`confMAPDEF', `-DMAP_REGEX') Ctrl-D # cd /usr/local/src/sendmail-8.12.9 # ./Build -c
# ./Build install
regex map type on a sendmail system without
regex support compiled in produces an
error, as this test shows:# sendmail -bt sendmail.cf: line 115: readcf: map dottedquad: class regex not available ADDRESS TEST MODE (ruleset 3 NOT automatically invoked) Enter <ruleset> <address> > /quit
sendmail
-bt command is an error message. It tells us that
line 115 in the sendmail.cf file contains a
K command that defines a map using the
regex map type, which results in an error because
regex is not supported on this system.APPENDDEF
command used in the Solution section appends the
-DMAP_REGEX command-line argument to any values
that already exist in the confMAPDEF variable. The
Build command that is used to recompile sendmail
uses the -c flag to ensure that
Build incorporates the new data from the
site.config.m4 file.-bt and
the -d0.1 command-line arguments to check the
compiler options:# sendmail -bt -d0.1
Version 8.12.9
Compiled with: DNSMAP LOG MAP_REGEX MATCHGECOS MIME7TO8 MIME8TO7 NEWDB
NAMED_BIND NETINET NETUNIX PIPELINING SCANF USERDB XDEBUG
============ SYSTEM IDENTITY (after readcf) ============
(short domain name) $w = chef
(canonical domain name) $j = chef.wrotethebook.com
(subdomain name) $m = wrotethebook.com
(node name) $k = chef
========================================================
ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>
> SASL flag, it does not need to be recompiled.
If sendmail was not compiled with SASL support, add
SASL to the
-D
flags
used to specify compiler environment information, add
sasl to the
-l
flags
used to select libraries for linking, and recompile sendmail. After
recompiling sendmail, reinstall and restart it.-d0.1 flag to check the compiler options
of the sendmail binary. The SASL flag should be
clearly shown in the "Complied
with:" list, as in this example:# sendmail -bt -d0.1 Version 8.12.9 Compiled with: DNSMAP LOG MAP_REGEX MATCHGECOS MIME7TO8 MIME8TO7 NAMED_BIND NETINET NETUNIX NEWDB PIPELINING SASL SCANF USERDB XDEBUG ============ SYSTEM IDENTITY (after readcf) ============ (short domain name) $w = chef (canonical domain name) $j = chef.wrotethebook.com (subdomain name) $m = wrotethebook.com (node name) $k = chef ======================================================== ADDRESS TEST MODE (ruleset 3 NOT automatically invoked) Enter <ruleset> <address> > /quit
APPENDDEF(`conf_sendmail_ENVDEF', `-DSASL')
APPENDDEF(`conf_sendmail_LIBS', `-lsasl')
# cd /usr/local/src/sendmail-8.12.9 # ./Build -c ...many lines of output deleted... # cd /usr/local/src/sendmail-8.12.9/sendmail # ./Build install ...many lines of output deleted... # kill -HUP `head -1 /var/run/sendmail.pid`
STARTTLS
extension.sendmail
-bt
-d0.1 to check the sendmail compiler options. If
the string STARTTLS appears in the
"Compiled with:" list, there is no
need to recompile sendmail. If sendmail was not compiled with
STARTTLS support, edit the
devtools/Site/site.config.m4 file to add
STARTTLS to the compiler's
-D
flags and to add ssl and crypto
to the -l flags used to select libraries for
linking. See the following example:# cd /usr/local/src/sendmail-8.12.9/devtools/Site # cat >> site.config.m4 APPENDDEF(`conf_sendmail_ENVDEF', `-DSTARTTLS') APPENDDEF(`conf_sendmail_LIBS', `-lssl -lcrypto') Ctrl-D
# cd /usr/local/src/sendmail-8.12.9 # ./Build -c ...many lines of output deleted... # ./Build install ...many lines of output deleted... # kill -HUP `head -1 /var/run/sendmail.pid`
APPENDDEF command adds
-DSTARTTLS to the list of compiler options stored
in the
conf_sendmail_ENVDEF
define. The second APPENDDEF command adds
-lssl and -lcrypto to the list
of libraries stored in the
conf_sendmail_LIBS
define.-c option on the Build
command line ensures that Build detects the
changes made to the site.config.m4 file.
Build
install is run to install
the freshly compiled sendmail binary. The HUP
signal is used to restart sendmail with the new binary.-d0.1 option shows that
STARTTLS is included in the
"Compiled with:" list. sendmail can
now be configured to offer STARTTLS
extension,
"No such file or directory" errors
are displayed in regard to OpenSSL files.conf_sendmail_INCDIRS
and
conf_sendmail_LIBDIRS
to tell sendmail
where the OpenSSL files are located. Add the defines to the
site.config.m4 configuration file, as in this
example:# cd /usr/local/src/sendmail-8.12.9/devtools/Site # cat >> site.config.m4 APPENDDEF(`conf_sendmail_INCDIRS', `-I/usr/share/ssl/include') APPENDDEF(`conf_sendmail_LIBDIRS', `-L/usr/share/ssl/lib') Ctrl-D
# cd /usr/local/src/sendmail-8.12.9 # ./Build -c ...many lines of output deleted... # ./Build install ...many lines of output deleted... # kill -HUP `head -1 /var/run/sendmail.pid`
APPENDDEF
commands to add the correct
location of the OpenSSL include file to the
conf_sendmail_INCDIRS variable and the correct
location of the OpenSSL library to the
conf_sendmail_LIBDIRS variable. The
APPENDDEF commands are added to the
site.config.m4 file.Build
-c command. If the path
values are correctly defined, the build should run without errors.# ./Build sendmail.cf Using M4=/usr/bin/m4 rm -f sendmail.cf /usr/bin/m4 ../m4/cf.m4 sendmail.mc > sendmail.cf || ( rm -f sendmail.cf && exit 1 ) chmod 444 sendmail.cf # cp /etc/mail/sendmail.cf /etc/mail/sendmail.cf.bak # cp sendmail.cf /etc/mail/sendmail.cf # kill -HUP `head -1 /var/run/sendmail.pid`
HUP signal. This assumes that sendmail is already
running with some current configuration, which is a good assumption
for the majority of recipes in this book. If, however, sendmail has
just been installed, is not running, and has not been previously
configured, use Build
install-cf to properly install both the
sendmail.cf file and the
submit.cf file. See Recipe 1.8.3.3 of the following
discussion for an example of the Build
install-cf command.sendmail command-line options
-bt, -bv, and
-v.-bt
command-line option, sendmail enters test
mode
. While in test mode, sendmail accepts
a variety of commands that examine the configuration, check settings,
and observe how email addresses are processed by sendmail. Table 1-2 lists the commands that are available in test
mode.|
Command
|
Usage
|
|---|---|
|
rulesets
address
|
Process the address through the comma-separated list of rulesets.
|
=S
ruleset
|
Display the contents of the ruleset.
|
=M
|
Display all of the mailer definitions.
|
$
v
|
LogLevel
option, either on the sendmail command
line using the -O flag or in the sendmail
configuration using the
confLOG_LEVEL
define, to increase the LogLevel above the default
level of 9.confLOG_LEVEL define is used, rebuild and
reinstall sendmail.cf, and restart sendmail, as
described in Recipe 1.8.grep of
syslog.conf shows where the sendmail messages
are logged on our sample Linux system:$ grep mail /etc/syslog.conf # Log anything (except mail) of level info or higher. *.info;mail.none;authpriv.none;cron.none /var/log/messages # Log all the mail messages in one place. mail.* /var/log/maillog
mail.none, which means that no messages from the
mail facility will be logged in
/var/log/messages.
/var/log/maillog is the place to look for
sendmail log entries on this sample Linux system. The
mail.* entry means that, no matter what the level,
all messages from the mail facility are logged
in /var/log/maillog. Of course, this
syslog.conf file is specific to our sample
system. Your file might look different and, even if it looks exactly
like this one, you can change it in anyway that you wish. You
completely control where sendmail logs messages.
canonify
ruleset and through
the parse
ruleset—rulesets 3 and 0. Aliasing starts when the result of
that process tells sendmail to deliver the mail through a mailer that
has the A flag set. If ruleset 0 returns the name of a mailer that does not
have the A flag set, aliasing is not
done. While the A flag can be set for any mailer,
only the cyrus mailers and the
local mailer set the A flag by
default. For our discussion of aliasing, we'll use
the local mailer as an example.
canonify
ruleset and through
the parse
ruleset—rulesets 3 and 0. Aliasing starts when the result of
that process tells sendmail to deliver the mail through a mailer that
has the A flag set. If ruleset 0 returns the name of a mailer that does not
have the A flag set, aliasing is not
done. While the A flag can be set for any mailer,
only the cyrus mailers and the
local mailer set the A flag by
default. For our discussion of aliasing, we'll use
the local mailer as an example.dnl Load class $=w with other names for the local host FEATURE(`use_cw_file')
hash map "Alias0": missing map file /etc/mail/aliases.db: No such file or directory
alias: recipient
# newaliases
ALIAS_FILE
define to the sendmail.mc file:define(`ALIAS_FILE', `/etc/aliases')
ALIAS_FILE
define can accept various flags. You can make the
aliases database optional using the
-o flag exactly as it was used in Recipe 2.1 with the confCW_FILE
define. However, this is not a good idea. The sendmail
-bt
-d0.1 to check the sendmail compiler options. If
sendmail was not compiled with LDAP support, recompile and reinstall
sendmail as described in Recipe 1.3.ALIAS_FILE
define, containing the string
ldap:, to the sendmail configuration. Also add a
confLDAP_CLUSTER
define containing the same value as the
sendmailMTACluster attribute used in the entries
added to the LDAP server. Here is an example of these configuration
commands:# Set the LDAP cluster value define(`confLDAP_CLUSTER', `wrotethebook.com') # Tell sendmail that aliases are available via LDAP define(`ALIAS_FILE', `ldap:')
# cd /etc/mail # cat - > service.switch aliases nis files hosts dns files passwd files nis
confSERVICE_SWITCH_FILE
define. However, it is generally easier to place the
service.switch file in the
/etc/mail directory where sendmail, and most
administrators, expect to find it.aliases: nis files
confSERVICE_SWITCH_FILE define. The correct
solution for the Solaris system is to identify the sources of alias
information in the nsswitch.conf file. Any
source that is compatible with the nsswitch.conf
syntax and with sendmail can be specified. See the
nsswitch.conf manpage for information about the
syntax supported on your computer.A flag set. On most systems, only the
local mailer has this flag set, which means that
aliases only apply to inbound mail that has been accepted for
delivery through the local mailer. A centralized
database that includes aliases for all of the users in the
organization is needed only by a server that will accept mail for all
of the users in the organization. For most Unix workstations, the
bulk of the entries in a centralized database are unused—only
those users who actually receive their mail at the workstation are
looked up.# sendmail -bv pat@wrotethebook.com pat@wrotethebook.com... deliverable: mailer local, user pat # sendmail -bv andy@wrotethebook.com andy@wrotethebook.com... User unknown
owner-
list, where
owner- is a required string and
list is the name of the list for which
this owner alias is being declared. For example, if the list is named
admin, this alias must be named
owner-admin. The recipient field of the special
alias should contain the address where the errors are to be sent.-request, where
list is the name of the list for which
this request alias is being declared, and -request
is a required string. For example, if the list is named
admin, this alias should be named
admin-request.# newaliases
/etc/mail/aliases: 43 aliases, longest 30 bytes, 592 bytes total
FEATURE command:dnl Notify senders about discontinued addresses FEATURE(`redirect')
.REDIRECT appended to the end of the address.# newaliases
/etc/mail/aliases: 45 aliases, longest 30 bytes, 670 bytes total
|/usr/local/bin/rtmproc
prog mailer to deliver mail to