Managing Dovecot Sieve scripts with Horde-Ingo
I finally got around to getting sieve working with dovecot which was pretty easy. Next, I wanted to be able to manage the sieve rules via the Horde-Ingo webmail interface. This seemed like it should be an easy and common thing to do, however, it ended up taking a couple of days to sift through the rather poor hored/ingo docs, email back and forth on the mailing list, and do a lot of trial and error. (mostly error).
Finally, I found a solution that works…. here it is (Assuming you already have dovecot-sieve working):
Software:
Debian etch
Dovecot 1.0.13 (with dovecot common)
Horde 3.2-RC2
Ingo 1.2-RC2
Step 1: Setup proper permissions
For Ingo to be able to write out sieve scripts, the apache user needs permissions to write to the Maildir folders.
I did this by simply adding the www-data user to the vmail group.
:# adduser www-data vmail :# /etc/init.d/apache2 restart
This will give www-data permissions to write to the Maildir folders (owned by vmail:vmail) but if we just let Ingo create the scripts from scratch, they will be owned by www-data:www-data and vmail won’t be able to use them.
To correct this, just make sure you create an empty .dovecot.sieve when the user’s Maildir folder is created.
I handled this by adding:
touch $2/Maildir/.dovecot.sieve
to my /usr/bin/maildirmake script.
Step 2: Setup Ingo Backend
In the horde/ingo/config directory, there is a file called backends.php. This file by default contains a bunch of different entries that tell Ingo how to store the mail filters.
For Ingo to actually work, there should only be one entry in this file (as I’m told). So for starters, just delete all of the entries in this file.
Now that we have a clean backends.php, we need to add an entry to tell Ingo where and how to save our .dovecot.sieve scripts.
There are many options for storage but the simplest for our purposes is to just use the filesystem.
To enable this, add the following entry to the file
$backends['dovecot'] = array( 'driver' => 'vfs', 'hordeauth' => true, 'params' => array( 'filename' => '.dovecot.sieve', 'vfsroot' => '/var/vmail', 'vfs_path' => '/example.com/%u/Maildir', 'vfstype' => 'file' ), 'script' => 'sieve', 'scriptparams' => array(), );
This should all be pretty self-explanatory, but you’ll notice on line 7, we’re hardcoding the domain. This is because Ingo will expand %u as the user, but it does not currently expand any variable as the domain. (i.e. %d)
That’s it. If you now log into horde and create/edit filters, they should be saved to the .dovecot.sieve file in the user’s Maildir. Pretty simple, and now documented.
Enjoy.






