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 main.cf(?) localdomain /* smtp5.inter.nl.net */

relayhost = mail.relay.isp.com

nano /etc/postfix/main.cf 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 (http://www.idealog.us/2004/10/helpful_guide_t.html)

"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

http://linux.die.net/man/7/authpam 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'. http://blog.desgrange.net/2009/03/16/mail-story-1-debian-postfix-smtp-courier-imap-ssl/ 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 /* imap.pcprobleemloos.nl

#TLS_CERTFILE=/etc/courier/imapd.pem TLS_CERTFILE=/etc/courier/imap.pcprobleemloos.nl.pem */


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

  • allow incoming 25 for all
  • allow incoming 993 for all
  • allow incoming 143 for all
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

/* http://forums.whirlpool.net.au/archive/788328 LDAP authentication with courier-imap - Linux/BSD

http://www.ufsdump.org/papers/courier-imap-centos-4.html Building A Reliable Open Source Mail Server for CentOS 4

maildirmake ~/Maildir IPv6? http://www.courier-mta.org/install.html#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.

vm-mail.txt · Last modified: 2017/01/19 00:50 (external edit)

Page Tools