Dovecot Server Information
Before we continue let me say that I have tried for about a month to get Roundcube to communicate with Dovecot via SSL with lots of failures. Using the standard IMAP part it works fine but 8/10 times it wouldn't work with SSL. For the time being this will be an unsecure connection. Having said that if Roundcube is communicating with Dovecot locally I don't believe this is a security issue.
Dovecot is an open-source IMAP, IMAP-SSL and POP3 server. It was written with security as one of its primary goals, and is flexible enough to work with just about any kind of back-end mailbox storage system, including vpopmail's folder structure. It also works with a large number of authentication back-ends, again including vpopmail. In this walkthrough we are only going to configure Dovecot 2 with IMAP-SSL and POP3-SSL and managesieve.
The first step is to install Dovecot 2 from ports.
# cd /usr/ports/mail/dovecot
# make install
When you run make install it will give you the various configure options available. Make sure the following options are checked:
Dovecot itself uses the dovecot.conf for the main configuration file. What I am going to do here is provide a working dovecot.conf that has all options configured for you that use POP3D-SSL and also IMAPD-SSL for the most secure setup possible. Managesieve is enabled for filtering. Feel free to take a look at dovecot.conf before enabling dovecot.
# cd /usr/local/etc
# mv dovecot.conf bak_dovecot.conf
# cp /root/qmail/dovecot.conf.sample dovecot.conf
# mkdir /var/qmail/supervise/dovecot/log
# cd /var/qmail/supervise/dovecot/log
# fetch https://freebsdrocks.net/qmail2/service-any-log-run
# mv service-any-log-run run
# chmod 0755 run
# vi run
In the run file change the second-to-last line to match the following:
multilog t n1024 s1048576 /var/log/qmail/dovecot \
# cd /var/qmail/supervise/dovecot/
# fetch http://freebsdrocks.net/qmail2/dovecot-run
# mv dovecot-run run
# chmod 0755 run
Now lets start the dovecot service:
# ln -s /var/qmail/supervise/dovecot /service/
Wait about ten seconds and then run the following command to make sure there are no issues:
# svstat /service/dovecot /service/dovecot/log