2.2 Where is everything?

In this section we will be discussing the contents of the three sendmail RPMs included with Red Hat Linux. We will start with the RPM which contains the essential sendmail binaries.

2.2.1 sendmail-8.9.3-15.i386.rpm

The best way to the RPMs contents is to execute a simple RPM command:

rpm -qpil /path/to/sendmail-8.9.3-15.i386.rpm

    Name : sendmail                         Relocations: (not relocateable) 
    Version : 8.9.3                         Vendor: Red Hat Software 
    Release : 15                            Build Date: Wed Sep 1 09:40:39 1999 
    Install date: (not installed)           Build Host: porky.devel.redhat.com 
    Group : System Environment/Daemons      Source RPM: sendmail-8.9.3-15.src.rpm 
    Size : 540121                           License: BSD 
    Packager : Red Hat Software <http://developer.redhat.com/bugzilla> 
    Summary : A widely used Mail Transport Agent (MTA). 
    Description : The Sendmail program is a very widely used Mail Transport Agent (MTA). MTAs send mail from one machine to another. Sendmail is not a client program, which you use to read your e-mail. Sendmail is a behind-the-scenes program which actually moves your e-mail over networks or the Internet to where you want it to go.
    If you ever need to reconfigure Sendmail, you'll also need to have the sendmail.cf package installed. If you need documentation on Sendmail, you can install the sendmail-doc package. 
    /etc/aliases 
    /etc/aliases.db 
    /etc/mail 
    /etc/mail/Makefile 
    /etc/mail/access 
    /etc/mail/access.db 
    /etc/mail/domaintable 
    /etc/mail/domaintable.db 
    /etc/mail/mailertable
    /etc/mail/mailertable.db 
    /etc/mail/virtusertable 
    /etc/mail/virtusertable.db 
    /etc/rc.d/init.d/sendmail 
    /etc/rc.d/rc0.d/K30sendmail 
    /etc/rc.d/rc1.d/K30sendmail 
    /etc/rc.d/rc2.d/S80sendmail 
    /etc/rc.d/rc3.d/S80sendmail 
    /etc/rc.d/rc4.d/S80sendmail 
    /etc/rc.d/rc5.d/S80sendmail 
    /etc/rc.d/rc6.d/K30sendmail 
    /etc/sendmail.cf 
    /etc/sendmail.cw 
    /etc/sendmail.mc 
    /etc/smrsh 
    /etc/sysconfig/sendmail 
    /usr/bin/hoststat 
    /usr/bin/mailq 
    /usr/bin/makemap 
    /usr/bin/newaliases 
    /usr/bin/purgestat 
    /usr/bin/rmail 
    /usr/lib/sendmail 
    /usr/lib/sendmail.hf 
    /usr/man/man1/mailq.1 
    /usr/man/man1/newaliases.1 
    /usr/man/man5/aliases.5 
    /usr/man/man8/mailstats.8 
    /usr/man/man8/makemap.8 
    /usr/man/man8/praliases.8 
    /usr/man/man8/rmail.8 
    /usr/man/man8/sendmail.8 
    /usr/sbin/mailstats 
    /usr/sbin/makemap 
    /usr/sbin/praliases 
    /usr/sbin/sendmail 
    /usr/sbin/smrsh 
    /var/log/sendmail.st 
    /var/spool/mqueue
    

So now we have a complete files listing for the installation. From the beginning you can see that the first file listed is /etc/aliases. This file contains all of the mail aliases for your system. Mail aliases are used by the system to allow mail that is sent to one address to be redirected to another as well as allow mail to be piped to, or through, programs for additional processing. The defaults are suitable for your system but some parts of it you may want to modify. For example, root is not aliased in the default file so you may want to give root an alias as it's not a good idea to read or send mail as root. The alias for root can be anyone but it's a good idea that it be the person who's responsible for administering the system as the system itself will send email notifications of all kinds to the root user and it's important that this mail is read if you plan on actively maintaining the system. Anytime you make a change to the aliases file you should issue the command: newaliases to force the system to update the alias map file.

The second file listed here is /etc/aliases.db. This is the alias file which has already been mapped to database format. The command: newaliases does this for you if you make changes but the initial install has already been mapped prior to installation.

