Monday, January 18, 2010

Upgraded Dovecot on FreeBSD and Sieve stopped working (Fixed)

I recently upgraded Dovecot (1.1x to 1.2(.8)) on FreeBSD (7.2) and had a slew of issues.

Postfix wasn't delivering messages


This was because Dovecot wasn't starting and Postfix couldn't get the SASL connection that it needed. The fix was to upgrade/install both dovecot and dovecot-sieve ( I use Dovecot's deliver as my Local Delivery Agent (LDA) ). The FreeBSD port/package has dropped support for cmu-sieve in favor of dovecot-sieve. So The first thing do to is make the switch to dovecot-sieve.

After some quick config file changes you'll be able to start Dovecot and consequently postfix should be able to come up with out a hitch and start delivery of messages ( in my case I had some permission issues to contend with and you may too, but since it's a highly individualized thing I'm not going into that issue here).

Problems with Sieve Filters in Dovecot


This was a nightmare. Dovecot's deliver was actually delivering messages but not to the folders specified in the filters. First thing I did was turn on debugging.
mail_debug = yes

Then I noticed this message in the log files
Error: sieve: path to user's main active personal script is unknown. See http://wiki.dovecot.org/LDA/Sieve/Dovecot#configuration

This was fixed by adding / to the beginning of  the "sieve" parameter in dovecot.conf (remember that paths are relative to mail_chroot):
sieve = /%d/%u/.dovecot.sieve

That fixed one issue. The next error message I got was:
Error: sieve: failed to open script /<userdir>/.dovecot.sieve (view logfile /<userdir>/.dovecot.sieve.log for more information)

turns out that (on my system anyway) despite the fact that wiki.dovecot.com claims that dovecot-sieve supports imapflags and notify including those in your sieve scripts may cause issues. If you have older scripts in use form before you'll need to make suer that they don't include those extensions.  I hope this posting helps others save some time and energy as it was a non trivial task to trouble shoot my installation and figure out what was gong on.

No comments:

Post a Comment