Switch from courier to dovecot

Discussion in 'Installation/Configuration' started by todgerme, Aug 19, 2011.

  1. todgerme

    todgerme Member


    I'm trying to migrate an ISPConfig v3 system from Courier to Dovecot - I have a number of Apple Mail clients and they cause Courier to have kittens as everything ignores the IDLE command, the server even with it turned off still allows it, even with it turned off in Apple Mail it still tries to connect aggressively so I thought I'd try dovecot as the solution.

    How do I get ISPConfig once I have apt-get install dovecot-imapd to rewrite the configs as it does during it's initial install.

    I did run ispconfig_update.sh but I'm using the latest production version already. Can you force an update to the same version somehow? I did the configs written when I upgraded to latest svn but I really need to stay on stable.

    When I attempted the latest SVN - all I got in the syslog was:

    Aug 19 02:19:17 server dovecot: auth-worker(default): sql([email protected], Password query failed: Unknown column 'login' in 'where clause'
    Aug 19 02:19:17 server dovecot: auth-worker(default): sql([email protected], Password query failed: Unknown column 'login' in 'where clause'

    Also when switching from Courier to dovecot I've read that the following is a good idea:

    namespace private {
    prefix = INBOX.
    inbox = yes

    This keeps the clients and server operating like a Courier IMAP server - should this be enabled?

    Perhaps someone could send me the dovecot configs that work on the last stable?

    Cheers and thanks for reading even if you can't help

  2. mentes

    mentes Member

    I had a server with Courier before (without ISPConfig) and the solution for OS X Mail.app is:

    Edit Courier configuration and increase the value MAXPERIP
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    Courier and dovecot have a different maildir filder layout, so if you install dovecot on a server that currently runs courier, you will have to move folders in all maildirs. Otherwise your clients will not see their emails anymore.

    I guess the better option is to just set a higher myxperIP setting in the courier config, as courier works fine with mac and windows clients on our servers.
  4. todgerme

    todgerme Member

    I've already set MAXPERIP to 150 and it's still causing issues.

    I have 450 IMAP daemons and they still get timeouts due to them not being enough. You can imagine 450 uses a significant amount of memory. This is only for 4 people!

    The biggest problem is on the 1 IP, you maybe have 2 Macs along with an iPhone and on the server they might have 15 IMAP accounts they check ....

    Running 450 daemons with the need to increase can't be the solution.

    I already run courier (apt-get) and dovecot (compliled from source) on another debian system together, courier imap is used for the webmail and dovecot is used for external imap access but it means I can enable and disable imap per mailbox whilst still allowing squirrelmail imap via webmail - the default Maildir layout that the Postfix VDA does work happily with both.

    I will install a new ISPConfig instance with Dovecot instead, work out the differences - surely they're can't be any in layout if you still use Postfix+Maildrop for delivery? and script something so that if people want to switch they can.

    Why is the dropdown in ISPConfig that allows you to choose Courier or Dovecot? What is that meant to do if it's not to allow the easy switching from one to another?

    Last edited: Aug 19, 2011
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    ISPConfig uses deliver and not maildrop for dovecot installs. And yes, the layout is different then.

    This is set at install time. You can change that of course ├Âlater too, but you will have to modify all maildirs then.

    It allows you to switch from one daemon to another. Nobody sayd that this does not require additional changes.
  6. todgerme

    todgerme Member

    Asking a silly question - why was a different layout chosen for Dovecot installs when it could have been a straight replacement for the Courier/Maildrop without additional Maildir structure changes?
  7. todgerme

    todgerme Member

    Have managed to get Dovecot working with the Courier config in ISPConfig for anyone that needs to switch an already working production system.

    We will leave Courier POP untouched.

    In Debian

    apt-get install dovecot-imapd
    This will uninstall Courier IMAP only.

    Now we leave ISPConfig alone. We need to update the dovecot.conf in /etc/dovecot to relate to the Courier settings and not the Dovecot under ISPConfig settings:

    protocols = imap
    disable_plaintext_auth = no
    log_timestamp = "%Y-%m-%d %H:%M:%S "
    mail_privileged_group = mail
    protocol imap {
      mail_executable = /usr/lib/dovecot/rawlog /usr/lib/dovecot/imap
      mail_plugins = quota imap_quota 
      imap_client_workarounds = outlook-idle
    login_greeting = Welcome to my IMAP Server.
    mail_location = maildir:/var/vmail/%d/%n/
    namespace private {
      prefix = INBOX.
      inbox = yes
    auth default {
      #mechanisms = plain login
      mechanisms = plain login cram-md5 digest-md5
      passdb sql {
        args = /etc/dovecot/dovecot-sql.conf
            userdb static {
            args = uid=5000 gid=5000 home=/var/vmail/%d/%n
      user = root
      socket listen {
        master {
          path = /var/run/dovecot/auth-master
          mode = 0600
      client {
              path = /var/spool/postfix/private/auth
              mode = 0660
              user = vmail
              group = vmail
    dict {
    plugin {
      quota = maildir
    dovecot-sql.conf show now look like this:

    driver = mysql
    connect = host=localhost dbname=dbispconfig user=ispconfig password=XXXXXXXXX
    default_pass_scheme = CRYPT
    password_query = SELECT password FROM mail_user WHERE email = '%u' AND disableimap = 'n'
    Note I have only done the basics and ignored quota. I've disabled the LDA agent with Dovecot and still uses Postfix/Maildrop

    Hopefully someone might find this useful or perhaps it could be worked into ISPConfig for users that only wish to switch IMAP servers but keep Maildrop without the major headache of changes to the filesystem.

    I have a few questions though - what is the protocol managesieve{} in the original ISPConfig version of the config - is that like Maildrop for filtering?
  8. voidzero

    voidzero New Member

    I was just considering to do a similar migration. Have you thus far found any kinks and/or problems with this transition?
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    The main problem that I see with this solution that uses the courier folder layout instead of the one from dovecot is that imap clients like outlook might show errors when they read in the list of all imap folders (e.g. when you use the ubscribe to imap folder function) as they mix up some config files with imap folders. These errors were the reason that dovecot uses a different layout in ISPConfig then Courier and by using the courier layout, you will get these problems that made us change the layout.
  10. todgerme

    todgerme Member


    No problems in the end

    Here is an example of what it leads to:

    -rw------- 1 root root 1727 2006-09-10 14:20 mess
    drwxr-xr-x 2 root root 4096 2007-11-23 15:18 stuff
    drwx------ 2 vmail vmail 1 2010-10-20 17:58 courierimapkeywords
    -rw-r--r-- 1 vmail vmail 2155 2010-11-15 15:10 courierpop3dsizelist
    -rw------- 1 vmail vmail 0 2010-11-20 12:27 dovecot-uidvalidity.4ce7bf09
    drwxr-xr-x 2 vmail vmail 4096 2011-10-12 15:27 courierimaphieracl
    -rw-r--r-- 1 vmail vmail 11309 2011-10-12 15:28 courierimapsubscribed
    -rw------- 1 vmail vmail 90 2011-10-13 12:04 dovecot-keywords
    -rw-r--r-- 1 vmail vmail 2237 2011-10-19 18:23 courierimapuiddb
    -rw------- 1 vmail vmail 8396 2011-11-13 15:44 subscriptions
    -rw------- 1 vmail vmail 8 2011-11-13 15:45 dovecot-uidvalidity
    -rw------- 1 vmail vmail 1360 2011-11-14 05:32 dovecot.index
    drwx------ 2 vmail vmail 1 2011-11-14 09:43 tmp
    drwx------ 2 vmail vmail 1 2011-11-14 09:52 new
    -rw------- 1 vmail vmail 64512 2011-11-14 09:52 dovecot.index.cache
    -rw------- 1 vmail vmail 2714 2011-11-14 09:57 dovecot-uidlist
    -rw------- 1 vmail vmail 77 2011-11-14 09:57 maildirsize
    drwx------ 2 vmail vmail 1048576 2011-11-14 09:57 cur
    -rw------- 1 vmail vmail 5636 2011-11-14 09:58 dovecot.index.log

    Dovecot reads the dovecot cache and ignores the older courier junk, no issues reported by any users. Dovecot appears to handle the aggressive Apple Mail client better by far and can run many more daemons with as much memory.

    Since then I added the quota back in:

    user_query = SELECT CONCAT('/u0/vmail/',CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1))) AS home, 5000 AS uid, 5000 AS gid, CONCAT('maildir:storage=',quota,'B') AS quota FROM dbispconfig WHERE email = '%u'
    Changing dovecot.conf:

        userdb static {
            args = uid=5000 gid=5000 home=/u0/vmail/%d/%n

    passdb sql {
            args = /etc/dovecot-sql.conf
    The only problem you will run into is an upgrade to ISPConfig because the system becomes a mismash of courier and dovecot and I haven't tried an upgrade but I would imagine, the easiest thing would be to have courier-imap installed but disabled and install dovecot from source which will keep it away from the upgrade script in ISPConfig.

    If you have any problems let me know, always happy to lend a hand.
  11. till

    till Super Moderator Staff Member ISPConfig Developer

    Compiling manually will only work if dovecot is installed in a place which is is not in the system path so that dovecot cant be found with "which dovecot".
  12. todgerme

    todgerme Member

    Download dovecot 1.x branch, untar and run (SSL is optional, but my configures don't use it)

    ./configure --with-mysql --without-ssl --prefix=/usr/local/dovecot
    make install
    As it's not in /usr/local/bin but in a complete sub folder inside /usr/local, which won't and doesn't pick it up unless you update your path variable

Share This Page