Dist-upgrade debian: dovecot nightmare

Discussion in 'Server Operation' started by Exception e, Jul 20, 2016.

  1. Exception e

    Exception e New Member

    :) UPDATE: I posted a solution in this thread here.

    Background
    : I did a dist-upgrade from debian squeeze to debian wheezy. Everything went well but dovecot was making problems because of its ssl-certs. I ended up backing up /etc/dovecot/* and purge dovecot. Ispconfig version is 3.0.3, that hasnt been upgraded yet.

    Reinstalling Dovecot didn't work well. I could not get the imap server to work correctly.

    Question: What is the best way forward? Rerun the original ispconfig 3.0.3 setup on Wheezy?

    Technical details

    First I had SASL errors like
    Code:
    postfix/smtpd[20182]: fatal: no SASL authentication mechanisms
    in /varlog/mail.err
    I kept trying all kinds of advice I found other people got when upgrading dovecot. I hardly understand this Dovecot mess.
    I now have errors like

    Code:
    Jul 20 00:40:39 srv1 dovecot: imap(xxx@yyy): Error: Internal error occurred. Refer to server log for more information.
    Jul 20 00:41:18 srv1 dovecot: auth-worker(21634): Error: sql(xxx@yyy): User query failed: Unknown column 'disablelda' in 'where clause'
    
    I changed the queries and harcoded disableimap instead (/etc/dovecot/dovecot-sql.conf.ext )


    Code:
    # new lda fix: https://www.howtoforge.com/community/threads/dovecot-lda-fatal-unknown-user.48149/
    password_query = SELECT password FROM mail_user WHERE email = '%u' AND disableimap = 'n'
    user_query = SELECT email AS user, maildir AS home, CONCAT('*:storage=', quota , 'B') AS quota_rule FROM mail_user WHERE email = '%u' AND disableimap = 'n'

    For refence the changed configurations:

    Code:
    $ dovecot -n
    # 2.1.7: /etc/dovecot/dovecot.conf
    # OS: Linux 3.2.0-4-amd64 x86_64 Debian 7.11
    disable_plaintext_auth = no
    log_timestamp = "%Y-%m-%d %H:%M:%S "
    mail_location = mbox:~/mail:INBOX=/var/mail/%u
    namespace inbox {
      inbox = yes
      location =
      mailbox Drafts {
        special_use = \Drafts
      }
      mailbox Junk {
        special_use = \Junk
      }
      mailbox Sent {
        special_use = \Sent
      }
      mailbox "Sent Messages" {
        special_use = \Sent
      }
      mailbox Trash {
        special_use = \Trash
      }
      prefix =
    }
    passdb {
      args = /etc/dovecot/dovecot-sql.conf.ext
      driver = sql
    }
    protocols = imap pop3 imap pop3
    service auth {
      unix_listener /var/spool/postfix/private/auth {
        mode = 0666
      }
      unix_listener auth-userdb {
        group = postfix
        mode = 0666
        user = postfix
      }
    }
    ssl_cert = </etc/dovecot/dovecot.pem
    ssl_key = </etc/dovecot/private/dovecot.pem
    userdb {
      args = /etc/dovecot/dovecot-sql.conf.ext
      driver = sql
    }
    
     
    Last edited: Jul 20, 2016
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Fisrt, check the perfct server tutorial that matches your new os version to ensure that no packages are missing. Then update to ISPConfig 3.0.5.4p9 and select to reconfigure services during update to get a deovecot configuration that is compatible with the upgraded operating system.
     
  3. Exception e

    Exception e New Member

    Thanks, I will try. Do I need to reset the dovecot configuration to the "fresh apt-get install dovecot" state first?
     
  4. Exception e

    Exception e New Member

    ....extra post so that I am allowed to post something with urls...
     
  5. Exception e

    Exception e New Member

    Thanks that worked.

    For other people having to deal with this problem, I performed the following steps. This assumes you are on Debian Wheezy.

    1. Make sure you are root (sudo su)
    2. Backup dovecot config
      Code:
      config cp -R /etc/dovecot /root/dovecot-backup
    3. Delete dovecot config
      Code:
      rm -R /etc/dovecot
    4. Restore vanilla config
      Code:
      cp -R /usr/share/dovecot/ /etc/dovecot 
    5. Then walk through the guide from front to back to see if any configuration is still up to date with what the guide assumes.
    6. Execute ispconfig_update.sh, it should be on your path. Follow the update instructions . The updater takes care of your backups.
    7. If everything works you can delete your dovecot backup
      Code:
      rm -R /root/dovecot-backup

    For reference, my dovecot config now reads:

    Code:
    $ dovecot -n
    # 2.1.7: /etc/dovecot/dovecot.conf
    # OS: Linux 3.2.0-4-amd64 x86_64 Debian 7.11
    auth_mechanisms = plain login
    disable_plaintext_auth = no
    listen = *,[::]
    log_timestamp = "%Y-%m-%d %H:%M:%S "
    mail_privileged_group = vmail
    passdb {
      args = /etc/dovecot/dovecot-sql.conf
      driver = sql
    }
    plugin {
      quota = dict:user::file:/var/vmail/%d/%n/.quotausage
      sieve = /var/vmail/%d/%n/.sieve
    }
    protocols = imap pop3
    service auth {
      unix_listener /var/spool/postfix/private/auth {
      group = postfix
      mode = 0660
      user = postfix
      }
      unix_listener auth-userdb {
      group = vmail
      mode = 0600
      user = vmail
      }
      user = root
    }
    service imap-login {
      client_limit = 1000
      process_limit = 500
    }
    ssl_cert = </etc/postfix/smtpd.cert
    ssl_key = </etc/postfix/smtpd.key
    ssl_protocols = !SSLv2 !SSLv3
    userdb {
      args = /etc/dovecot/dovecot-sql.conf
      driver = sql
    }
    protocol imap {
      mail_plugins = quota imap_quota
    }
    protocol pop3 {
      mail_plugins = quota
      pop3_uidl_format = %08Xu%08Xv
    }
    protocol lda {
      mail_plugins = sieve quota
    }
     

Share This Page