Discussion:
[Dovecot] Using global und per-user sieve scripts at the same time
Matthias Kellermann
2007-11-26 13:50:00 UTC
Permalink
Hi list,

I'm trying to get a global sieve mailfilter with per-user sieve scripts
to work.

At the "lda"-section in the dovecot.conf file I have:
global_script_path = /usr/local/etc/sieve/spam

/usr/local/etc/sieve/spam:
require "fileinto";

if header :contains ["Subject"] ["***Spam***"] {
fileinto "Spam";
stop;
}

which will work fine delivering Spam Mails in a Spam dir for every user.
If a user creates his own .dovecot.sieve file the global script will not
work anymore.

How can I enable global and local per-user sieve scripts at once? Is
this possible? Do you know any workaround so all users will have the
same (Spam-)sieve filters beside there own (global templates or so)?

Matthias
Nikolay Shopik
2007-11-26 13:51:05 UTC
Permalink
Post by Matthias Kellermann
Hi list,
I'm trying to get a global sieve mailfilter with per-user sieve scripts
to work.
global_script_path = /usr/local/etc/sieve/spam
require "fileinto";
if header :contains ["Subject"] ["***Spam***"] {
fileinto "Spam";
stop;
}
which will work fine delivering Spam Mails in a Spam dir for every user.
If a user creates his own .dovecot.sieve file the global script will not
work anymore.
How can I enable global and local per-user sieve scripts at once? Is
this possible? Do you know any workaround so all users will have the
same (Spam-)sieve filters beside there own (global templates or so)?
Matthias
You forgot to insert this one, where users sieve files stored.

plugin {
sieve = /var/mail/store/%u/sieve
}
Matthias Kellermann
2007-11-26 15:57:21 UTC
Permalink
Post by Nikolay Shopik
You forgot to insert this one, where users sieve files stored.
plugin {
sieve = /var/mail/store/%u/sieve
}
Thanks for your answer Nikolay. But I think this won't do the trick.
This setting will override the global setting as well. At the moment I'm
using the default location for the sieve scripts in the user's home dir.

Matthias
Nikolay Shopik
2007-11-26 15:59:37 UTC
Permalink
Post by Matthias Kellermann
Post by Nikolay Shopik
You forgot to insert this one, where users sieve files stored.
plugin {
sieve = /var/mail/store/%u/sieve
}
Thanks for your answer Nikolay. But I think this won't do the trick.
This setting will override the global setting as well. At the moment I'm
using the default location for the sieve scripts in the user's home dir.
Matthias
Very strange but in my case global rules still works even if user have
their own sieve rules. So spam still moved to junk folder ;).
Matthias Kellermann
2007-11-27 07:23:45 UTC
Permalink
Post by Nikolay Shopik
Post by Matthias Kellermann
Post by Nikolay Shopik
You forgot to insert this one, where users sieve files stored.
plugin {
sieve = /var/mail/store/%u/sieve
}
Thanks for your answer Nikolay. But I think this won't do the trick.
This setting will override the global setting as well. At the moment I'm
using the default location for the sieve scripts in the user's home dir.
Matthias
Very strange but in my case global rules still works even if user have
their own sieve rules. So spam still moved to junk folder ;).
Hmm, so you have an entry like this in your LDA section:

global_script_path = /usr/local/etc/sieve/spam

Where spam is the file with the global sieve rules. Then you have the
following entry in the plugin section:

sieve = /var/mail/store/%u/sieve

Where sieve ist the per-user sieve file, right? Is /var/mail/store the
same location where you save the user's email?

Matthias
Nikolay Shopik
2007-11-27 08:16:59 UTC
Permalink
Post by Matthias Kellermann
Post by Nikolay Shopik
Post by Matthias Kellermann
Post by Nikolay Shopik
You forgot to insert this one, where users sieve files stored.
plugin {
sieve = /var/mail/store/%u/sieve
}
Thanks for your answer Nikolay. But I think this won't do the trick.
This setting will override the global setting as well. At the moment I'm
using the default location for the sieve scripts in the user's home dir.
Matthias
Very strange but in my case global rules still works even if user have
their own sieve rules. So spam still moved to junk folder ;).
global_script_path = /usr/local/etc/sieve/spam
Where spam is the file with the global sieve rules. Then you have the
sieve = /var/mail/store/%u/sieve
Where sieve ist the per-user sieve file, right? Is /var/mail/store the
same location where you save the user's email?
Matthias
Well my global script path little bit different,
sieve_global_path = /var/mail/sieve/global.sieve
but it doesn't really matter.

Yes that's is correct /var/mail/store is path of my maildir store
with users folders inside.
Matthias Kellermann
2007-12-10 15:46:57 UTC
Permalink
Hi list,

I'm still trying to get global and per-user sieve scripts to work. With
no success yet.

This is what I've got for the moment:

