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.
The BLFS editors recommend to use LMDB instead of Berkeley DB for
Postfix tables. Add three lines into /etc/postfix/main.cf
to make postmap encode the lookup
tables in the LMDB format by default and to change the default
hash setting of the alias tables:
echo 'default_database_type = lmdb' >> /etc/postfix/main.cf &&
echo 'alias_database = lmdb:/etc/aliases' >> /etc/postfix/main.cf &&
echo 'alias_maps = lmdb:/etc/aliases' >> /etc/postfix/main.cf
To protect your server against the recent SMTP smuggling attacks,
additional steps are required. Add two lines into /etc/postfix/main.cf
to disconnect remote SMTP
clients that send bare newlines in the DATA section, while also
allowing clients on your network with non-standard SMTP
implementations to still send mail:
echo 'smtpd_forbid_bare_newline = normalize' >> /etc/postfix/main.cf &&
echo 'smtpd_forbid_bare_newline_exclusions = $mynetworks' >> /etc/postfix/main.cf
Note that if you are following an online tutorial to configure
Postfix, the tutorial may refer to a lookup table with
hash:/path/to/lookup_table
. You
should replace hash
with
lmdb
in order to use a lookup table
encoded in the LMDB format.
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.
To ensure that all permissions are set properly, postfix provides a tool which is to be run
as the root
user:
/usr/sbin/postfix -c /etc/postfix set-permissions
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