Table of Contents
Mail server 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
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:
/usr/share/doc/vhffs/config/exim4-mx1/exim4.conf
Then:
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
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:
/usr/share/doc/vhffs/config/exim4-mx2/exim4.conf
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/mx2-mirror.pl /usr/local/sbin/ chmod o-rwx /usr/local/sbin/mx2-mirror.pl chmod ug+x /usr/local/sbin/mx2-mirror.pl
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 mx2-mirror.pl
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 mx2-mirror.pl
script, it should work
/usr/local/sbin/mx2-mirror.pl
Modify /etc/exim4/exim4.conf
to use this database. Then reload exim4
.
Of course, you need to run from time to time the mx2-mirror.pl
script to update the PostgreSQL database, we let you add the necessary cron entry.