dovecot.conf
-----------------------------------------------
protocol lda {
postmaster_address = postmaster at mydomain.tld
fsync_disable = no
mail_plugins = cmusieve quota
mail_plugin_dir = /usr/local/lib/dovecot/lda
sieve_global_path = /usr/local/etc/sieve/spam
sendmail_path = /usr/sbin/sendmail
auth_socket_path = /var/run/dovecot/auth-master
}

plugin {
sieve = /usr/mail/%Lu/sieve
}
-----------------------------------------------


/usr/local/etc/sieve/spam:
-----------------------------------------------
require "fileinto";

if header :contains ["Subject"] ["***Spam***"] {
fileinto "Spam";
stop;
}
-----------------------------------------------

If I enable sieve_global_path and sieve in plugin section only the user
sieve script is working. If I enable only the sieve_global_path setting
this one is working. Both at the same time won't work. Dovecot version
is 1.0.7.

Is there really a way to get this to work under Dovecot 1.0.7?

Matthias
Timo Sirainen
2007-12-10 15:54:58 UTC
Permalink
Post by Matthias Kellermann
I'm still trying to get global and per-user sieve scripts to work. With
no success yet.
..
Post by Matthias Kellermann
Is there really a way to get this to work under Dovecot 1.0.7?
Not by changing settings. Sieve plugin v1.0 can run only a single
script.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://dovecot.org/pipermail/dovecot/attachments/20071210/98fd0ffc/attachment-0001.bin
Xueron Nee
2007-12-11 15:16:16 UTC
Permalink
Hi Timo Sirainen,

It's said that v1.1 support include:

include (v1.1 only)
see: http://wiki.dovecot.org/LDA/Sieve

will it work for such requirement?
Post by Timo Sirainen
Post by Matthias Kellermann
I'm still trying to get global and per-user sieve scripts to work. With
no success yet.
.
Post by Matthias Kellermann
Is there really a way to get this to work under Dovecot 1.0.7?
Not by changing settings. Sieve plugin v1.0 can run only a single
script.
--
Xueron Nee
Timo Sirainen
2007-11-26 14:17:43 UTC
Permalink
Post by Matthias Kellermann
If a user creates his own .dovecot.sieve file the global script will not
work anymore.
How can I enable global and local per-user sieve scripts at once? Is
this possible?
Unfortunately not. Sieve plugin v1.1 (requires Dovecot v1.1) supports
include extension, so in per-user scripts they could include the global
script. It should probably be somewhat easy to do this including
automatically.

(Actually I'm hoping to offload Sieve development to Stephan Bosch and
his completely rewritten Sieve code. I don't know when it's going to be
in a usable state though. And I hope the code's existence wasn't a
secret.. :)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://dovecot.org/pipermail/dovecot/attachments/20071126/05a13b66/attachment.bin
Matthias Kellermann
2007-11-26 15:55:18 UTC
Permalink
Post by Timo Sirainen
Post by Matthias Kellermann
If a user creates his own .dovecot.sieve file the global script will not
work anymore.
How can I enable global and local per-user sieve scripts at once? Is
this possible?
Unfortunately not. Sieve plugin v1.1 (requires Dovecot v1.1) supports
include extension, so in per-user scripts they could include the global
script. It should probably be somewhat easy to do this including
automatically.
It's Dovecot 1.07 on FreeBSD. So there is no include option. So I will
write a little script which will copy a template sieve file in each
users home directory on/after creation.
Post by Timo Sirainen
(Actually I'm hoping to offload Sieve development to Stephan Bosch and
his completely rewritten Sieve code. I don't know when it's going to be
in a usable state though. And I hope the code's existence wasn't a
secret.. :)
Is that sieve implementation better than the current one (fork of Cyrus
sieve implementation if I remember correctly)?

Matthias
Mark E. Mallett
2007-11-27 13:19:01 UTC
Permalink
Post by Timo Sirainen
Post by Matthias Kellermann
If a user creates his own .dovecot.sieve file the global script will not
work anymore.
How can I enable global and local per-user sieve scripts at once? Is
this possible?
Unfortunately not. Sieve plugin v1.1 (requires Dovecot v1.1) supports
include extension, so in per-user scripts they could include the global
script. It should probably be somewhat easy to do this including
automatically.
(Actually I'm hoping to offload Sieve development to Stephan Bosch and
his completely rewritten Sieve code. I don't know when it's going to be
in a usable state though. And I hope the code's existence wasn't a
secret.. :)
That is cool... more implementations are better.

FWIW I've liberated (as in, made into a library) my own language
implementation (which includes Sieve as a subset, but can be used at
runtime as Sieve-only and could probably be made Sieve-only at compile
time). This is an effort I did to help make the language implementation
more standalone and easier to work on. Currently it's only in a private
area but will likely be used (and thus be availble) in the next
(approximately year-end) release of the package of programs that use
this language.

It would be interesting to have some kind of standard API for Sieve
libraries, but I do wonder how feasible that would be.

mm
Loading...