On this post I will explain how to set-up an e-mail server on Debian using Postfix, Cyrus, Courier, PAM, PostfixAdmin and Roundcube. I’m not going to explain nothing completely new or revolutionary neither reinvent the wheel. To be clear, what I did to implement the server was following this guide: Simple Virtual User Mail System. But, it’s for Arch Linux, so if we want it to work on Debian there are several changes that we have to take into account. So, instead of repeating everything, I will just highlight the changes.
Installation
The packages I installed were:
gamin postfix postfix-mysql courier-imap courier-imap-ssl libsasl2-2 libsasl2-modules php-auth-sasl sasl2-bin libpam-mysql
I think that these are enough (with its dependences) to get a working system. I’m not 100% sure because I documented this part a posteriori, after playing a bit around installing/uninstalling things.
Configuration
Postfix
On /etc/postfix/master.cf I used:
submission inet n - - - - smtpd -o smtpd_tls_security_level=encrypt -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticated,reject -o milter_macro_daemon_name=ORIGINATING
The file /etc/postfix/transport did not exist, so before
postmap /etc/postfix/transport
I did
touch /etc/postfix/transport
Courier
All the references to
/etc/authlib/
and
/etc/courier-imap/
must be changed to
/etc/courier/
On /etc/courier/authdaemonrc, instead of
MYSQL_MAILDIR_FIELD maildir
we must use
MYSQL_MAILDIR_FIELD concat('/home/vmail/',maildir)
Cyrus
Instead of editing /etc/conf.d/saslauthd we have to edit /etc/default/saslauthd to say:
START=yes MECHANISMS="pam" OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd -r"
Instead of /usr/lib/sasl2/smtpd.conf we have to edit /etc/postfix/sasl/smtpd.conf to:
pwcheck_method: saslauthd mech_list: plain login saslauthd_path: /var/run/saslauthd/mux log_level: 7
Rouncube
To make the directories writable to the server, we have to use:
chown -R www-admin:www-admin temp logs
rc.conf
There is no rc.conf to control boot services on Debian. All the services installed on this guide are automatically startup at bootup, so nothing to do here.
The end
And that’s all. With that we should have a working mail server, using MySQL to store user’s info, mail storage on the filesystem, PostfixAdmin to manage accounts and aliases and a nice webmail with Roundcube.