The third file listed is: /etc/mail/Makefile. This file is very, very useful as it is the command line Makefile used to do the database mapping for the next several files. The quartet of very useful files which fall under its control are the access, domaintable, mailertable and virtusertable files.

The access file is aptly named as its purpose is to control access to the sendmail daemon. It is used both to allow and deny relay access. Here are a couple of examples of what the file's entries may look like:

    192.168.1.1     RELAY
    10.0.0.6        RELAY
    gooddomain.net  RELAY
    baddomain.net   550 Mail from your domain is denied
    192.168.1.10    550 Internet mail may not be sent from this host.
    

Sendmail users who have used earlier versions of Red Hat Linux may be accustomed to using other files to control this functionality but in the newer version of sendmail use of these files has been deprecated. Actually, using a single file to control access is much simpler. You just need to understand the rules for its use.

The domaintable allows an old domain to be mapped to a new one. It enables transitions from old domain names to new domain names by rewriting the old domain name to the new one.

The mailertable is a very useful hack which can help you to do some amazing things. It allows you to specify not only a domain translation (or forward) to a new domain name but you can also specify the delivery agent. Here's a sample:

    thisdomain.net  smtp:thatdomain.com
    

Also, if your DNS is sometimes a problem or you do not have DNS available to you, you can specify the destination by IP address like this:

    thisdomain.net  smtp:[192.168.1.1]
    

The brackets used here tell sendmail not to use DNS. This can be used in many ways but direct forwards of inbound mail come to mind. If a domain's MX is located on your machine but the actual users are elsewhere this is a perfect use for the mailertable hack. Essentially, it's a very powerful tool for redirecting mail.

The final file in the quartet is the virtusertable. This file is another database but this one maps virtual domains and addresses into new addresses. Its most common use is to allow multiple accounts of the same name (but different domains) on a single host. Here is an example:

    webmaster@domain.com            bob
    webmaster@otherdomain.com       ralph
    

In the above example, bob is a local user who will receive mail addressed to webmaster at one domain and ralph is also a local user who will receive mail sent to webmaster at a different domain both of which may be hosted on the same box. The address on the right could also be a remote address. In this way you could allow multiple people to be "webmaster" for email purposes and yet all of their mail will remain separate.

The next eight files:

    /etc/rc.d/init.d/sendmail
    /etc/rc.d/rc0.d/K30sendmail
    /etc/rc.d/rc1.d/K30sendmail
    /etc/rc.d/rc2.d/S80sendmail
    /etc/rc.d/rc3.d/S80sendmail
    /etc/rc.d/rc4.d/S80sendmail
    /etc/rc.d/rc5.d/S80sendmail
    /etc/rc.d/rc6.d/K30sendmail
    

are all scripts for starting sendmail in the various run-levels. They are followed by the three primary configuration files for sendmail:

    /etc/sendmail.cf
    /etc/sendmail.cw
    /etc/sendmail.mc
    

The sendmail.cf file is the running config file. This file is read when sendmail is started, -HUP'd, or restarted via its initscript. The sendmail.cf file is normally created using the m4 macro preprocessor. The "source code" m4 uses to create the sendmail.cf file is in the sendmail.mc file. The ".mc" file extension means that this is a macro configuration file. The default sendmail.mc file for sendmail that is shipped with Red Hat Linux is listed above in Section 1.5. We will cover this in greater depth later in this document.

The last file listed here is the sendmail.cw file. Quite simply this is where you list all domains, aliases, and hosts that your sendmail installation must treat as local mail. If you forget one and you or someone else tries to send mail with a from address in the omitted domain you will see an error which says something like this:

    MX list for hostname points back to hostname
    
    -or- 
    
    config error: mail loops back to myself
    

The next entry:

    /etc/smrsh
    

is the configuration directory for the sendmail restricted shell. It is empty by default.

Next up is /etc/sysconfig/sendmail. This file is used to assign some simple variables for the sendmail initialization script. By default it contains the following information:

    DAEMON=yes
    QUEUE=1h
    

Quite simply this information is passed to the sendmail initscripts telling sendmail to run as a daemon and that it should process its queue once an hour. Depending on your environment you may need to change these values. If you're running a 24x7 net host, you should know that the SMTP RFCs specify a minimum queue time of 5 minutes so a queue run frequency of one minute would violate the RFC specifications.

