Migrating from Courier-IMAP to Dovecot IMAP/POP3

This section provides instruction on how to migrate single-host or clustered qmail from the Courier-IMAP service to the Dovecot IMAP/POP3 service.

Note:

Users who download incoming messages through POP3 and leave a copy of each message on a server, will receive duplicates of every message in their mail client after migration from Courier to Dovecot.

Important:

1. There is no migration procedure from the Dovecot IMAP/POP3 service to the Courier-IMAP service.

2. If the dovecot service cannot be started, apply the instruction of the https://kb.cloudblue.com/122186 KB article.

To perform the migration from the Courier-IMAP service to the Dovecot IMAP/POP3 service follow these steps:

  1. Log in to PCP.
  2. Uninstall the CourierIMAP (type: other) package from the required qmail host.
  3. Install the dovecot (type: other) package on the qmail host. This package requires dovecot-*.i386.rpm and dovecot-sieve-*.i386.rpm of the appropriate versions.

    The self-signed certificate is created automatically during the package installation for IMAP and POP protocols. This certificate and private key are placed in the /etc/pki/dovecot/certs/dovecot.pem and /etc/pki/dovecot/private/dovecot.pem files. Later, you may change the self-signed certificate to the CA-signed certificate (a certificate signed by a Certification Authority) by replacing the default certificate and key manually. If the certificate and key are replaced, restart the dovecot service by using the service dovecot restart command.

    If it is required, you may use the existing certificates of the CourierIMAP service. To do so, perform the following actions:

    1. Log in to the qmail host as root.
    2. For POP protocol, copy the certificate and private key from the /etc/courier-imap/pop3d.pem file to the /etc/pki/dovecot/certs/pop3.pem and /etc/pki/dovecot/private/pop3.pem files.
    3. For IMAP protocol, copy the certificate and private key from the /etc/courier-imap/imapd.pem file to the /etc/pki/dovecot/certs/imap.pem and /etc/pki/dovecot/private/imap.pem files.
    4. Add the following lines to the /etc/dovecot.conf file:

      protocol imap {

      ssl_cert_file = /etc/pki/dovecot/certs/imap.pem

      ssl_key_file = /etc/pki/dovecot/private/imap.pem

      }

      protocol pop3 {

      ssl_cert_file = /etc/pki/dovecot/certs/pop3.pem

      ssl_key_file = /etc/pki/dovecot/private/pop3.pem

      }

    5. Restart the dovecot service.
  4. On the qmail host, execute the following commands:

    chgrp qmail /usr/libexec/dovecot/deliver

    chmod g+s /usr/libexec/dovecot/deliver

    usermod -G qmail dovecot

    Then, make sure the /usr/libexec/dovecot/deliver file has the following permissions:

    ll /usr/libexec/dovecot/deliver

    -rwxr-sr-x 1 root qmail 1087105 Nov 21 2011 /usr/libexec/dovecot/deliver

  5. In the /etc/dovecot.conf file, adjust values of the login_max_processes_count (maximum number of login processes to create) and max_mail_processes (maximum number of running mail processes) configuration parameters. The values of the parameters must suit the planned amount of simultaneous POP/IMAP connections and the hardware resources of the used qmail host. Refer to the Dovecot documentation to obtain the detailed information about these configuration parameters.

    Restart the dovecot service after the modification of the /etc/dovecot.conf file.

    If you receive the 'Warning: fd limit 1024 is lower than what Dovecot can use under full load (more than 1408). Either grow the limit or change login_max_processes_count and max_mail_processes settings.' message, you should adjust the 'open file' limit using the ulimit -n OPEN_FILE_LIMIT command. For example, you may place the command to the /etc/init.d/dovecot file.

    Important: In case of the mail cluster, perform steps 1-5 for each service node.

  6. Log in to the qmail host as root and execute the following command:

    sh /usr/bin/imap_shf_lookup.sh -b -c

    Important: In case of the mail cluster, this step should be performed only once on any service node.

  7. In case of the mail cluster, if you plan to provide to customers the ability to manage SIEVE mail filtering rules from their SIEVE-enabled mail clients, add the load balancing rule for the TCP port 2000 following instructions of the Creating Load Balancer section. Note that this functionality is not tested against all existing mail clients.