Dovecot configuration is messed up causing it to crash

My Dovecot server keeps crashing. When I look at the status I get this error reported

doveconf: Fatal: Error in configuration file /etc/dovecot/dovecot.conf line 395: Expecting ‘{’

Looking at the conf file, it seems the brackets are not balanced. After closing all open brackets, the dovecot is able to run. But I want to know why the conf is messed up like that? I have to fix the brackets everytime dovecot is updated, causing conf to get regenerated (with errors).

Here’s how it looks. It only happens with some entries. I’ve not changed the indentation as it might give you some clue.

local_name webone.com {
  ssl_cert = </home/webone/ssl.combined
  ssl_key = </home/webone/ssl.key
}
local_name www.webone.com {
  ssl_cert = </home/webone/ssl.combined
  ssl_key = </home/webone/ssl.key
}
local_name mail.webone.com {
  ssl_cert = </home/webone/ssl.combined
  ssl_key = </home/webone/ssl.key
}
local_name webone.com {
  ssl_cert = </home/webone/ssl.combined
  ssl_key = </home/webone/ssl.key
}
local_name www.webone.com {
ssl_cert = </home/webone/ssl.cert
  ssl_cert = </home/webone/ssl.combined
  ssl_key = </home/webone/ssl.key
local_name mail.webone.com {
ssl_cert = </home/webone/ssl.cert
ssl_key = </home/webone/ssl.key
  ssl_cert = </home/webone/ssl.combined
  ssl_key = </home/webone/ssl.key
ssl_cert = </home/webtwo/ssl.cert
ssl_key = </home/webtwo/ssl.key
}
local_name www.webtwo.com {
ssl_cert = </home/webtwo/ssl.cert
ssl_key = </home/webtwo/ssl.key
}
local_name webtwo.com {
ssl_cert = </home/webtwo/ssl.cert
ssl_key = </home/webtwo/ssl.key
  ssl_ca = </home/webtwo/ssl.ca
}
local_name www.webtwo.com {
ssl_cert = </home/webtwo/ssl.cert
ssl_key = </home/webtwo/ssl.key
  ssl_ca = </home/webtwo/ssl.ca
}

My server is Ubuntu 18.04, Virtualmin 6.11, Webmin 1.954
Please let me know if you need more info.

The fix is simple: there are a few missing close curly bracket } characters, just add them manually and restart Dovecot.

Yes, I’ve mentioned that I do that every time it screws up. Thats not a solution though. I want to know why its getting messed up in the first place.

I am sorry, I rushed to reply before reading your full message.

@Ilia has posted messages during the last week or so with info and a patch for permanently fixing the issue, would you browse the forums for these @Vipul.K?

Sorry about that. The solution is coming in Virtualmin 6.12. Meanwhile, if your Dovecot config has been manually fixed, run the following command as a shell script, to re-generate entries for all domains, which will not fail even with Virtualmin 6.11.

#!/bin/sh
doms=`virtualmin list-domains --name-only --no-alias`
for dom in $doms; do
        virtualmin install-service-cert --domain $dom --remove-domain --service dovecot
        virtualmin install-service-cert --domain $dom --add-domain --service dovecot
done

Sorry, I did search on Google but didn’t find anything related.

Thanks @Ilia for the script. I ran it and the conf file looks much cleaner now but I did ran into an issue. The file started with

...
!include_try local.conf
}
  ssl_ca = </home/webone/ssl.ca
}
  ssl_cert = </home/webtwo/ssl.cert
  ssl_key = </home/webtwo/ssl.key
} 
local_name webthree.com {
...

Those websites have their proper entry down the file as well. After removing following lines, Dovecot started fine.

}
	ssl_ca = </home/webone/ssl.ca
}
	ssl_cert = </home/webtwo/ssl.cert
	ssl_key = </home/webtwo/ssl.key
}

Its working fine now and 6.12 will fix the issue so you may not need to do anything about it. I’m just letting you know.

After removing following lines, Dovecot started fine.

Yes, those were broken ones.

We still will not be able to fix any already broken configs.

What you could do is to remove everything after !include_try local.conf and run the script, with the --add-domain command only.

Its working now so i’ll just leave it be. If something goes wrong I’ll do this.

Thanks

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.