The next six entries are all binary files. They are:

    /usr/bin/hoststat
    /usr/bin/mailq
    /usr/bin/makemap
    /usr/bin/newaliases
    /usr/bin/purgestat
    /usr/bin/rmail
    

These are followed by the manual pages which describe how these commands are used and then by several additional binaries.

    /usr/sbin/mailstats
    /usr/sbin/makemap
    /usr/sbin/praliases
    /usr/sbin/sendmail
    /usr/sbin/smrsh
    

The next file listed is the sendmail status file:

    /var/log/sendmail.st
    

And finally the outgoing queue directory.

    /var/spool/mqueue
    

2.2.2 sendmail-cf-8.9.3-15.i386.rpm

This RPM contains the configuration files required if you need to create a new sendmail.mc and sendmail.cf file. Here's the breakdown:

    Name: sendmail-cf                 Relocations: (not relocateable)
    Version: 8.9.3                    Vendor: Red Hat Software
    Release: 15                       Build Date: Wed Sep  1 09:40:39 1999
    Install date: (not installed)     Build Host: porky.devel.redhat.com
    Group: System Environment/Daemons Source RPM: sendmail-8.9.3-15.src.rpm
    Size: 515799                      License: BSD
    Packager: Red Hat Software <http://developer.redhat.com/bugzilla>
    Summary: The files needed to reconfigure Sendmail.
    Description :
    This package includes the configuration files which you'd need to generate the sendmail.cf file distributed with the sendmail package. You'll need the sendmail-cf package if you ever need to reconfigure and rebuild your sendmail.cf file.  For example, the default sendmail.cf file is not configured for UUCP.  If someday you needed to send and receive mail over UUCP, you'd need to install the sendmail-cf package to help you reconfigure Sendmail.
    Install the sendmail-cf package if you need to reconfigure your sendmail.cf file.
    /usr/lib/sendmail-cf
    /usr/lib/sendmail-cf/README
    /usr/lib/sendmail-cf/cf
    /usr/lib/sendmail-cf/cf/Build
    /usr/lib/sendmail-cf/cf/Makefile
    /usr/lib/sendmail-cf/cf/chez.cs.mc
    /usr/lib/sendmail-cf/cf/clientproto.mc
    /usr/lib/sendmail-cf/cf/cs-hpux10.mc
    /usr/lib/sendmail-cf/cf/cs-hpux9.mc
    /usr/lib/sendmail-cf/cf/cs-osf1.mc
    /usr/lib/sendmail-cf/cf/cs-solaris2.mc
    /usr/lib/sendmail-cf/cf/cs-sunos4.1.mc
    /usr/lib/sendmail-cf/cf/cs-ultrix4.mc
    /usr/lib/sendmail-cf/cf/cyrusproto.mc
    /usr/lib/sendmail-cf/cf/generic-bsd4.4.cf
    /usr/lib/sendmail-cf/cf/generic-bsd4.4.mc
    /usr/lib/sendmail-cf/cf/generic-hpux10.cf
    /usr/lib/sendmail-cf/cf/generic-hpux10.mc
    /usr/lib/sendmail-cf/cf/generic-hpux9.cf
    /usr/lib/sendmail-cf/cf/generic-hpux9.mc
    /usr/lib/sendmail-cf/cf/generic-nextstep3.3.mc
    /usr/lib/sendmail-cf/cf/generic-osf1.cf
    /usr/lib/sendmail-cf/cf/generic-osf1.mc
    /usr/lib/sendmail-cf/cf/generic-solaris2.cf
    /usr/lib/sendmail-cf/cf/generic-solaris2.mc
    /usr/lib/sendmail-cf/cf/generic-sunos4.1.cf
    /usr/lib/sendmail-cf/cf/generic-sunos4.1.mc
    /usr/lib/sendmail-cf/cf/generic-ultrix4.cf
    /usr/lib/sendmail-cf/cf/generic-ultrix4.mc
    /usr/lib/sendmail-cf/cf/huginn.cs.mc
    /usr/lib/sendmail-cf/cf/knecht.mc
    /usr/lib/sendmail-cf/cf/mail.cs.mc
    /usr/lib/sendmail-cf/cf/mail.eecs.mc
    /usr/lib/sendmail-cf/cf/mailspool.cs.mc
    /usr/lib/sendmail-cf/cf/python.cs.mc
    /usr/lib/sendmail-cf/cf/redhat.cf
    /usr/lib/sendmail-cf/cf/redhat.mc
    /usr/lib/sendmail-cf/cf/s2k-osf1.mc
    /usr/lib/sendmail-cf/cf/s2k-ultrix4.mc
    /usr/lib/sendmail-cf/cf/tcpproto.mc
    /usr/lib/sendmail-cf/cf/ucbarpa.mc
    /usr/lib/sendmail-cf/cf/ucbvax.mc
    /usr/lib/sendmail-cf/cf/uucpproto.mc
    /usr/lib/sendmail-cf/cf/vangogh.cs.mc
    /usr/lib/sendmail-cf/domain
    /usr/lib/sendmail-cf/domain/Berkeley.EDU.m4
    /usr/lib/sendmail-cf/domain/CS.Berkeley.EDU.m4
    /usr/lib/sendmail-cf/domain/EECS.Berkeley.EDU.m4
    /usr/lib/sendmail-cf/domain/S2K.Berkeley.EDU.m4
    /usr/lib/sendmail-cf/domain/berkeley-only.m4
    /usr/lib/sendmail-cf/domain/generic.m4
    /usr/lib/sendmail-cf/feature
    /usr/lib/sendmail-cf/feature/accept_unqualified_senders.m4
    /usr/lib/sendmail-cf/feature/accept_unresolvable_domains.m4
    /usr/lib/sendmail-cf/feature/access_db.m4
    /usr/lib/sendmail-cf/feature/allmasquerade.m4
    /usr/lib/sendmail-cf/feature/always_add_domain.m4
    /usr/lib/sendmail-cf/feature/bestmx_is_local.m4
    /usr/lib/sendmail-cf/feature/bitdomain.m4
    /usr/lib/sendmail-cf/feature/blacklist_recipients.m4
    /usr/lib/sendmail-cf/feature/domaintable.m4
    /usr/lib/sendmail-cf/feature/genericstable.m4
    /usr/lib/sendmail-cf/feature/limited_masquerade.m4
    /usr/lib/sendmail-cf/feature/local_lmtp.m4
    /usr/lib/sendmail-cf/feature/local_procmail.m4
    /usr/lib/sendmail-cf/feature/loose_relay_check.m4
    /usr/lib/sendmail-cf/feature/mailertable.m4
    /usr/lib/sendmail-cf/feature/masquerade_entire_domain.m4
    /usr/lib/sendmail-cf/feature/masquerade_envelope.m4
    /usr/lib/sendmail-cf/feature/nocanonify.m4
    /usr/lib/sendmail-cf/feature/nodns.m4
    /usr/lib/sendmail-cf/feature/notsticky.m4
    /usr/lib/sendmail-cf/feature/nouucp.m4
    /usr/lib/sendmail-cf/feature/nullclient.m4
    /usr/lib/sendmail-cf/feature/promiscuous_relay.m4
    /usr/lib/sendmail-cf/feature/rbl.m4
    /usr/lib/sendmail-cf/feature/redirect.m4
    /usr/lib/sendmail-cf/feature/relay_based_on_MX.m4
    /usr/lib/sendmail-cf/feature/relay_entire_domain.m4
    /usr/lib/sendmail-cf/feature/relay_hosts_only.m4
    /usr/lib/sendmail-cf/feature/relay_local_from.m4
    /usr/lib/sendmail-cf/feature/smrsh.m4
    /usr/lib/sendmail-cf/feature/stickyhost.m4
    /usr/lib/sendmail-cf/feature/use_ct_file.m4
    /usr/lib/sendmail-cf/feature/use_cw_file.m4
    /usr/lib/sendmail-cf/feature/uucpdomain.m4
    /usr/lib/sendmail-cf/feature/virtusertable.m4
    /usr/lib/sendmail-cf/hack
    /usr/lib/sendmail-cf/hack/cssubdomain.m4
    /usr/lib/sendmail-cf/m4
    /usr/lib/sendmail-cf/m4/cf.m4
    /usr/lib/sendmail-cf/m4/cfhead.m4
    /usr/lib/sendmail-cf/m4/nullrelay.m4
    /usr/lib/sendmail-cf/m4/proto.m4
    /usr/lib/sendmail-cf/m4/version.m4
    /usr/lib/sendmail-cf/mailer
    /usr/lib/sendmail-cf/mailer/cyrus.m4
    /usr/lib/sendmail-cf/mailer/fax.m4
    /usr/lib/sendmail-cf/mailer/local.m4
    /usr/lib/sendmail-cf/mailer/mail11.m4
    /usr/lib/sendmail-cf/mailer/phquery.m4
    /usr/lib/sendmail-cf/mailer/pop.m4
    /usr/lib/sendmail-cf/mailer/procmail.m4
    /usr/lib/sendmail-cf/mailer/smtp.m4
    /usr/lib/sendmail-cf/mailer/usenet.m4
    /usr/lib/sendmail-cf/mailer/uucp.m4
    /usr/lib/sendmail-cf/ostype
    /usr/lib/sendmail-cf/ostype/aix2.m4
    /usr/lib/sendmail-cf/ostype/aix3.m4
    /usr/lib/sendmail-cf/ostype/aix4.m4
    /usr/lib/sendmail-cf/ostype/altos.m4
    /usr/lib/sendmail-cf/ostype/amdahl-uts.m4
    /usr/lib/sendmail-cf/ostype/aux.m4
    /usr/lib/sendmail-cf/ostype/bsd4.3.m4
    /usr/lib/sendmail-cf/ostype/bsd4.4.m4
    /usr/lib/sendmail-cf/ostype/bsdi1.0.m4
    /usr/lib/sendmail-cf/ostype/bsdi2.0.m4
    /usr/lib/sendmail-cf/ostype/dgux.m4
    /usr/lib/sendmail-cf/ostype/domainos.m4
    /usr/lib/sendmail-cf/ostype/dynix3.2.m4
    /usr/lib/sendmail-cf/ostype/gnuhurd.m4
    /usr/lib/sendmail-cf/ostype/hpux10.m4
    /usr/lib/sendmail-cf/ostype/hpux9.m4
    /usr/lib/sendmail-cf/ostype/irix4.m4
    /usr/lib/sendmail-cf/ostype/irix5.m4
    /usr/lib/sendmail-cf/ostype/irix6.m4
    /usr/lib/sendmail-cf/ostype/isc4.1.m4
    /usr/lib/sendmail-cf/ostype/linux.m4
    /usr/lib/sendmail-cf/ostype/maxion.m4
    /usr/lib/sendmail-cf/ostype/mklinux.m4
    /usr/lib/sendmail-cf/ostype/nextstep.m4
    /usr/lib/sendmail-cf/ostype/osf1.m4
    /usr/lib/sendmail-cf/ostype/powerux.m4
    /usr/lib/sendmail-cf/ostype/ptx2.m4
    /usr/lib/sendmail-cf/ostype/qnx.m4
    /usr/lib/sendmail-cf/ostype/riscos4.5.m4
    /usr/lib/sendmail-cf/ostype/sco-uw-2.1.m4
    /usr/lib/sendmail-cf/ostype/sco3.2.m4
    /usr/lib/sendmail-cf/ostype/sinix.m4
    /usr/lib/sendmail-cf/ostype/solaris2.m4
    /usr/lib/sendmail-cf/ostype/solaris2.ml.m4
    /usr/lib/sendmail-cf/ostype/powerux.m4
    /usr/lib/sendmail-cf/ostype/ptx2.m4
    /usr/lib/sendmail-cf/ostype/qnx.m4
    /usr/lib/sendmail-cf/ostype/riscos4.5.m4
    /usr/lib/sendmail-cf/ostype/sco-uw-2.1.m4
    /usr/lib/sendmail-cf/ostype/sco3.2.m4
    /usr/lib/sendmail-cf/ostype/sinix.m4
    /usr/lib/sendmail-cf/ostype/solaris2.m4
    /usr/lib/sendmail-cf/ostype/solaris2.ml.m4
    /usr/lib/sendmail-cf/ostype/sunos3.5.m4
    /usr/lib/sendmail-cf/ostype/sunos4.1.m4
    /usr/lib/sendmail-cf/ostype/svr4.m4
    /usr/lib/sendmail-cf/ostype/ultrix4.m4
    /usr/lib/sendmail-cf/ostype/unixware7.m4
    /usr/lib/sendmail-cf/ostype/unknown.m4
    /usr/lib/sendmail-cf/ostype/uxpds.m4
    /usr/lib/sendmail-cf/sh
    /usr/lib/sendmail-cf/sh/makeinfo.sh
    /usr/lib/sendmail-cf/siteconfig
    /usr/lib/sendmail-cf/siteconfig/uucp.cogsci.m4
    /usr/lib/sendmail-cf/siteconfig/uucp.old.arpa.m4
    /usr/lib/sendmail-cf/siteconfig/uucp.ucbarpa.m4
    /usr/lib/sendmail-cf/siteconfig/uucp.ucbvax.m4
    

