<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>BenV&#039;s notes &#187; sieve</title>
	<atom:link href="http://notes.benv.junerules.com/tag/sieve/feed/" rel="self" type="application/rss+xml" />
	<link>http://notes.benv.junerules.com</link>
	<description>Rants and notes</description>
	<lastBuildDate>Wed, 28 Jul 2010 13:36:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>ManageSieve</title>
		<link>http://notes.benv.junerules.com/all/software/managesieve/</link>
		<comments>http://notes.benv.junerules.com/all/software/managesieve/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 11:45:01 +0000</pubDate>
		<dc:creator>BenV</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[dovecot]]></category>
		<category><![CDATA[managesieve]]></category>
		<category><![CDATA[sieve]]></category>
		<category><![CDATA[thunderbird]]></category>

		<guid isPermaLink="false">http://notes.benv.junerules.com/?p=634</guid>
		<description><![CDATA[Time to continue our adventure into Sieve land from yesterday. Yesterday the result was that Sieve scripts could be put in place by the system administrator and they work. Needless to say that&#8217;s cumbersome and we want users to handle it themselves. To avoid all possible issues with opening up FTP / DAV / whatever, [...]]]></description>
			<content:encoded><![CDATA[<p>Time to continue <a href="http://notes.benv.junerules.com/all/software/qmail-vpopmail-dovecot-and-sieve/">our adventure into Sieve land</a> from yesterday.</p>
<p>Yesterday the result was that Sieve scripts could be put in place by the system administrator and they work. Needless to say that&#8217;s cumbersome and we want users to handle it themselves.<br />
To avoid all possible issues with opening up FTP / DAV / whatever, the clowns at Dovecot and the ietf have decided to create a new protocol for it. Currently still a draft, but it will be an official protocol called <a href="http://tools.ietf.org/id/draft-martin-managesieve-12.txt">ManageSieve</a>. <span id="more-634"></span></p>
<p>For Dovecot 1.2 it is still required to patch dovecot and then install the managesieve service. Feeling adventurous I&#8217;m going for the bleeding edge version again <img src='http://notes.benv.junerules.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
First the patch:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root<span style="color: #000000; font-weight: bold;">@</span>black:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>dovecot-sieve$ hg clone http:<span style="color: #000000; font-weight: bold;">//</span>hg.rename-it.nl<span style="color: #000000; font-weight: bold;">/</span>dovecot-<span style="color: #000000;">1.2</span>-managesieve-patch<span style="color: #000000; font-weight: bold;">/</span> dovecot-<span style="color: #000000;">1.2</span>-managesieve-patch-hg<br />
&nbsp;<span style="color: #000000; font-weight: bold;">*</span>leech leech<span style="color: #000000; font-weight: bold;">*</span><br />
&nbsp;<span style="color: #666666; font-style: italic;"># Next we create a copy of our installed dovecot that we can mess with</span><br />
root<span style="color: #000000; font-weight: bold;">@</span>black:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>dovecot-sieve$ <span style="color: #7a0874; font-weight: bold;">cd</span> .. ; <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #660033;">-ax</span> dovecot-1.2.8 dovecot-1.2.8-patched <br />
root<span style="color: #000000; font-weight: bold;">@</span>black:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src$ <span style="color: #7a0874; font-weight: bold;">cd</span> dovecot-1.2.8-patched<br />
&nbsp;<span style="color: #666666; font-style: italic;"># Apply the patch</span><br />
root<span style="color: #000000; font-weight: bold;">@</span>black:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>dovecot-1.2.8-patched$ <span style="color: #c20cb9; font-weight: bold;">patch</span> <span style="color: #660033;">-p1</span> <span style="color: #000000; font-weight: bold;">&lt;</span> ..<span style="color: #000000; font-weight: bold;">/</span>dovecot-sieve<span style="color: #000000; font-weight: bold;">/</span>dovecot-<span style="color: #000000;">1.2</span>-managesieve-patch-hg<span style="color: #000000; font-weight: bold;">/</span>managesieve.patch <br />
patching <span style="color: #c20cb9; font-weight: bold;">file</span> README.managesieve<br />
patching <span style="color: #c20cb9; font-weight: bold;">file</span> dovecot-example.conf<br />
patching <span style="color: #c20cb9; font-weight: bold;">file</span> src<span style="color: #000000; font-weight: bold;">/</span>master<span style="color: #000000; font-weight: bold;">/</span>child-process.c<br />
patching <span style="color: #c20cb9; font-weight: bold;">file</span> src<span style="color: #000000; font-weight: bold;">/</span>master<span style="color: #000000; font-weight: bold;">/</span>child-process.h<br />
patching <span style="color: #c20cb9; font-weight: bold;">file</span> src<span style="color: #000000; font-weight: bold;">/</span>master<span style="color: #000000; font-weight: bold;">/</span>listener.c<br />
patching <span style="color: #c20cb9; font-weight: bold;">file</span> src<span style="color: #000000; font-weight: bold;">/</span>master<span style="color: #000000; font-weight: bold;">/</span>login-process.c<br />
patching <span style="color: #c20cb9; font-weight: bold;">file</span> src<span style="color: #000000; font-weight: bold;">/</span>master<span style="color: #000000; font-weight: bold;">/</span>mail-process.c<br />
patching <span style="color: #c20cb9; font-weight: bold;">file</span> src<span style="color: #000000; font-weight: bold;">/</span>master<span style="color: #000000; font-weight: bold;">/</span>main.c<br />
patching <span style="color: #c20cb9; font-weight: bold;">file</span> src<span style="color: #000000; font-weight: bold;">/</span>master<span style="color: #000000; font-weight: bold;">/</span>master-settings-defs.c<br />
patching <span style="color: #c20cb9; font-weight: bold;">file</span> src<span style="color: #000000; font-weight: bold;">/</span>master<span style="color: #000000; font-weight: bold;">/</span>master-settings.c<br />
Hunk <span style="color: #666666; font-style: italic;">#8 succeeded at 1066 (offset 8 lines).</span><br />
Hunk <span style="color: #666666; font-style: italic;">#10 succeeded at 1372 (offset 8 lines).</span><br />
Hunk <span style="color: #666666; font-style: italic;">#12 succeeded at 1397 (offset 8 lines).</span><br />
Hunk <span style="color: #666666; font-style: italic;">#14 succeeded at 1470 (offset 8 lines).</span><br />
Hunk <span style="color: #666666; font-style: italic;">#16 succeeded at 1605 (offset 8 lines).</span><br />
Hunk <span style="color: #666666; font-style: italic;">#18 succeeded at 1654 (offset 8 lines).</span><br />
Hunk <span style="color: #666666; font-style: italic;">#20 succeeded at 1696 (offset 8 lines).</span><br />
Hunk <span style="color: #666666; font-style: italic;">#22 succeeded at 1958 (offset 8 lines).</span><br />
patching <span style="color: #c20cb9; font-weight: bold;">file</span> src<span style="color: #000000; font-weight: bold;">/</span>master<span style="color: #000000; font-weight: bold;">/</span>master-settings.h<br />
&nbsp;<span style="color: #666666; font-style: italic;"># Seems like it applied cleanly. Let's recompile it! (pick your own configure string here)</span><br />
root<span style="color: #000000; font-weight: bold;">@</span>black:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>dovecot-1.2.8-patched$ .<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>usr <span style="color: #660033;">--with-vpopmail</span> <span style="color: #660033;">--with-zlib</span> <span style="color: #660033;">--with-bzlib</span> <span style="color: #660033;">--without-passwd</span> <span style="color: #660033;">--without-passwd-file</span> <span style="color: #660033;">--without-shadow</span> <span style="color: #660033;">--without-pam</span> &nbsp;<span style="color: #660033;">--without-checkpassword</span> <span style="color: #660033;">--without-bsdauth</span> <span style="color: #660033;">--without-ldap</span> <span style="color: #660033;">--without-sia</span> <span style="color: #660033;">--without-static-userdb</span> <span style="color: #660033;">--without-prefetch-userdb</span> <span style="color: #660033;">--without-sql</span> <span style="color: #660033;">--without-pgsql</span> <span style="color: #660033;">--without-mysql</span> <span style="color: #660033;">--without-sqlite</span> <span style="color: #660033;">--without-nss</span><br />
&nbsp;<span style="color: #000000; font-weight: bold;">*</span> heaps of configure output <span style="color: #000000; font-weight: bold;">*</span><br />
&nbsp;<span style="color: #666666; font-style: italic;"># Clean up stuff from the old build, we want a clean build</span><br />
root<span style="color: #000000; font-weight: bold;">@</span>black:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>dovecot-1.2.8-patched$ <span style="color: #c20cb9; font-weight: bold;">make</span> clean<br />
root<span style="color: #000000; font-weight: bold;">@</span>black:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>dovecot-1.2.8-patched$ <span style="color: #c20cb9; font-weight: bold;">make</span><br />
&nbsp;<span style="color: #666666; font-style: italic;"># Drink a cup of coffee, this could take a while</span><br />
root<span style="color: #000000; font-weight: bold;">@</span>black:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>dovecot-1.2.8-patched$ <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>pkg ; <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #007800;">DESTDIR</span>=<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>pkg <span style="color: #c20cb9; font-weight: bold;">install</span> ; <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>pkg ; makepkg <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>packages<span style="color: #000000; font-weight: bold;">/</span>dovecot-1.2.8-managesieve-i386-<span style="color: #000000;">1</span>.tgz</div></div>
<p>After upgrading to the new dovecot package we still have to put the managesieve service into place. Which we have to build first.</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root<span style="color: #000000; font-weight: bold;">@</span>black:~$ <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>dovecot-sieve<br />
root<span style="color: #000000; font-weight: bold;">@</span>black:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>dovecot-sieve$ hg clone http:<span style="color: #000000; font-weight: bold;">//</span>hg.rename-it.nl<span style="color: #000000; font-weight: bold;">/</span>dovecot-<span style="color: #000000;">1.2</span>-managesieve<span style="color: #000000; font-weight: bold;">/</span> dovecot-<span style="color: #000000;">1.2</span>-managesieve-hg<br />
&nbsp;<span style="color: #666666; font-style: italic;"># Leech leech</span><br />
root<span style="color: #000000; font-weight: bold;">@</span>black:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>dovecot-sieve$ <span style="color: #7a0874; font-weight: bold;">cd</span> dovecot-<span style="color: #000000;">1.2</span>-managesieve-hg ; .<span style="color: #000000; font-weight: bold;">/</span>autogen.sh<br />
root<span style="color: #000000; font-weight: bold;">@</span>black:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>dovecot-sieve<span style="color: #000000; font-weight: bold;">/</span>dovecot-<span style="color: #000000;">1.2</span>-managesieve-hg$ .<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>usr <span style="color: #660033;">--with-dovecot</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>dovecot-1.2.8-patched <span style="color: #660033;">--with-dovecot-sieve</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>dovecot-sieve<span style="color: #000000; font-weight: bold;">/</span>dovecot-<span style="color: #000000;">1.2</span>-sieve-hg<br />
&nbsp;<span style="color: #666666; font-style: italic;"># Now to compile it</span><br />
root<span style="color: #000000; font-weight: bold;">@</span>black:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>dovecot-sieve<span style="color: #000000; font-weight: bold;">/</span>dovecot-<span style="color: #000000;">1.2</span>-managesieve-hg$ <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">mkdir</span> pkg <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #007800;">DESTDIR</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">pwd</span><span style="color: #000000; font-weight: bold;">`/</span>pkg <span style="color: #c20cb9; font-weight: bold;">install</span><br />
&nbsp;<span style="color: #666666; font-style: italic;"># And create a package</span><br />
root<span style="color: #000000; font-weight: bold;">@</span>black:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>dovecot-sieve<span style="color: #000000; font-weight: bold;">/</span>dovecot-<span style="color: #000000;">1.2</span>-managesieve-hg$ <span style="color: #7a0874; font-weight: bold;">cd</span> pkg ; makepkg <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>packages<span style="color: #000000; font-weight: bold;">/</span>dovecot-<span style="color: #000000;">1.2</span>-managesieve-i386-<span style="color: #000000;">1</span>.tgz</div></div>
<p>Install the package and we&#8217;re almost done. All that&#8217;s left now is some configuration and kicking of services.<br />
As described <a href="http://wiki.dovecot.org/ManageSieve/Configuration">here</a> the biggest thing we need to do is add <span style="color:#00FFAA">managesieve</span> to the protocols line in <span style="color:#FF00FF">/etc/dovecot.conf</span>. Like this:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">protocols = imap imaps pop3 pop3s managesieve</div></div>
<p>By default this will steal port 2000 for incoming managesieve connections, but you can change that and a few other things in the dovecot.conf file if you like. Just add a section like this:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">## </span><br />
<span style="color: #666666; font-style: italic;">## ManageSieve settings</span><br />
<span style="color: #666666; font-style: italic;">##</span><br />
<br />
protocol managesieve <span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># listen = *:2000</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># login_executable = /usr/libexec/dovecot/managesieve-login</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># mail_executable = /usr/libexec/dovecot/managesieve</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># managesieve_max_line_length = 65536</span><br />
&nbsp; &nbsp; managesieve_logout_format = bytes <span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #007800;">in</span>=<span style="color: #000000; font-weight: bold;">%</span>i : <span style="color: #007800;">out</span>=<span style="color: #000000; font-weight: bold;">%</span>o <span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># managesieve_implementation_string = dovecot</span><br />
<span style="color: #7a0874; font-weight: bold;">&#125;</span></div></div>
<p>And obviously you need to uncomment and change whatever you want to have broken <img src='http://notes.benv.junerules.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> . I decided to stick to the defaults except for the log string.<br />
After these changes give a good hard kick to your dovecot daemon (since the binary changed with the patch I&#8217;m sure a HUP won&#8217;t cut it) and see what happens.<br />
Don&#8217;t forget to open up the managesieve port (<span style="color:#AAFF00">2000</span> by default) in your firewall!</p>
<p>Let&#8217;s see if it works:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root<span style="color: #000000; font-weight: bold;">@</span>black:~$ telnet localhost <span style="color: #000000;">2000</span><br />
Trying 127.0.0.1...<br />
Connected to localhost.<br />
Escape character is <span style="color: #ff0000;">'^]'</span>.<br />
<span style="color: #ff0000;">&quot;IMPLEMENTATION&quot;</span> <span style="color: #ff0000;">&quot;dovecot&quot;</span><br />
<span style="color: #ff0000;">&quot;SIEVE&quot;</span> <span style="color: #ff0000;">&quot;comparator-i;octet comparator-i;ascii-casemap fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date&quot;</span><br />
<span style="color: #ff0000;">&quot;SASL&quot;</span> <span style="color: #ff0000;">&quot;PLAIN&quot;</span> &nbsp; <br />
<span style="color: #ff0000;">&quot;STARTTLS&quot;</span> &nbsp; &nbsp; &nbsp; <br />
<span style="color: #ff0000;">&quot;NOTIFY&quot;</span> <span style="color: #ff0000;">&quot;mailto&quot;</span><br />
<span style="color: #ff0000;">&quot;VERSION&quot;</span> <span style="color: #ff0000;">&quot;1.0&quot;</span> &nbsp;<br />
OK <span style="color: #ff0000;">&quot;Dovecot ready.&quot;</span></div></div>
<p>Looks good! Time to let users have some fun with molesting their stuff through Sieve <img src='http://notes.benv.junerules.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
A quick test with the <a href="http://sieve.mozdev.org/installation.html">thunderbird sieve addon</a>:<br />
<div id="attachment_641" class="wp-caption alignnone" style="width: 310px"><a href="http://notes.benv.junerules.com/wp-content/uploads/2009/12/thunderbird-sieve-login.png"><img src="http://notes.benv.junerules.com/wp-content/uploads/2009/12/thunderbird-sieve-login-300x150.png" alt="Thunderbird Sieve Plugin 1" title="Thunderbird Sieve Plugin 1" width="300" height="150" class="size-medium wp-image-641" /></a><p class="wp-caption-text">Thunderbird Sieve Plugin 1</p></div><br />
Note that it required me to set the TLS to &#8216;Strict RFC style handshake&#8217; on the Sieve Options Compatibility page, otherwise it wouldn&#8217;t login.<br />
We can even molest our scripts with syntax checking, how nice:<br />
<div id="attachment_643" class="wp-caption alignnone" style="width: 310px"><a href="http://notes.benv.junerules.com/wp-content/uploads/2009/12/thunderbird-sieve-edit-script.png"><img src="http://notes.benv.junerules.com/wp-content/uploads/2009/12/thunderbird-sieve-edit-script-300x212.png" alt="Thunderbird Sieve plugin - edit script" title="Thunderbird Sieve plugin - edit script" width="300" height="212" class="size-medium wp-image-643" /></a><p class="wp-caption-text">Thunderbird Sieve plugin - edit script</p></div><br />
And underwater our log shows this:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">managesieve-login: Info: Login: <span style="color: #007800;">user</span>=<span style="color: #000000; font-weight: bold;">&lt;</span>benv-jemoeder<span style="color: #000000; font-weight: bold;">@</span>benv.junerules.com<span style="color: #000000; font-weight: bold;">&gt;</span>, <span style="color: #007800;">method</span>=PLAIN, <span style="color: #007800;">rip</span>=43.121.244.637, <span style="color: #007800;">lip</span>=280.649.21.50, TLS<br />
MANAGESIEVE<span style="color: #7a0874; font-weight: bold;">&#40;</span>benv-jemoeder<span style="color: #000000; font-weight: bold;">@</span>benv.junerules.com<span style="color: #7a0874; font-weight: bold;">&#41;</span>: Info: Effective <span style="color: #007800;">uid</span>=<span style="color: #000000;">89</span>, <span style="color: #007800;">gid</span>=<span style="color: #000000;">89</span>, <span style="color: #007800;">home</span>=<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>vpopmail<span style="color: #000000; font-weight: bold;">/</span>domains<span style="color: #000000; font-weight: bold;">/</span>benv.junerules.com<span style="color: #000000; font-weight: bold;">/</span>benv<br />
MANAGESIEVE<span style="color: #7a0874; font-weight: bold;">&#40;</span>benv-jemoeder<span style="color: #000000; font-weight: bold;">@</span>benv.junerules.com<span style="color: #7a0874; font-weight: bold;">&#41;</span>: Info: sieve-storage: using active sieve script path: <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>vpopmail<span style="color: #000000; font-weight: bold;">/</span>domains<span style="color: #000000; font-weight: bold;">/</span>benv.junerules.com<span style="color: #000000; font-weight: bold;">/</span>benv<span style="color: #000000; font-weight: bold;">/</span>.sieve<span style="color: #000000; font-weight: bold;">/</span>dovecot.sieve<br />
MANAGESIEVE<span style="color: #7a0874; font-weight: bold;">&#40;</span>benv-jemoeder<span style="color: #000000; font-weight: bold;">@</span>benv.junerules.com<span style="color: #7a0874; font-weight: bold;">&#41;</span>: Info: sieve-storage: using sieve script storage directory: <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>vpopmail<span style="color: #000000; font-weight: bold;">/</span>domains<span style="color: #000000; font-weight: bold;">/</span>benv.junerules.com<span style="color: #000000; font-weight: bold;">/</span>benv<span style="color: #000000; font-weight: bold;">/</span>.sieve<br />
MANAGESIEVE<span style="color: #7a0874; font-weight: bold;">&#40;</span>benv-jemoeder<span style="color: #000000; font-weight: bold;">@</span>benv.junerules.com<span style="color: #7a0874; font-weight: bold;">&#41;</span>: Info: sieve-storage: relative path to sieve storage <span style="color: #000000; font-weight: bold;">in</span> active <span style="color: #c20cb9; font-weight: bold;">link</span>:<br />
MANAGESIEVE<span style="color: #7a0874; font-weight: bold;">&#40;</span>benv-jemoeder<span style="color: #000000; font-weight: bold;">@</span>benv.junerules.com<span style="color: #7a0874; font-weight: bold;">&#41;</span>: Warning: sieve-storage: Active sieve script symlink <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>vpopmail<span style="color: #000000; font-weight: bold;">/</span>domains<span style="color: #000000; font-weight: bold;">/</span>benv.junerules.com<span style="color: #000000; font-weight: bold;">/</span>benv<span style="color: #000000; font-weight: bold;">/</span>.sieve<span style="color: #000000; font-weight: bold;">/</span>dovecot.sieve is<br />
&nbsp;no symlink.<br />
MANAGESIEVE<span style="color: #7a0874; font-weight: bold;">&#40;</span>benv-jemoeder<span style="color: #000000; font-weight: bold;">@</span>benv.junerules.com<span style="color: #7a0874; font-weight: bold;">&#41;</span>: Info: sieve-storage: Moved active sieve script <span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #ff0000;">'/home/vpopmail/domains/benv.junerules.com/benv/.sieve/dovecot.sieve'</span> <br />
to script storage <span style="color: #c20cb9; font-weight: bold;">as</span> <span style="color: #ff0000;">'/home/vpopmail/domains/benv.junerules.com/benv/.sieve/dovecot.orig.sieve'</span><br />
MANAGESIEVE<span style="color: #7a0874; font-weight: bold;">&#40;</span>benv-jemoeder<span style="color: #000000; font-weight: bold;">@</span>benv.junerules.com<span style="color: #7a0874; font-weight: bold;">&#41;</span>: Info: sieve-storage: nothing to rescue <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>vpopmail<span style="color: #000000; font-weight: bold;">/</span>domains<span style="color: #000000; font-weight: bold;">/</span>benv.junerules.com<span style="color: #000000; font-weight: bold;">/</span>benv<span style="color: #000000; font-weight: bold;">/</span>.sieve<span style="color: #000000; font-weight: bold;">/</span>dovecot.sieve.<br />
MANAGESIEVE<span style="color: #7a0874; font-weight: bold;">&#40;</span>benv-jemoeder<span style="color: #000000; font-weight: bold;">@</span>benv.junerules.com<span style="color: #7a0874; font-weight: bold;">&#41;</span>: Info: Disconnected: Logged out bytes <span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #007800;">in</span>=<span style="color: #000000;">746</span> : <span style="color: #007800;">out</span>=<span style="color: #000000;">1068</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span></div></div>
<p>Works like a charm. And yeah, those warnings can be ignored, they&#8217;re there because of my meddling with scripts yesterday. How should I know it had to be a symlink :-p<br />
(after this session it was indeed a symlink, hitting the &#8216;active&#8217; button made it so).</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.benv.junerules.com/all/software/managesieve/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Qmail + vpopmail + Dovecot and Sieve</title>
		<link>http://notes.benv.junerules.com/all/software/qmail-vpopmail-dovecot-and-sieve/</link>
		<comments>http://notes.benv.junerules.com/all/software/qmail-vpopmail-dovecot-and-sieve/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 22:11:47 +0000</pubDate>
		<dc:creator>BenV</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[dovecot]]></category>
		<category><![CDATA[qmail]]></category>
		<category><![CDATA[sieve]]></category>

		<guid isPermaLink="false">http://notes.benv.junerules.com/?p=621</guid>
		<description><![CDATA[Let&#8217;s start with a problem description. We start out with a -working- mailer: A pretty simple qmail/vpopmail installation with Courier IMAP and the pop3d that comes with qmail. This is administered by users with the qmailadmin frontend and allows for creation of mailboxes and forwards by postmasters. Together with spamdyke and spamassassin it works pretty [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s start with a problem description. We start out with a -working- mailer:<br />
A pretty simple qmail/vpopmail installation with Courier IMAP and the pop3d that comes with qmail. This is administered by users with the qmailadmin frontend and allows for creation of mailboxes and forwards by postmasters. Together with spamdyke and spamassassin it works pretty well. So why change it?</p>
<p>The problem: First of all, Courier is a piece of shit. The various parts of it have broken in various ways over the years (authd hanging for no apparent reason or suddenly eating a ton of memory, stuff like that). Not only that, but they decided that vpopmail wasn&#8217;t worth supporting anymore, so their latest release of courier-authlib simply doesn&#8217;t handle vpopmail anymore. (don&#8217;t ask me why, can&#8217;t find any details on it).<br />
Second of all, it would be cool to give our users the ability to create their own custom mail filters on our server. Stuff that you can do in thunderbird or through webmail, so they can setup their mailbox filters and vacation messages and whatever without me having to help them. (well&#8230;. we&#8217;ll see about that). Needless to say we could do that by giving them access to the .qmail files, but those are way out of their league. Not only that, it would be a security nightmare. So to solve that, we&#8217;re trying the <a href="http://en.wikipedia.org/wiki/Sieve_(mail_filtering_language)">Sieve</a> disaster. I mean language&#8230; or something.<span id="more-621"></span></p>
<p>Getting rid of Courier is really simple. Simply pull the harddisk out of your server and shake it a few times, then step on it and throw it out of the window (while still standing on top of it of course). If you did it properly you should now be wondering why the hell you follow instructions without thinking. However, if you do have a brain, you might want to shutdown the courier-imap* and pop* services and remove them from your disk. Tada.<br />
Personally I replaced the pop, imap and auth services with <a href="http://www.dovecot.org/">Dovecot</a>. If you&#8217;re running qmail like you&#8217;re supposed to this is pretty easy. Check out <a href="http://qmail.jms1.net/dovecot.shtml">this page by John Simpson</a> for details on that. Instructions for vpopmail included. (thanks again John!)</p>
<p>Now for the interesting part. Getting Sieve to work. I decided to get the latest shiny version from their hg repository, but feel free to take the latest stable version instead.</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root<span style="color: #000000; font-weight: bold;">@</span>black:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>dovecot-sieve$ hg clone http:<span style="color: #000000; font-weight: bold;">//</span>hg.rename-it.nl<span style="color: #000000; font-weight: bold;">/</span>dovecot-<span style="color: #000000;">1.2</span>-sieve dovecot-<span style="color: #000000;">1.2</span>-sieve-hg<br />
&nbsp;<span style="color: #000000; font-weight: bold;">*</span>clone meets clone<span style="color: #000000; font-weight: bold;">*</span><br />
root<span style="color: #000000; font-weight: bold;">@</span>black:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>dovecot-sieve$ <span style="color: #7a0874; font-weight: bold;">cd</span> dovecot-<span style="color: #000000;">1.2</span>-sieve-hg<br />
root<span style="color: #000000; font-weight: bold;">@</span>black:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>dovecot-sieve<span style="color: #000000; font-weight: bold;">/</span>dovecot-<span style="color: #000000;">1.2</span>-sieve-hg$ .<span style="color: #000000; font-weight: bold;">/</span>autogen.sh<br />
&nbsp;<span style="color: #000000; font-weight: bold;">*</span>skip that <span style="color: #000000; font-weight: bold;">if</span> you are using the stable version<span style="color: #000000; font-weight: bold;">*</span><br />
root<span style="color: #000000; font-weight: bold;">@</span>black:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>dovecot-sieve<span style="color: #000000; font-weight: bold;">/</span>dovecot-<span style="color: #000000;">1.2</span>-sieve-hg$ .<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>usr <span style="color: #660033;">--with-dovecot</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>dovecot-1.2.8<br />
root<span style="color: #000000; font-weight: bold;">@</span>black:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>dovecot-sieve<span style="color: #000000; font-weight: bold;">/</span>dovecot-<span style="color: #000000;">1.2</span>-sieve-hg$ <span style="color: #c20cb9; font-weight: bold;">make</span> ; <span style="color: #c20cb9; font-weight: bold;">mkdir</span> pkg ; <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #007800;">DESTDIR</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">pwd</span><span style="color: #000000; font-weight: bold;">`/</span>pkg <span style="color: #c20cb9; font-weight: bold;">install</span> ; <span style="color: #7a0874; font-weight: bold;">cd</span> pkg ; makepkg <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>packages<span style="color: #000000; font-weight: bold;">/</span>dovecot-sieve-i386-<span style="color: #000000;">1</span>.tgz</div></div>
<p>Now we still need to enable it. Make sure your <span style="color:#FF00FF">/etc/dovecot.conf</span> has a section like this:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">##</span><br />
<span style="color: #666666; font-style: italic;">## Local Delivery Agent stuff</span><br />
<span style="color: #666666; font-style: italic;">##</span><br />
protocol lda <span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; postmaster_address = postmaster<span style="color: #000000; font-weight: bold;">@</span>your.mother.isawhore.nl<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #c20cb9; font-weight: bold;">hostname</span> = mail.server.gov<br />
&nbsp; &nbsp; &nbsp; &nbsp; sendmail_path = <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>qmail<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">sendmail</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; mail_plugins = sieve<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; log_path = <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>dovecot-deliver-errors.log<br />
&nbsp; &nbsp; &nbsp; &nbsp; info_log_path = <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>dovecot-deliver.log<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #007800;">debug</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span><br />
<span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
auth default <span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># Your other garbage options here .... </span><br />
&nbsp; &nbsp; &nbsp; &nbsp; socket listen <span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; master <span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; path = <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>dovecot<span style="color: #000000; font-weight: bold;">/</span>auth-master<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mode = 0660<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; user = vpopmail<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; group = vchkpw<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
<span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
plugin <span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; sieve = ~<span style="color: #000000; font-weight: bold;">/</span>.sieve<span style="color: #000000; font-weight: bold;">/</span>dovecot.sieve<br />
&nbsp; &nbsp; &nbsp; &nbsp; sieve_dir = ~<span style="color: #000000; font-weight: bold;">/</span>.sieve<br />
&nbsp; &nbsp; &nbsp; &nbsp; sieve_global_dir = <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>dovecot<span style="color: #000000; font-weight: bold;">/</span>sieve<span style="color: #000000; font-weight: bold;">/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; sieve_subaddress_sep = -+<br />
<span style="color: #7a0874; font-weight: bold;">&#125;</span></div></div>
<p>Easy. This should make the <span style="color:#00FFAA">/usr/libexec/dovecot/deliver</span> program able to verify the account information of a requested user against the vpopmail database and it instructs the local delivery part to use the sieve plugin. (which I&#8217;ve configured some paths for).<br />
However, next part literally took me hours to figure out. I wanted to use the Dovecot LDA only for my test email account. So I created a .qmail file for my user &#8211; <a href="http://wiki.dovecot.org/LDA/Qmail">according to their wiki </a>:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root<span style="color: #000000; font-weight: bold;">@</span>black$ <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'|/var/qmail/bin/preline -f /usr/local/libexec/dovecot/deliver -d $EXT@$USER'</span> <span style="color: #000000; font-weight: bold;">&gt;</span> ~vpopmail<span style="color: #000000; font-weight: bold;">/</span>domains<span style="color: #000000; font-weight: bold;">/</span>benv.junerules.com<span style="color: #000000; font-weight: bold;">/</span>.qmail-benv-test<br />
root<span style="color: #000000; font-weight: bold;">@</span>black$ <span style="color: #c20cb9; font-weight: bold;">chown</span> vpopmail:vchkpw ~vpopmail<span style="color: #000000; font-weight: bold;">/</span>domains<span style="color: #000000; font-weight: bold;">/</span>benv.junerules.com<span style="color: #000000; font-weight: bold;">/</span>.qmail-benv-test</div></div>
<p>According to their wiki, this should be the correct way to invoke the deliver program. So I send a test mail to benv-test@benv.junerules.com &#8230;. nothing happens. Nothing in logs, nothing.<br />
Oh that&#8217;s a lie, the error log says:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">deliver<span style="color: #7a0874; font-weight: bold;">&#40;</span>benv-test<span style="color: #000000; font-weight: bold;">@</span>benv.junerules.com<span style="color: #7a0874; font-weight: bold;">&#41;</span>: Info: Loading modules from directory: <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>dovecot<span style="color: #000000; font-weight: bold;">/</span>lda<br />
deliver<span style="color: #7a0874; font-weight: bold;">&#40;</span>benv-test<span style="color: #000000; font-weight: bold;">@</span>benv.junerules.com<span style="color: #7a0874; font-weight: bold;">&#41;</span>: Info: Module loaded: <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>dovecot<span style="color: #000000; font-weight: bold;">/</span>lda<span style="color: #000000; font-weight: bold;">/</span>lib90_sieve_plugin.so</div></div>
<p>Of course it doesn&#8217;t work yet, I haven&#8217;t put a sieve filter in place yet. So I put a simple reject filter there so I know it works when it does <img src='http://notes.benv.junerules.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
This is the contents of a file <span style="color:#AAFF00">~vpopmail/domains/benv.junerules.com/benv/.sieve/dovecot.sieve</span>. <b>Corresponding with the dovecot.conf plugin settings</b>.</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">require <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #ff0000;">&quot;reject&quot;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>;<br />
<br />
reject <span style="color: #ff0000;">&quot;If you're getting this reject... it works. Also, your mom wears combat boots!&quot;</span>;</div></div>
<p>I send another mail. Same stuff in the logs. Mhm&#8230; more debugging would be great guys. I have no idea if it loads a sieve filter, from what directory or if it does anything at all! GRRRr.<br />
After a lot of cursing and throwing with plants and cats and hammers, I went through the mailing archives from the John&#8217;s qmail-patch list and found a snippet from someone else that set up something similar. Apparently the way to invoke the deliver program is different. Because I use the qmail extension addresses, benv-test@benv.junerules.com was given as user. However, vpopmail only knows about benv@benv.junerules.com, so it failed. Blegh.<br />
So for now I decided to use the solution offered by the mailinglist:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">|</span> <span style="color: #007800;">DTLINE</span>=<span style="color: #800000;">${DTLINE/$USER-}</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>qmail<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>preline <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>libexec<span style="color: #000000; font-weight: bold;">/</span>dovecot<span style="color: #000000; font-weight: bold;">/</span>deliver <span style="color: #660033;">-d</span> <span style="color: #800000;">${EXT/-*}</span><span style="color: #000000; font-weight: bold;">@</span><span style="color: #007800;">$USER</span> <span style="color: #660033;">-a</span> <span style="color: #007800;">$EXT</span><span style="color: #000000; font-weight: bold;">@</span><span style="color: #007800;">$USER</span></div></div>
<p>A little explanation on the environment variables. Normally when I send a message to benv-test@benv.junerules.com they look like this:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #007800;">HOST2</span>=benv.junerules<br />
<span style="color: #007800;">HOST3</span>=benv<br />
<span style="color: #007800;">RECIPIENT</span>=benv.junerules.com-benv-test<span style="color: #000000; font-weight: bold;">@</span>benv.junerules.com<br />
<span style="color: #007800;">HOST</span>=benv.junerules.com<br />
<span style="color: #007800;">DTLINE</span>=Delivered-To: benv.junerules.com-benv-test<span style="color: #000000; font-weight: bold;">@</span>benv.junerules.com<br />
<span style="color: #007800;">HOST4</span>=benv<br />
<span style="color: #007800;">USER</span>=benv.junerules.com<br />
<span style="color: #007800;">EXT</span>=benv-test<br />
<span style="color: #007800;">LOCAL</span>=benv.junerules.com-benv-test<br />
<span style="color: #007800;">SHLVL</span>=<span style="color: #000000;">2</span><br />
<span style="color: #007800;">EXT3</span>=<br />
<span style="color: #007800;">EXT2</span>=<span style="color: #7a0874; font-weight: bold;">test</span><br />
<span style="color: #007800;">EXT4</span>=</div></div>
<p>The DTLINE rewrite isn&#8217;t strictly necessary but looks a bit nicer in the logs. However, the EXT@USER part should not contain all the extensions since they won&#8217;t resolve to a vpopmail user.<br />
With the rewritten .qmail file I send another test email. Here&#8217;s the log:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">deliver<span style="color: #7a0874; font-weight: bold;">&#40;</span>benv<span style="color: #000000; font-weight: bold;">@</span>benv.junerules.com<span style="color: #7a0874; font-weight: bold;">&#41;</span>: Info: Loading modules from directory: <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>dovecot<span style="color: #000000; font-weight: bold;">/</span>lda<br />
deliver<span style="color: #7a0874; font-weight: bold;">&#40;</span>benv<span style="color: #000000; font-weight: bold;">@</span>benv.junerules.com<span style="color: #7a0874; font-weight: bold;">&#41;</span>: Info: Module loaded: <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>dovecot<span style="color: #000000; font-weight: bold;">/</span>lda<span style="color: #000000; font-weight: bold;">/</span>lib90_sieve_plugin.so<br />
deliver<span style="color: #7a0874; font-weight: bold;">&#40;</span>benv<span style="color: #000000; font-weight: bold;">@</span>benv.junerules.com<span style="color: #7a0874; font-weight: bold;">&#41;</span>: Info: auth input: <span style="color: #007800;">uid</span>=<span style="color: #000000;">89</span><br />
deliver<span style="color: #7a0874; font-weight: bold;">&#40;</span>benv<span style="color: #000000; font-weight: bold;">@</span>benv.junerules.com<span style="color: #7a0874; font-weight: bold;">&#41;</span>: Info: auth input: <span style="color: #007800;">gid</span>=<span style="color: #000000;">89</span><br />
deliver<span style="color: #7a0874; font-weight: bold;">&#40;</span>benv<span style="color: #000000; font-weight: bold;">@</span>benv.junerules.com<span style="color: #7a0874; font-weight: bold;">&#41;</span>: Info: auth input: <span style="color: #007800;">home</span>=<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>vpopmail<span style="color: #000000; font-weight: bold;">/</span>domains<span style="color: #000000; font-weight: bold;">/</span>benv.junerules.com<span style="color: #000000; font-weight: bold;">/</span>benv<br />
deliver<span style="color: #7a0874; font-weight: bold;">&#40;</span>benv<span style="color: #000000; font-weight: bold;">@</span>benv.junerules.com<span style="color: #7a0874; font-weight: bold;">&#41;</span>: Info: Namespace: <span style="color: #007800;">type</span>=private, <span style="color: #007800;">prefix</span>=INBOX., <span style="color: #007800;">sep</span>=., <span style="color: #007800;">inbox</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span>, <span style="color: #007800;">hidden</span>=no, <span style="color: #007800;">list</span>=<span style="color: #000000;">1</span>, <span style="color: #007800;">subscriptions</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span><br />
deliver<span style="color: #7a0874; font-weight: bold;">&#40;</span>benv<span style="color: #000000; font-weight: bold;">@</span>benv.junerules.com<span style="color: #7a0874; font-weight: bold;">&#41;</span>: Info: maildir: <span style="color: #007800;">data</span>=<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>vpopmail<span style="color: #000000; font-weight: bold;">/</span>domains<span style="color: #000000; font-weight: bold;">/</span>benv.junerules.com<span style="color: #000000; font-weight: bold;">/</span>benv<span style="color: #000000; font-weight: bold;">/</span>Maildir<br />
deliver<span style="color: #7a0874; font-weight: bold;">&#40;</span>benv<span style="color: #000000; font-weight: bold;">@</span>benv.junerules.com<span style="color: #7a0874; font-weight: bold;">&#41;</span>: Info: maildir++: <span style="color: #007800;">root</span>=<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>vpopmail<span style="color: #000000; font-weight: bold;">/</span>domains<span style="color: #000000; font-weight: bold;">/</span>benv.junerules.com<span style="color: #000000; font-weight: bold;">/</span>benv<span style="color: #000000; font-weight: bold;">/</span>Maildir, <span style="color: #007800;">index</span>=, <span style="color: #007800;">control</span>=, <span style="color: #007800;">inbox</span>=<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>vpopmail<span style="color: #000000; font-weight: bold;">/</span>domains<span style="color: #000000; font-weight: bold;">/</span>benv.junerules.com<span style="color: #000000; font-weight: bold;">/</span>benv<span style="color: #000000; font-weight: bold;">/</span>Mai<br />
ldir<br />
deliver<span style="color: #7a0874; font-weight: bold;">&#40;</span>benv<span style="color: #000000; font-weight: bold;">@</span>benv.junerules.com<span style="color: #7a0874; font-weight: bold;">&#41;</span>: Info: sieve: using sieve path <span style="color: #000000; font-weight: bold;">for</span> user<span style="color: #ff0000;">'s script: /home/vpopmail/domains/benv.junerules.com/benv/.sieve/dovecot.sieve<br />
deliver(benv@benv.junerules.com): Info: sieve: opening script /home/vpopmail/domains/benv.junerules.com/benv/.sieve/dovecot.sieve<br />
deliver(benv@benv.junerules.com): Info: sieve: executing compiled script /home/vpopmail/domains/benv.junerules.com/benv/.sieve/dovecot.sieve<br />
deliver(benv@benv.junerules.com): Info: sieve: msgid=&lt;20091207214454.GJ9038@uil.winnipeg.nl&gt;: rejected message from &lt;benv-rotnaarjegraf@junerules.com&gt; (reject)</span></div></div>
<p>Woohoo, it rejected! <img src='http://notes.benv.junerules.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /><br />
So Sieve works. Next thing to do is to get ManageSieve up and running and test it with thunderbird and <a href="https://addons.mozilla.org/en-US/thunderbird/addon/2548">some sieve addons</a><br />
But that&#8217;s a rant for later, my eyes are collapsing.</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.benv.junerules.com/all/software/qmail-vpopmail-dovecot-and-sieve/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
