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).

Postfix-2.1.5

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 (ISP).

Package information

Installation of Postfix

Configuring the build

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.

Here is an example that combines the TLS/SSL and Cyrus-SASL arguments:

make makefiles \
CCARGS="-DHAS_SSL -DUSE_SASL_AUTH -I/usr/include/openssl -I/usr/include/sasl" \
AUXLIBS="-L/usr/lib -R/usr/lib -lssl -lcrypto -lsasl2"
SSL/TLS authentication

To use SSL/TLS authentication with Postfix, you will first need to apply a patch availible from ftp://ftp.aet.tu-cottbus.de/pub/postfix_tls/pfixtls-0.8.18-2.1.3-0.9.7d.tar.gz. Unzip the patch tarball, and apply it with the following commands:

patch -p1 < ../pfixtls-0.8.18-2.1.3-0.9.7d/pfixtls.diff

You will need to pass the following values to the make makefiles command:

CCARGS="-DHAS_SSL -I/usr/include/openssl" \
AUXLIBS="-L/usr/lib -lssl -lcrypto"

To use SSL or TLS you will also need Cyrus SASL-2.1.20.

Cyrus-SASL

To use Cyrus-SASL with Postfix, use the following arguments:

CCARGS="-DUSE_SASL_AUTH -I/usr/include/sasl" \
AUXLIBS="-L/usr/lib -R/usr/lib -lsasl2"
OpenLDAP

To use OpenLDAP with Postfix, use the following arguments:

CCARGS="-I/usr/include -DHAS_LDAP" \
AUXLIBS="-L/usr/lib -lldap -llber"
MySQL

To use MySQL with Postfix, use the following arguments:

CCARGS="-DHAS_MYSQL -I/usr/include/mysql" \
AUXLIBS="-L/usr/lib -lmysqlclient -lz -lm"
PostgreSQL

To use PostgreSQL with Postfix, use the following arguments:

CCARGS="-DHAS_PGSQL -I/usr/include/postgresql" \
AUXLIBS="-L/usr/lib -lpq -lz -lm"

Installing Postfix

Before you compile the program, you need to create users and groups that will be expected to be in place when the install script executes. Add the users and groups with the following commands:

groupadd postfix &&
groupadd postdrop &&
groupadd -g 65534 nogroup &&
useradd -c postfix -d /dev/null -g postfix -s /bin/false postfix &&
useradd -c nobody -d /home -g nogroup -s /bin/bash -u 65534 nobody &&
chown postfix:postfix /var/mail

Install Postfix by running the following commands:

make &&
sh postfix-install daemon_directory=/usr/sbin \
                   manpage_directory=/usr/share/man \
                   sample_directory=/usr/share/doc/postfix \
                   -non-interactive

The final installation step is to install the program's documentation with the following commands:

install -d /usr/share/doc/postfix &&
cp -rf html/* /usr/share/doc/postfix

Command explanations

sh postfix-install ... -non-interactive : This keeps the install script from asking any questions, thereby accepting default destination directories in all but the three cases explicitly mentioned.

make makefiles : This command rebuilds the makefiles throughout the source tree to use the options contained in the CCARGS and AUXLIBS variables.

Configuring Postfix

Config files

/etc/aliases, /etc/postfix/main.cf and /etc/postfix/master.cf

Configuration Information

cat >> /etc/aliases << "EOF"
# Begin /etc/aliases

MAILER-DAEMON:    postmaster
postmaster:       root

root:             LOGIN
# End /etc/aliases
EOF
[Note]

Note

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.

The /etc/aliases file that was just created or appended, the main.cf and the master.cf must be personalized for your system. The aliases file needs your non-root login identity so mail addressed to root can be forwarded to you at the user level. The main.cf file needs your fully qualified hostname. All of these edits can be done with sed commands entered into the console with appropriate substitutions of your non-root login name for [user] and your fully qualified hostname for [localhost.localdomain]. You will find the main.cf file is self documenting, so load it into your editor to make the changes you need for your situation.

sed -i "s/LOGIN/[user]/" /etc/aliases &&
sed -i "s/#myhostname = host.domain.tld/myhostname = \ 
        [localhost.localdomain]/" /etc/postfix/main.cf &&
/usr/bin/newaliases &&
/usr/sbin/postfix start

Postfix init.d script

To automate the running of Postfix at startup, install the /etc/rc.d/init.d/postfix init script included in the blfs-bootscripts-6.0 package.

make install-postfix

Contents

Installed Programs: bounce, cleanup, error, flush, lmtp, local, mailq, master, newaliases, nqmgr, oqmgr, pickup, pipe, postalias, postcat, postconf, postdrop, postfix, postkick, postlock, postlog, postmap, postqueue, postsuper, proxymap, qmgr, qmqpd, sendmail, showq, smtp, smtpd, spawn, trivial-rewrite, verify, and virtual
Installed Libraries: None
Installed Directories: /etc/postfix and /usr/share/doc/postfix

Short Descriptions

bounce

A daemon that maintains per-message log files with non-delivery status information.

cleanup

A daemon that processes inbound mail, inserts it into the incoming mail queue, and informs the queue manager of its arrival.

error

A deamon that processes non-delivery requests from the queue manager.

flush

A daemon that maintains a record of deferred mail by destination.

lmtp

A daemon that processes message delivery requests from the queue manager.

local

A daemon that processes delivery requests from the queue manager to deliver mail to local recipients.

mailq

A symlink to sendmail.

master

The resident process that runs Postfix daemons on demand.

newaliases

A symlink to sendmail.

nqmgr

A daemon that awaits the arrival of incoming mail and arranges for its delivery.

oqmgr

The old style queue manager. This will be removed soon.

pickup

A daemon that waits for hints that new mail has been dropped into the maildrop directory, and feeds it into the cleanup daemon.

pipe

A daemon that processes requests from the queue manager to deliver messages to external commands.

postalias

Creates or queries one or more Postfix alias databases, or updates an existing one.

postcat

Prints the contents of the named files in human readable format.

postconf

Displays or changes the value of Postfix configuration parameters.

postdrop

Creates a file in the maildrop directory and copies it's standard input to the file.

postfix

Controls the operation of the Postfix mail system.

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.

postqueue

The Postfix user interface for queue management.

postsuper

The Postfix user interface for superuser queue management.

proxymap

Provides read-only table lookup services to other Postfix processes.

qmgr

A daemon that awaits the arrival of incoming mail and arranges for its delivery.

qmqpd

A daemon that receives one message per connection, and pipes it through the cleanup daemon, and places it into the incoming queue.

sendmail

The Postfix to Sendmail compatibility interface.

showq

A daemon that reports the Postfix mail queue status.

smtp

Looks up a list of mail exchanger addresses for the destination host, sorts the list by preference, and connects to each listed address until it finds a server that responds.

smtpd

Accepts network connection requests and performs zero or more SMTP transactions per connection.

spawn

Listens on a port as specified in the Postfix master.cf file and spawns an external command whenever a connection is established.

trivial-rewrite

A daemon that rewrites addresses to standard form.

verify

Maintains a record of what recipient addresses are known to be deliverable or undeliverable.

virtual

Delivers mail to virtual user's mail directories.