As you can see all of these files get installed in /usr/lib/sendmail-cf/. If you plan to build macro configuration (.mc) files or sendmail.cf files on Red Hat Linux you should get used to this directory structure as it is essential to that process. As you can see by reading through what's included all of the hacks and features are included here and if you plan to do more than a default installation you will need these. It is this part of sendmail that people seem to have the most trouble with and yet, once you understand how it all works, building a configuration file with m4 is infinitely easier and much more duplicatable than directly editing the sendmail.cf file (a practice which we do not recommend and will not cover in this document).

2.2.3 sendmail-doc-8.9.3-15.i386.rpm

The third and final sendmail RPM in our trilogy contains the essential documentation for sendmail.

    Name        : sendmail-doc                 Relocations: (not relocateable)
    Version     : 8.9.3                             Vendor: Red Hat Software
    Release   : 15                      Build Date: Wed Sep  1 09:40:39 1999
    Install date: (not installed)    Build Host: porky.devel.redhat.com
    Group       : Documentation                 Source RPM: sendmail-8.9.3-15.src.rpm
    Size        : 1393365                          License: BSD
    Packager    : Red Hat Software <http://developer.redhat.com/bugzilla>
    Summary     : Documentation about the Sendmail Mail Transport Agent program.
    Description :
    The sendmail-doc package contains documentation about the Sendmail Mail Transport Agent (MTA) program, including release notes, the Sendmail FAQ and a few papers written about Sendmail.  The papers are provided in PostScript(TM) and troff formats.
    Install the sendmail-doc package if you need documentation about Sendmail.
    /usr/doc/sendmail
    /usr/doc/sendmail/FAQ
    /usr/doc/sendmail/KNOWNBUGS
    /usr/doc/sendmail/LICENSE
    /usr/doc/sendmail/README
    /usr/doc/sendmail/README.cf
    /usr/doc/sendmail/README.smrsh
    /usr/doc/sendmail/RELEASE_NOTES
    /usr/doc/sendmail/doc
    /usr/doc/sendmail/doc/changes
    /usr/doc/sendmail/doc/changes/Makefile
    /usr/doc/sendmail/doc/changes/changes.me
    /usr/doc/sendmail/doc/changes/changes.ps
    /usr/doc/sendmail/doc/intro
    /usr/doc/sendmail/doc/intro/Makefile
    /usr/doc/sendmail/doc/intro/intro.me
    /usr/doc/sendmail/doc/intro/intro.ps
    /usr/doc/sendmail/doc/op
    /usr/doc/sendmail/doc/op/Makefile
    /usr/doc/sendmail/doc/op/op.me
    /usr/doc/sendmail/doc/op/op.ps
    /usr/doc/sendmail/doc/usenix
    /usr/doc/sendmail/doc/usenix/Makefile
    /usr/doc/sendmail/doc/usenix/usenix.me
    /usr/doc/sendmail/doc/usenix/usenix.ps
    

As you can see the sendmail FAQ and other essential documentation is included here for your use. By default, the docs are installed in /usr/doc/sendmail. If you need it, the latest copy of the sendmail FAQ is always available at http://www.sendmail.org.

2.2.4 File Location Review

Now we've seen all three of the Red Hat Linux sendmail RPMs and their default file locations. Now we'll take a moment for a quick review about what's where.

Configuration files are located in /etc (sendmail.cf and aliases) and in /etc/mail (all of the map or .db files). The m4 configuration hacks and features are in /usr/lib/sendmail-cf and the documentation is located in /usr/doc/sendmail.