Howto/Setup Postfix + dovecot sasl + dovecot imaps + maildir + virtual accounts + mysql + postfixadmin + PositiveSSL certificate + Roundcube on Ubuntu 10.04

From Interpause
Revision as of 15:45, 15 January 2012 by Andrew (talk | contribs) (→‎The steps)
Jump to navigationJump to search

This howto attemps to document the steps I took to get my email server up and running using, as the title suggests, the Postfix SMTP server with authentication provided by dovecot SASL, the dovecot imaps (imap over SSL) server for client access, maildir storage of virtual accounts, the mysql database for storing account information, postfixadmin for managing virtual accounts, domains and aliases via a web interface, a PostiveSSL certificate for trusted encryption and Roundcube for a pretty webmail user interface.

The motivations for this guide

Setting up an email server on a fresh install of Ubuntu is THE step I dread the most, by far. The first time I did it was in 2009, a good 5+ years after having been introduced to Linux and setting up my first server. In my mind, I remember it taking me the better part of a week and even then I never got it fully working the way I wanted.

For one, I was authenticating SMTP connections using Cyrus-SASL which necessitated periodic restarts (/etc/init.d/saslauthd restart) via cron otherwise it would suddenly refuse authentication requests (the process would still be running but would simply refuse valid requests). Second, my valid Postive SSL certificates were being detected as untrusted requiring clients to force an exception when using imaps and stmps. Lastly, stmps refused to connect via SSL (like Google, Yahoo and my university's imap servers), accepting only TLS connections.

These last two points, it turns out, are quite easy to fix, following the yesterday's experience. The first point, however, I still do not know the solution to and do not care anymore because, as I will describe shortly, I have switched to Dovecot-SASL and do not intend on looking back.

The second and most recent time setting up the email server on a fresh Ubuntu install, as documented next, took me a full day and a half to resolve all issues in order to achieve my near perfect email setup. Near perfect because I am still missing a backup MX server where mail could pool whenever the main server goes offline. I hope to address this last point when I have more time.

The setup

  • smtp on port 25
  • smtps on port 465
  • dovecot imaps server on port 993
  • vmail user with uid 5000 (will need to be created)
  • mail group with gid 8 (should be already created)
  • maildir at /mnt/Remote1/Other/maildir (chown -R vmail:mail)
  • mysql on default port with two databases: postfix and roundcubemail
  • smtp(s) and imaps servers all on the same server: interpause.com
  • PositiveSSL certificate for interpause.com

The steps, from my memory

Note the following steps have been written from my memory, therefore some parts are vague, missing or wrong. The purpose of the following is for me to be able to easily recreate the server on a fresh install of Ubuntu. I regret if I cannot help you but you may always write me an email suggestion improvements or corrections that I may or may not add below.

  • Install the necessary packages (this is probably a partial list)
sudo apt-get install dovecot-postfix postfix postfix-mysql dovecot-common dovecot-imapd php5-mysql
  • Place certificates in /etc/
  • Configure Postfix, in /etc/postfix/
    • [[