21. Mail Server Software
MTAs are the programs which transport mail from one machine to the other. The traditional MTA is Sendmail, however there are several other choices.
As well as SMTP servers there is a POP server (qpopper) and an IMAP server (Courier-IMAP).
21.1 Dovecot-2.3.20
Introduction to Dovecot
Dovecot is an Internet Message Access Protocol (IMAP) and Post Office Protocol (POP) server, written primarily with security in mind. Dovecot aims to be lightweight, fast and easy to set up as well as highly configurable and easily extensible with plugins.
This package is known to build and work properly using an LFS 11.3 platform.
Package Information
-
Download (HTTP): https://www.dovecot.org/releases/2.3/dovecot-2.3.20.tar.gz
-
Download MD5 sum: b8add62d0311dcc95ac25b379e8ba043
-
Download size: 7.4 MB
-
Estimated disk space required: 235 MB
-
Estimated build time: 4.8 SBU
Additional Downloads
-
Required patch: https://www.linuxfromscratch.org/patches/blfs/11.3/dovecot-2.3.20-openssl3_fixes-1.patch
-
Required patch: https://www.linuxfromscratch.org/patches/blfs/11.3/dovecot-2.3.20-security_fix-1.patch
Dovecot Dependencies
Required
Optional
CLucene-2.3.3.4, ICU-72.1, libcap-2.67 with PAM, Linux-PAM-1.5.2, Lua-5.4.4, MariaDB-10.6.12 or MySQL, OpenLDAP-2.6.4, PostgreSQL-15.2, SQLite-3.40.1, Valgrind-3.20.0, xfsprogs-6.1.1, Cassandra, lz4, stemmer and libsodium
User Notes: https://wiki.linuxfromscratch.org/blfs/wiki/dovecot
Installation of Dovecot
There should be dedicated users and groups for unprivileged Dovecot processes and for processing users’ logins. Issue the following commands as the root user:
groupadd -g 42 dovecot &&
useradd -c "Dovecot unprivileged user" -d /dev/null -u 42 \
-g dovecot -s /bin/false dovecot &&
groupadd -g 43 dovenull &&
useradd -c "Dovecot login user" -d /dev/null -u 43 \
-g dovenull -s /bin/false dovenull
First, apply a patch to fix problems with OpenSSL-3:
patch -Np1 -i ../dovecot-2.3.20-openssl3_fixes-1.patch
Next, apply a patch to fix a security vulnerability:
patch -Np1 -i ../dovecot-2.3.20-security_fix-1.patch
Install Dovecot by running the following commands:
CPPFLAGS="-I/usr/include/tirpc" \
LDFLAGS+=" -ltirpc" \
./configure --prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--docdir=/usr/share/doc/dovecot-2.3.20 \
--disable-static &&
make
To test the results, issue make -k check.
Now, as the root user:
make install
Command Explanations
CPPFLAGS=… LDFLAGS+=…: build with libtirpc instead of the recently removed RPC code provided by GlibC.
--disable-static: This switch prevents installation of static versions of the libraries.
--with-ldap: This switch enables OpenLDAP authentication support.
--with-pgsql: This switch enables PostgreSQL database support.
--with-mysql: This switch enables MySQL database support.
--with-sqlite: This switch enables SQLite database support.
--with-lucene: This switch enables CLucene full text search support.
--with-lua: This switch enables Lua plugin support. This includes a mail and push notification plugin.
Configuring Dovecot
Config Files
/etc/dovecot/dovecot.conf, /etc/dovecot/conf.d/*, and /etc/dovecot/local.conf
Configuration Information
Copy an example configuration, which you can use as a starting point:
cp -rv /usr/share/doc/dovecot-2.3.20/example-config/* /etc/dovecot
The following configuration is a simple proof of concept with IMAP service using local users for authentication and mailbox location. Reading files from the conf.d directory is commented out since the included example configuration requires OpenSSL and Linux PAM.
sed -i '/^\!include / s/^/#/' /etc/dovecot/dovecot.conf &&
chmod -v 1777 /var/mail &&
cat > /etc/dovecot/local.conf << "EOF"
protocols = imap
ssl = no
# The next line is only needed if you have no IPv6 network interfaces
listen = *
mail_location = mbox:~/Mail:INBOX=/var/mail/%u
userdb {
driver = passwd
}
passdb {
driver = shadow
}
EOF
You will definitely want to read the official documentation at https://wiki2.dovecot.org/ if you plan to use Dovecot in a production environment.
Systemd Unit
To start the dovecot daemon at boot, enable the previously installed systemd unit with the following command:
systemctl enable dovecot
Contents
Installed Programs: doveadm, doveconf, dovecot, dovecot-sysreport, and dsync (symbolic link)
Installed Libraries: various internal plugins in /usr/lib/dovecot
Installed Directories: /etc/dovecot, /usr/{include,lib,libexec,share}/dovecot and /usr/share/doc/dovecot-2.3.20
Short Descriptions
doveadm is the Dovecot administration tool.
doveconf is Dovecot’s configuration dumping utility.
dovecot is the IMAP and POP server.
dovecot-sysreport prints system information that is useful to the Dovecot developers when submitting bug reports upstream.
dsync is Dovecot’s mailbox synchronization utility.
21.2 Exim-4.96
Introduction to Exim
The Exim package contains a Mail Transport Agent written by the University of Cambridge, released under the GNU Public License.
This package is known to build and work properly using an LFS 11.3 platform.
Package Information
-
Download (HTTP): https://ftp.exim.org/pub/exim/exim4/exim-4.96.tar.xz
-
Download (FTP): ftp://ftp.exim.org/pub/exim/exim4/exim-4.96.tar.xz
-
Download MD5 sum: 0d10d5b10f2af77ec8c2c2fe5be6c1ad
-
Download size: 1.8 MB
-
Estimated disk space required: 20 MB
-
Estimated build time: 0.3 SBU
Additional Downloads
- Additional formats of the documentation (text-based docs are shipped with the sources) can be downloaded by following the links shown at https://exim.org/docs.html.
Exim Dependencies
Required
Optional
TDB (alternative to GDBM, built in LFS), Cyrus SASL-2.1.28, libidn-1.41, Linux-PAM-1.5.2, MariaDB-10.6.12 or MySQL, OpenLDAP-2.6.4, GnuTLS-3.8.0, PostgreSQL-15.2, SQLite-3.40.1, a graphical environment, Heimdal GSSAPI, and OpenDMARC
User Notes: https://wiki.linuxfromscratch.org/blfs/wiki/exim
Installation of Exim
Before building Exim, as the root user you should create the group and user exim which will run the exim daemon:
groupadd -g 31 exim &&
useradd -d /dev/null -c "Exim Daemon" -g exim -s /bin/false -u 31 exim
Configure Exim with the following commands:
sed -e 's,^BIN_DIR.*$,BIN_DIRECTORY=/usr/sbin,' \
-e 's,^CONF.*$,CONFIGURE_FILE=/etc/exim.conf,' \
-e 's,^EXIM_USER.*$,EXIM_USER=exim,' \
-e '/# SUPPORT_TLS=yes/s,^#,,' \
-e '/# USE_OPENSSL/s,^#,,' \
-e 's,^EXIM_MONITOR,#EXIM_MONITOR,' src/EDITME > Local/Makefile &&
printf "USE_GDBM = yes\nDBMLIB = -lgdbm\n" >> Local/Makefile &&
If you want to add Linux PAM support, also run the following commands:
sed -i '/# SUPPORT_PAM=yes/s,^#,,' Local/Makefile
echo "EXTRALIBS=-lpam" >> Local/Makefile
Build Exim with the following command:
make
This package does not come with a test suite.
Now, as the root user:
make install &&
install -v -m644 doc/exim.8 /usr/share/man/man8 &&
install -v -d -m755 /usr/share/doc/exim-4.96 &&
install -v -m644 doc/* /usr/share/doc/exim-4.96 &&
ln -sfv exim /usr/sbin/sendmail &&
install -v -d -m750 -o exim -g exim /var/spool/exim
Command Explanations
sed -e … > Local/Makefile: Most of Exim’s configuration options are defined in Local/Makefile, which is created from the src/EDITME file. This command specifies the minimum set of options. Descriptions for the options are listed below.
printf … > Local/Makefile: Setting those variables allows to use GDBM instead of the default Berkeley DB. Remove this command if you have installed Berkeley DB-5.3.28.
BIN_DIRECTORY=/usr/sbin: This installs all of Exim’s binaries and scripts in /usr/sbin.
CONFIGURE_FILE=/etc/exim.conf: This installs Exim’s main configuration file in /etc.
EXIM_USER=exim: This tells Exim that after the daemon no longer needs root privileges, the process needs to hand off the daemon to the exim user.
SUPPORT_TLS=yes: This allows to support STARTTLS connections. If you use this option, you need to select whether OpenSSL or GnuTLS is used (see src/EDITME).
USE_OPENSSL_PC=openssl: This tells the build system to use OpenSSL, and to find the needed libraries with pkg-config.
#EXIM_MONITOR: This defers building the Exim monitor program, as it requires X Window System support, by commenting out the EXIM_MONITOR line in the Makefile. If you wish to build the monitor program, omit this sed command and issue the following command before building the package (modify Local/eximon.conf, if necessary): cp exim_monitor/EDITME Local/eximon.conf.
ln -sfv exim /usr/sbin/sendmail: Creates a link to sendmail for applications which need it. Exim will accept most Sendmail command-line options.
install -v -m750 -o exim -g exim /var/spool/exim: Since /var/spool is owned by root and this version of exim drops root privileges early, to run as user exim, it cannot create the /var/spool/exim directory. As a work around, it is created manually.
Adding Additional Functionality
To utilize some or all of the dependency packages, you’ll need to modify Local/Makefile to include the appropriate directives and parameters to link additional libraries before you build Exim. Local/Makefile is heavily commented with instructions on how to do this. Listed below is additional information to help you link these dependency packages or add additional functionality.
If you wish to build and install the .info documentation, refer to https://exim.org/exim-html-4.96/doc/html/spec_html/ch04.html#SECTinsinfdoc.
If you wish to build in Exim’s interfaces for calling virus and spam scanning software directly from access control lists, uncomment the WITH_CONTENT_SCAN=yes parameter and review the information found at https://exim.org/exim-html-4.96/doc/html/spec_html/ch45.html.
To use a backend database other than GDBM , see the instructions at https://exim.org/exim-html-4.96/doc/html/spec_html/ch04.html#SECTdb.
For SSL functionality, see the instructions at https://exim.org/exim-html-4.96/doc/html/spec_html/ch04.html#SECTinctlsssl and https://exim.org/exim-html-4.96/doc/html/spec_html/ch42.html.
For tcpwrappers functionality, see the instructions at https://exim.org/exim-html-4.96/doc/html/spec_html/ch04.html#SECID27.
For information about adding authentication mechanisms to the build, see chapters 33—41 of https://exim.org/exim-html-4.96/doc/html/spec_html/index.html.
For information about linking Linux-PAM, refer to the instructions https://exim.org/exim-html-4.96/doc/html/spec_html/ch11.html#SECTexpcond.
For information about linking database engine libraries used for Exim name lookups, see the instructions at https://exim.org/exim-html-4.96/doc/html/spec_html/ch09.html.
If you wish to add Readline support to Exim when invoked in “test expansion” (-be) mode, see the information in the -be section of https://exim.org/exim-html-4.96/doc/html/spec_html/ch05.html#id2525974.
You may wish to modify the default configuration and send log files to syslog instead of the default /var/spool/exim/log directory. See the information at https://exim.org/exim-html-4.96/doc/html/spec_html/ch-log_files.html.
A wealth of information can be also found at the Exim Wiki.
Configuring Exim
Config Files
/etc/exim.conf and /etc/aliases
Configuration Information
Review the file /etc/exim.conf, and modify any settings to suit your needs. Note that the default configuration assumes that the /var/mail directory is world writable, but has the sticky bit set. If you want to use the default configuration, issue as the root user:
chmod -v a+wt /var/mail
A default (nothing but comments) /etc/aliases file is installed during the package installation if this file did not exist on your system. Create the necessary aliases and start the Exim daemon using the following commands:
cat >> /etc/aliases << "EOF"
postmaster: root
MAILER-DAEMON: root
EOF
/usr/sbin/exim -bd -q15m
Note
To protect an existing /etc/aliases file, the command above appends these aliases to it. This file should be checked and duplicate aliases removed, if present.
The /usr/sbin/exim -bd -q15m command starts the Exim daemon with a 15 minute interval in processing the mail queue. Adjust this parameter to suit your desires.
Linux PAM Configuration
If you have built Exim with Linux PAM support, you need to create a PAM configuration file to get it working correctly with BLFS.
Issue the following command as the root user to create the configuration file for Linux PAM:
cat > /etc/pam.d/exim << "EOF"
# Begin /etc/pam.d/exim
auth include system-auth
account include system-account
session include system-session
# End /etc/pam.d/exim
EOF
Systemd Unit
To automatically start exim at boot, install the exim.service unit included in the blfs-systemd-units-20220720 package:
make install-exim
Contents
Installed Programs: exicyclog, exigrep, exim, exim-4.96-2, exim_checkaccess, exim_dbmbuild, exim_dumpdb, exim_fixdb, exim_lock, exim_tidydb, eximstats, exinext, exipick, exiqgrep, exiqsumm, exiwhat, and optionally, eximon, eximon.bin, and sendmail (symlink)
Installed Libraries: None
Installed Directories: /usr/share/doc/exim-4.96 and /var/spool/exim
Short Descriptions
exicyclog cycles Exim log files.
exigrep searches Exim log files.
exim is a symlink to the exim-4.96-2 MTA daemon.
exim-4.96-2 is the Exim mail transport agent daemon.
exim_checkaccess states whether a given recipient address from a given host is acceptable or not.
exim_dbmbuild creates and rebuilds Exim databases.
exim_dumpdb writes the contents of Exim databases to the standard output.
exim_fixdb modifies data in Exim databases.
exim_lock locks a mailbox file.
exim_tidydb removes old records from Exim databases.
eximstats generates mail statistics from Exim log files.
exinext queries remote host retry times.
exipick selects messages based on various criteria.
exiqgrep is a utility for selective queue listing.
exiqsumm produces a summary of the messages in the mail queue.
exiwhat queries running Exim processes.
eximon is a start-up shell script for eximon.bin used to set the required environment variables before running the program.
eximon.bin is a monitor program which displays current information in an X window, and also contains a menu interface to Exim’s command line administration options.
21.3 Postfix-3.7.4
Introduction to Postfix
The Postfix package contains a Mail Transport Agent (MTA). This is useful for sending email to other users of your host machine. It can also be configured to be a central mail server for your domain, a mail relay agent or simply a mail delivery agent to your local Internet Service Provider.
This package is known to build and work properly using an LFS 11.3 platform.
Package Information
-
Download (HTTP): https://ghostarchive.org/postfix/postfix-release/official/postfix-3.7.4.tar.gz
-
Download (FTP): ftp://ftp.porcupine.org/mirrors/postfix-release/official/postfix-3.7.4.tar.gz
-
Download MD5 sum: 2442d1e53d58e61842d99fb5978fec4a
-
Download size: 4.6 MB
-
Estimated disk space required: 148 MB
-
Estimated build time: 0.2 SBU (Using parallelism=4)
Postfix Dependencies
Recommended
Berkeley DB-5.3.28, Cyrus SASL-2.1.28, and libnsl-2.0.0
Optional
ICU-72.1 for Email Address Internationalization (SMTPUTF8) support, MariaDB-10.6.12 or MySQL, OpenLDAP-2.6.4, PCRE-8.45, PostgreSQL-15.2, SQLite-3.40.1, and CDB or TinyCDB
Note that SQLite, MySQL, PostgreSQL and CDB are only useful if there is a known need for them.
User Notes: https://wiki.linuxfromscratch.org/blfs/wiki/postfix
Installation of Postfix
Adding Users and Groups
Before you compile the program, you need to create users and groups that will be expected to be in place during the installation. Add the users and groups with the following commands issued by the root user:
groupadd -g 32 postfix &&
groupadd -g 33 postdrop &&
useradd -c "Postfix Daemon User" -d /var/spool/postfix -g postfix \
-s /bin/false -u 32 postfix &&
chown -v postfix:postfix /var/mail
Configuring the Build
The README files are formatted to be read with a pager like Less or More. If you want to use a text editor, make them legible with the following sed:
sed -i 's/.\x08//g' README_FILES/*
The Makefile looks at the running kernel to decide how to set various things. It does not recognize Linux-6 and fails to make the definitions. After that is fixed, the build references the newly defined version in a header, which also breaks the build. Fix both of these with the following commands:
sed -i 's/Linux..345/&6/' makedefs &&
sed -i 's/LINUX2/LINUX6/' src/util/sys_defs.h
The Postfix source tree does not contain a configure script, rather the makefile in the top-level directory contains a makefiles target that regenerates all the other makefiles in the build tree. If you wish to use additional software such as a database back-end for virtual users, or TLS/SSL authentication, you will need to regenerate the makefiles using one or more of the appropriate CCARGS and AUXLIBS settings listed below.
Note
For all variants of the CCARGS you should ensure that -DNO_NIS is specified so that the build does not attempt to access an rpcsvc header which does not exist in BLFS.
For more details read the readme files.
Cyrus-SASL
To use Cyrus-SASL with Postfix, use the following arguments:
CCARGS='-DNO_NIS -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/include/sasl'
AUXLIBS='-lsasl2'
OpenLDAP
To use OpenLDAP with Postfix, use the following arguments:
CCARGS='-DNO_NIS -DHAS_LDAP'
AUXLIBS='-lldap -llber'
Sqlite
To use Sqlite with Postfix, use the following arguments:
CCARGS='-DNO_NIS -DHAS_SQLITE'
AUXLIBS='-lsqlite3 -lpthread'
MySQL
To use MySQL with Postfix, use the following arguments:
CCARGS='-DNO_NIS -DHAS_MYSQL -I/usr/include/mysql'
AUXLIBS='-lmysqlclient -lz -lm'
PostgreSQL
To use PostgreSQL with Postfix, use the following arguments:
CCARGS='-DNO_NIS -DHAS_PGSQL -I/usr/include/postgresql'
AUXLIBS='-lpq -lz -lm'
CDB/TinyCDB
To use CDB or TinyCDB with Postfix, use the following arguments:
CCARGS='-DNO_NIS -DHAS_CDB'
AUXLIBS='</path/to/CDB>/libcdb.a'
StartTLS Authentication
To use OpenSSL with Postfix, use the following arguments:
CCARGS='-DNO_NIS -DUSE_TLS -I/usr/include/openssl/'
AUXLIBS='-lssl -lcrypto'
Installing Postfix
Adjust the following according to your needs. For example, if you have Cyrus SASL, install Postfix by running the following commands:
make CCARGS="-DNO_NIS -DUSE_TLS -I/usr/include/openssl/ \
-DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/include/sasl" \
AUXLIBS="-lssl -lcrypto -lsasl2" \
makefiles &&
make
This package does not come with a useful test suite.
Now, as the root user:
sh postfix-install -non-interactive \
daemon_directory=/usr/lib/postfix \
manpage_directory=/usr/share/man \
html_directory=/usr/share/doc/postfix-3.7.4/html \
readme_directory=/usr/share/doc/postfix-3.7.4/readme
Command Explanations
make makefiles: This command rebuilds the makefiles throughout the source tree to use the options contained in the CCARGS and AUXLIBS variables.
sh postfix-install -non-interactive: This keeps the install script from asking any questions, thereby accepting default destination directories in all but the few cases. If the html_directory and readme_directory options are not set then the documentation will not be installed.
CCARGS="-DNO_EAI ...": this will turn off SMTPUTF8 support, for example if the rest of your email address infrastructure cannot handle UTF-8 email addresses and message header values.
Configuring Postfix
Config Files
/etc/aliases, /etc/postfix/main.cf, and /etc/postfix/master.cf
Configuration Information
Create (or append to an existing) /etc/aliases with the following command. Change <LOGIN> to your non-root login identity so mail addressed to root can be forwarded to you. As the root user:
cat >> /etc/aliases << "EOF"
# Begin /etc/aliases
MAILER-DAEMON: postmaster
postmaster: root
root: <LOGIN>
# End /etc/aliases
EOF
To protect an existing /etc/aliases file, the above command appends these aliases to it if it exists. This file should be checked and duplicate aliases removed, if present.
Note
The /etc/postfix/main.cf and /etc/postfix/master.cf files must be personalized for your system. The main.cf file needs your fully qualified hostname. You will find that main.cf is self documenting, so load it into your editor to make the changes you need for your situation.
Note
Postfix can also be set up to run in a chroot jail. See the file in the source examples/chroot-setup/LINUX2 for details.
If you have an existing configuration, you can run the postfix utility to add any necessary definitions to your existing files. As the root user:
/usr/sbin/postfix upgrade-configuration
Before starting Postfix, you should check that your configuration and file permissions will work properly. Run the following commands as the root user to check and start your Postfix server:
/usr/sbin/postfix check &&
/usr/sbin/postfix start
Systemd Unit
To automate the running of Postfix at startup, install the postfix.service unit included in the blfs-systemd-units-20220720 package:
make install-postfix
Contents
Installed Programs: mailq (symlink), newaliases (symlink), postalias, postcat, postconf, postdrop, postfix, postkick, postlock, postlog, postmap, postmulti, postqueue, postsuper, and sendmail
Installed Libraries: None
Installed Directories: /{etc,usr/lib}/postfix, /usr/share/doc/postfix-3.7.4 and /var/{lib,spool}/postfix
Short Descriptions
mailq A symlink to sendmail.
newaliases A symlink to sendmail.
postalias is a utility for Postfix alias database maintenance.
postcat Prints the contents of files from the Postfix queue in human readable format.
postconf Displays or changes the value of Postfix configuration parameters.
postdrop Creates a file in the maildrop directory and copies its standard input to the file.
postfix is the Postfix control program.
postkick Sends requests to the specified service over a local transport channel.
postlock Locks a mail folder for exclusive use, and executes commands passed to it.
postlog A Postfix-compatible logging interface for use in, for example, shell scripts.
postmap Creates or queries one or more Postfix lookup tables, or updates an existing one.
postmulti is the Postfix multi-instance manager. It allows a system administrator to manage multiple Postfix instances on a single host.
postqueue The Postfix user interface for queue management.
postsuper The Postfix user interface for superuser queue management.
sendmail is the Postfix to Sendmail compatibility interface.
21.4 sendmail-8.17.1
Introduction to sendmail
The sendmail package contains a Mail Transport Agent (MTA).
This package is known to build and work properly using an LFS 11.3 platform.
Package Information
-
Download (HTTP): https://ftp.sendmail.org/sendmail.8.17.1.tar.gz
-
Download (FTP): ftp://ftp.sendmail.org/pub/sendmail/sendmail.8.17.1.tar.gz
-
Download MD5 sum: cd3c3f7b2db60c362f07eecbebd99bf4
-
Download size: 2.2 MB
-
Estimated disk space required: 20 MB
-
Estimated build time: 0.2 SBU
sendmail Dependencies
Required
OpenLDAP-2.6.4 (client)
Recommended
Optional
ghostscript-10.00.0 (for creating PDF documentation), Procmail-3.22 (the configuration proposed below requires that procmail be present at run-time), and nph
User Notes: https://wiki.linuxfromscratch.org/blfs/wiki/sendmail
Installation of sendmail
Before building sendmail, create the required user, group and directory with the following commands issued as the root user:
groupadd -g 26 smmsp &&
useradd -c "Sendmail Daemon" -g smmsp -d /dev/null \
-s /bin/false -u 26 smmsp &&
chmod -v 1777 /var/mail &&
install -v -m700 -d /var/spool/mqueue
Note
See the source tree sendmail/README file for information on linking optional packages into the build. Use the example below, which adds support for SASL, StartTLS (OpenSSL) and OpenLDAP, as a starting point. Of course, modify it to suit your particular needs.
cat >> devtools/Site/site.config.m4 << "EOF"
APPENDDEF(`confENVDEF',`-DSTARTTLS -DSASL -DLDAPMAP -DHASFLOCK')
APPENDDEF(`confLIBS', `-lssl -lcrypto -lsasl2 -lldap -llber -ldb')
APPENDDEF(`confINCDIRS', `-I/usr/include/sasl')
EOF
Install sendmail with the following commands:
cat >> devtools/Site/site.config.m4 << "EOF"
define(`confMANGRP',`root')
define(`confMANOWN',`root')
define(`confSBINGRP',`root')
define(`confUBINGRP',`root')
define(`confUBINOWN',`root')
EOF
sed -i 's|/usr/man/man|/usr/share/man/man|' \
devtools/OS/Linux &&
cd sendmail &&
sh Build &&
cd ../cf/cf &&
cp generic-linux.mc sendmail.mc &&
sh Build sendmail.cf
This package does not come with a test suite.
Now, as the root user:
install -v -d -m755 /etc/mail &&
sh Build install-cf &&
cd ../.. &&
sh Build install &&
install -v -m644 cf/cf/{submit,sendmail}.mc /etc/mail &&
cp -v -R cf/* /etc/mail &&
install -v -m755 -d /usr/share/doc/sendmail-8.17.1/{cf,sendmail} &&
install -v -m644 CACerts FAQ KNOWNBUGS LICENSE PGPKEYS README RELEASE_NOTES \
/usr/share/doc/sendmail-8.17.1 &&
install -v -m644 sendmail/{README,SECURITY,TRACEFLAGS,TUNING} \
/usr/share/doc/sendmail-8.17.1/sendmail &&
install -v -m644 cf/README /usr/share/doc/sendmail-8.17.1/cf &&
for manpage in sendmail editmap mailstats makemap praliases smrsh
do
install -v -m644 $manpage/$manpage.8 /usr/share/man/man8
done &&
install -v -m644 sendmail/aliases.5 /usr/share/man/man5 &&
install -v -m644 sendmail/mailq.1 /usr/share/man/man1 &&
install -v -m644 sendmail/newaliases.1 /usr/share/man/man1 &&
install -v -m644 vacation/vacation.1 /usr/share/man/man1
Install the sendmail Installation and Operations Guide with the following commands:
Note
Remove op.pdf from the make and install commands below if you don’t have Ghostscript installed.
cd doc/op &&
sed -i 's/groff/GROFF_NO_SGR=1 groff/' Makefile &&
make op.txt op.pdf
Now, as the root user:
install -v -d -m755 /usr/share/doc/sendmail-8.17.1 &&
install -v -m644 op.ps op.txt op.pdf /usr/share/doc/sendmail-8.17.1 &&
cd ../..
Command Explanations
cat > devtools/Site/site.config.m4 « “EOF”: This creates a configuration file changing some of the default settings.
sed … devtools/OS/Linux: The site.config.m4 does not honor a change to the man directory, so fix it in the OS definitions.
sh Build; sh Build sendmail.cf; sh Build install-cf; sh Build install: sendmail uses an m4 based build script to create the various Makefiles. These commands build and install the package.
for manpage in…;do…;done; install …: The man pages are installed already formatted and man displays them somewhat garbled. These commands replace the formatted pages with pages man can display properly.
Configuring sendmail
Config Files
/etc/mail/*
Configuration Information
Note
Ensure you have a fully qualified domain name defined in /etc/hosts for your system before proceeding.
Create the /etc/mail/local-host-names and /etc/mail/aliases files using the following commands as the root user:
echo $(hostname) > /etc/mail/local-host-names
cat > /etc/mail/aliases << "EOF"
postmaster: root
MAILER-DAEMON: root
EOF
newaliases
sendmail’s primary configuration file, /etc/mail/sendmail.cf, is complex and not meant to be directly edited. The recommended method for changing it is to modify /etc/mail/sendmail.mc and various m4 files, then run the m4 macro processor from within /etc/mail as follows:
cd /etc/mail &&
m4 m4/cf.m4 sendmail.mc > sendmail.cf
A full explanation of the files to modify, and the available parameters can be found in /etc/mail/README.
Systemd Unit
To automate the running of sendmail at startup, install the sendmail.service unit included in the blfs-systemd-units-20220720 package:
make install-sendmail
Note
The -qNm option to sendmail, where N is number of minutes, controls how often sendmail will process the mail queue. A default of 5 minutes is used in the systemd unit. Individual workstation users may want to set this as low as 1 minute, large installations handling more mail may want to set it higher.
Contents
Installed Programs: editmap, mailstats, makemap, praliases, sendmail, smrsh, and vacation; symlinks to /usr/sbin/sendmail: hoststat, mailq, newaliases, and purgestat
Installed Libraries: None
Installed Directories: /etc/mail, /usr/share/doc/sendmail-8.17.1, and /var/spool/clientmqueue
Short Descriptions
editmap queries and edits sendmail map files.
hoststat prints sendmail’s persistent host status.
mailstats displays sendmail statistics.
mailq prints a summary of outbound mail messages waiting for delivery.
makemap creates sendmail map files.
newaliases rebuilds /etc/mail/aliases.db from the contents of /etc/mail/aliases.
praliases displays current sendmail aliases.
purgestat causes sendmail to clear (purge) all its host-status information.
sendmail is the sendmail mail transport agent.
smrsh is a restricted shell for sendmail.
vacation is an email auto responder.