Migrate from Courier to Dovecot on your ISPConfig managed mailserver

Discussion in 'Tips/Tricks/Mods' started by Th0m, Feb 28, 2022.

Thread Status:
Not open for further replies.
  1. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    We have been warning users that Courier support would be removed since the release of ISPConfig 3.2. We are now adding a warning to the update script that Courier is deprecated. Users that see this warning will see a link to this post.

    I have taken the info from this forum thread on how to migrate to Dovecot. The guide is compatible with both Debian and Ubuntu.
    This is untested and I can't guarantee it will work. Always make sure to keep good backups so you can go back to the pre-migration state if things go wrong.

    These steps should be followed on the server you want to migrate from Courier to Dovecot (duh). Before starting the migration, make sure you are logged in as root user to the server.

    Step 1: Stop postfix and courier
    Run these commands:
    systemctl stop postfix
    systemctl stop courier-authdaemon
    systemctl stop courier-imap
    systemctl stop courier-imap-ssl
    systemctl stop courier-pop
    systemctl stop courier-pop-ssl

    Step 2: Install Dovecot
    Install Dovecot and remove Courier with these commands:
    apt-get -y install dovecot-imapd dovecot-pop3d dovecot-mysql dovecot-sieve dovecot-lmtpd

    Step 3: Change the mail daemon in ISPConfig
    Login to ISPConfig, then go to System > Server config > mail.example.com > Mail and set:
    POP3/IMAP Daemon: dovecot
    Mailfilter Syntax: sieve
    And click on save.

    Step 4: Create a API user
    Login to ISPConfig and go to System -> Remote Users, and click "Add new remote user". In the form, give your new user a name and a password. I'll use example with the password examplepass. Don't use the same credentials, but create your own. The example panel will be located at https://panel.example.com:8080 with a valid SSL certificate.

    Enable the following functions for your remote user:
    • Client functions
    • Mail user functions
    • Mail user filter functions
    And enable remote access for the IPv4 and IPv6 address(es) of the server you are running the script from (your mailserver).

    Step 5: Download and run the ISPConfig Courier to Dovecot migration script
    Download the ISPConfig Courier to Dovecot script:
    cd /tmp
    curl https://git.ispconfig.org/ispconfig/tools/-/raw/master/courier_to_dovecot.php -o courier_to_dovecot.php
    Then run the script:
    php courier_to_dovecot.php
    Answer the questions like so:
    What is the username for your remote user? [example]: example
    What is the username for your remote user? [examplepass]: examplepass
    What is the hostname of your ISPConfig panel? []: https://panel.example.com:8080
    ^ without trailing slash!
    What is the directory where your emails are stored? [/var/vmail]: /var/vmail
    Don't add a trailing slash to the hostname of the ISPConfig panel.

    Now let the script run. This can take several minutes. Don't interrupt the script.

    Step 6: Run a (forced) ISPConfig update
    To reconfigure the services so they are correctly configured, we need to run the ISPConfig update script and let it reconfigure services. Run the script from the command line with
    ispconfig_update.sh --force
    Go through the update steps. When asked whether you want to reconfigure services or not, hit enter.

    Step 7: Uninstall Courier
    Uninstall Courier with
    apt-get -y remove courier-authdaemon
    That's it, you're now migrated to Dovecot!
    Last edited: Mar 5, 2022
    Turbanator likes this.
Thread Status:
Not open for further replies.

Share This Page