Mail server configuration

Mail server configuration requires administrator knowledge. Please do remind that the proposed configuration files may not work for your system and for your network configuration.

VHFFS suggests Exim4 SMTP and Courier POP&IMAP software and provides configuration examples for those. Obviously you can use the software you want and use this documentation to help you.


Exim is a Mail Transfer Agent. Exim needs the Exim Heavy daemon on Debian in order to work with PostgreSQL.

Install the following packets:

apt-get install exim4-daemon-heavy

Sample configuration:



addgroup --gid 2000 listengine
adduser --uid 2000 --gid 2000 --no-create-home --disabled-login --shell /bin/false --gecos '' listengine
mkdir /data/mail/{,boxes,archives} /data/listengine/{,archives,errors,moderation,public}
chown Debian-exim:Debian-exim /data/mail/boxes
chown listengine:listengine /data/listengine/{archives,errors,moderation}
chmod 700 /data/mail/{boxes,archives} /data/listengine/{archives,errors,moderation}
mv /etc/exim4/exim4.conf{,.orig}
cp /usr/share/doc/vhffs/config/exim4-mx1/exim4.conf /etc/exim4/exim4.conf

And modify /etc/exim4/exim4.conf according to your needs. Then reload exim4.


Courier is the IMAP/POP server used to access mailboxes. It uses the VHFFS databases to check the users, thus it needs a read access to the VHFFS databases.

Install the following packets:

apt-get install courier-authdaemon courier-authlib-postgresql courier-imap courier-imap-ssl courier-pop courier-pop-ssl

In /usr/share/doc/vhffs/config/courier, you will find configuration samples for following Courier files:

  • authdaemonrc
  • authpgsqlrc
  • imapd
  • imapd-ssl
  • pop3d
  • pop3d-ssl

Copy these files into /etc/courier/ and perform the modifications you need in order to access the vhffs database.

Then reload all courier-related softwares.

Backup MX

This is always a good idea to have a backup MX server. A backup MX server is a server that is going to buffer your mails if your primary MX is down (Network outage, hardware failure, configuration error, …).

On your secondary server, install the following packets:

apt-get install exim4-daemon-heavy

Sample configuration:


Then, you have to duplicate the VHFFS database, you can either use a PostgreSQL replication mechanism or use our mirror script.

Using a VHFFS replicated PostgreSQL database

After PostgreSQL replication is configured, modify /etc/exim4/exim4.conf according to your needs. Then reload exim4.

Using the mirror script

Copy the MX2 mirror script in some place.

cp /usr/share/vhffs/backend/mirror/ /usr/local/sbin/
chmod o-rwx /usr/local/sbin/ 
chmod ug+x /usr/local/sbin/

Create the PostgreSQL secondary database and structures

su - postgres -c "createuser -P mailmx2"
su - postgres -c "createdb -O mailmx2 mailmx2"
psql mailmx2 mailmx2 -h localhost
eximmx2=> \i /usr/share/vhffs/backend/mirror/mx2-mirror.sql

Edit the script to modify connection fields to both master and slave SQL servers.

Install required dependencies:

apt-get install libdbd-pg-perl

Modify your firewall or anything necessary so that the slave server can connect to the master server.

Then run the script, it should work


Modify /etc/exim4/exim4.conf to use this database. Then reload exim4.

Of course, you need to run from time to time the script to update the PostgreSQL database, we let you add the necessary cron entry.

As you may have noticed, the mirror script don't need the VHFFS API to run, so you don't need to install VHFFS on hosts that are going to be secondary MX

doc/installationguide/mail-service.txt · Last modified: 2011/04/20 23:06 by gradator
Recent changes RSS feed Creative Commons License Donate Minima Template by Wikidesign Driven by DokuWiki