Dovecot 2.4 was released earlier this year in January and it brings along several breaking changes to its configuration format, requiring manual intervention in basically all cases.
I was alerted to this via a Gentoo news item in May but didn’t immediately take the plunge back then because the conversion seemed a bit daunting at first glance. I had some extra time on my hands today, however, and decided to go for it. What follows are some notes on the process that are hopefully helpful to people who are in the same situation.
First of all, I recommend reading the official document to get a rough understanding of the changes. It is highly likely that your previous configuration file contains settings that have been changed in some way. The document does point out those changes, but does not provide a comparison on a case-by-case basis and sometimes only points out that settings have been split into multiple others.
For example, the mail_location
setting has been split in such a way and the
documentation expects you to find all relevant new settings on your own. So make
sure to take extra care when reading through the section on converted
settings.
Most likely you’ll also need to change old one-letter variables to their new
syntax.
For me, therefore, the following two lines…
mail_home = /var/vmail/%d/%n
mail_location = maildir:~/Maildir:LAYOUT=fs
…changed into:
mail_home = /var/vmail/${user | domain}/%{user | username}
mail_driver = maildir
mail_path = ~/Maildir
mailbox_list_layout = fs
If previously you provided certificate and key files like so:
ssl_cert = </etc/ssl/dovecot.crt
ssl_key = </etc/ssl/dovecot.key
ssl_dh = </etc/dovecot/dh.pem
Now you do the following:
ssl_server_cert_file = /etc/ssl/dovecot.crt
ssl_server_key_file = /etc/ssl/dovecot.key
ssl_server_dh_file = /etc/dovecot/dh.pem
The passdb
and userdb
sections have also changed significantly. Previously
you had…
passdb {
driver = passwd-file
args = /etc/dovecot/passdb
}
userdb {
driver = static
args = uid=vmail gid=vmail
}
…which now becomes:
passdb passwd-file {
passwd_file_path = /etc/dovecot/passdb
}
userdb static {
fields {
uid = vmail
gid = vmail
}
}
The part that was most painful for me was getting sieve scripts to behave like before. I have a collection of global scripts that may be imported by personal scripts, which previously required the following:
protocol lmtp {
mail_plugins = $mail_plugins quota sieve
}
plugin {
sieve_global = /etc/dovecot/sieve/
}
Since now you need to maintain sieve_script
sections manually, only the
following worked for me:
protocol lmtp {
mail_plugins {
quota = yes
sieve = yes
}
}
sieve_script personal {
driver = file
path = ~/sieve
active_path = ~/.dovecot.sieve
}
sieve_script global {
sieve_script_type = global
path = /etc/dovecot/sieve
}
Crucially, it is important to realize that the new section names for passdb
,
userdb
, and sieve_script
are identifiers only: sieve_script_type
is only
set to global
if explicitly given, a section name of global
will not
suffice. The setting is missing from the personal
section because a type of
personal
is the default.
Finally, after the migration to 2.4 I started getting the following error in my logs:
net_connect_unix(/run/dovecot/anvil) failed: Permission denied
I’m not exactly sure why this happens, but it seems to be a known issue - I could work around it doing the following:
service anvil {
unix_listener anvil {
group = vmail
mode = 0660
user = dovecot
}
}
You will most likely have to adjust the vmail
group according to your setup.