Table of Contents

vm-mail [postfix, courier-imap(+SSL), procmail, spamassassin

My virtual server is called vm-mail and here I'll show you how to install and configure the software I installed.

I'll install the following software:

Setting up a mailserver inside a LXC container



apt-get install postfix

Configuration: postfix relay host, file localdomain /* */

relayhost =

nano /etc/postfix/ changed smtpd_banner to something else (without the domain name etc, don't want to give out information)

Courier IMAP + SSL

apt-get install courier-imap-ssl courier-imap (

"By default IMAP and IMAP over SSL processes are started but I don’t want the first one. To disable the standard IMAP process, set IMAPDSTART to NO in /etc/courier/imapd."

courier webbased admin enabled authlib - Courier Authentication Library authpwd authenticates from the /etc/passwd file. authshadow like authpwd except passwords are read from /etc/shadow authldap authenticates against a list of mail accounts stored in an external LDAP directory. The /usr/lib/courier-imap/etc/authldaprc configuration file defines the particular details regarding the LDAP directory layout

nano /etc/courier/imapd

Edit the following:

# MAILDIRPATH - directory name of the maildir directory.

Adding a user for IMAP delivery

Add the user to the system: adduser «imap_username»

Make a 'Maildir' folder structure in the user's home folder:

cd /home/<<imap_username>>
su <<imap_username>>
maildirmake Maildir
maildirmake -f Spam Maildir

(The last step, the creation of a '.Spam' folder was optional)

Test the IMAP server using telnet

Linux Questions: Testing IMAP via telnet

telnet <imap_server_ip> 143
1 login imap_username imap_password
* OK [ALERT] Filesystem notification initialization error -- contact your mail administrator (check for configuration errors with the FAM/Gamin library)

Ah, something wrong with 'file system change - notifications'. says: "A quick solution to solve that is to replace FAM with Gamin:"

apt-get install gamin

Tried it again, and the problem was solved.

IMAP over secure SSL connection (imaps)

Create/ verkrijg(?) /etc/courier/imapd.pem voor imap-ssl certificate /*

#TLS_CERTFILE=/etc/courier/imapd.pem TLS_CERTFILE=/etc/courier/ */


squirrelmail: webbased imap


apt-get install mutt ca-certificates

The package 'ca-certificates' hold the root certificate for my officially signed mail server ssl certificate.

Firewall configuration

iptables -A INPUT -p tcp -i eth0 --dport 25 -m state --state NEW -j ACCEPT
iptables -A INPUT -p tcp -i eth0 --dport 143 -m state --state NEW -j ACCEPT
iptables -A INPUT -p tcp -i eth0 --dport 993 -m state --state NEW -j ACCEPT


apt-get install procmail

TODO: procmail configure the filter


TODO: spamfilter spamassassin

/* LDAP authentication with courier-imap - Linux/BSD Building A Reliable Open Source Mail Server for CentOS 4

maildirmake ~/Maildir IPv6? todo chroot jail mail/imap user?: "DenyUsers fwadmin" in /etc/sshd_config. Yes, this is an OpenSSH question and is covered in the manpage sshd(8). (Don't forget to put "fwadmin" in /etc/ftpusers) */

Please leave feedback or questions at the main page.