Problem with sieve_before
Hi All,
I cannot get the sieve_before to work. I have dovecot & sieve
installed on Debian 7 as follows
/etc/dovecot/conf.d/90-sieve.conf :
plugin {
The path to the user's main active script. If ManageSieve is used, this the
location of the symbolic link controlled by ManageSieve.
sieve = ~/.dovecot.sieve
The default Sieve script when the user has none. This is a path to a global
sieve script file, which gets executed ONLY if user's private Sieve script
doesn't exist. Be sure to pre-compile this script manually using the sievec
command line tool.
--> See sieve_before fore executing scripts before the user's personal
script.
sieve_default = /var/lib/dovecot/sieve/default.sieve
Directory for :personal include scripts for the include extension. This
is also where the ManageSieve service stores the user's scripts.
sieve_dir = ~/sieve/
Directory for :global include scripts for the include extension.
sieve_global_dir = /var/lib/dovecot/sieve/
Path to a script file or a directory containing script files that
need to be
executed before the user's script. If the path points to a directory, all
the Sieve scripts contained therein (with the proper .sieve extension) are
executed. The order of execution within a directory is determined by the
file names, using a normal 8bit per-character comparison. Multiple script
file or directory paths can be specified by appending an increasing number.
sieve_before = /var/lib/dovecot/sieve/before #####sieve_before2 = /var/lib/dovecot/sieve/before/default2.sieve #sieve_before3 = (etc...)
Identical to sieve_before, only the specified scripts are executed
after the
user's script (only when keep is still in effect!). Multiple script file or
directory paths can be specified by appending an increasing number.
#sieve_after = #sieve_after2 = #sieve_after2 = (etc...)
Which Sieve language extensions are available to users. By default, all
supported extensions are available, except for deprecated extensions or
those that are still under development. Some system administrators may want
to disable certain Sieve extensions or enable those that are not available
by default. This setting can use '+' and '-' to specify
differences relative
to the default. For example `sieve_extensions = +imapflags' will enable the
deprecated imapflags extension in addition to all extensions were already
enabled by default.
#sieve_extensions = +notify +imapflags ................................. In /var/lib/dovecot/sieve/before I have : drwxrwxrwx 3 mail mail 4096 Mar 20 23:47 .. -rw-rw-rw- 1 root root 195 Mar 21 09:57 default2.svbin -rwxrwxrwx 1 mail mail 157 Mar 21 11:12 default2.sieve default2.sieve is as follows: require ["fileinto"]; if allof (header :matches "subject" "*JUNK*") { fileinto "INBOX.Junk"; } The users personal filters work. Thanks for your help.
Please consider the environment before printing this email. Ger
Hi Ger,
sieve_before should be a path to sieve script file, not to a directory. in your configuration, you set sieve_before to /var/lib/dovecot/sieve/before which is a directory.
what you need to do is figure out which sieve script you'd like to execute and its path rather. If you think that default2.sieve is the right script then
set sieve_before to /var/lib/dovecot/sieve/before/default2.sieve
-- Yassine.
On Tuesday, March 21, 2017 12:56 PM, Ger Hooton Scoil Chroí Íosa Blarney <ghooton@scins.ie> wrote:
Hi All, [...]
Well spotted Robert, I didn't know that. It also says here https://wiki2.dovecot.org/Pigeonhole/Sieve/Usage#scriptcompile that one must be aware of permission issues with auto-compiled scripts : if the system user used by sieve to compile the script doesn't have write access to the directory where the script lives then it can't write the compiled version in that location. This is why one should consider pre-compiling scripts himself to make sure the compiled version is written to disk
As mentionned in the link you gave :
"IMPORTANT: Be sure to manually pre-compile the scripts specified by sieve_before and sieve_after using the sievec tool, as explained here."
-- Yassine
On 03/21/2017 11:32 AM, chaouche yacine wrote:
The howto I am making has: mkdir /home/sieve cat <<EOF>/home/sieve/globalfilter.sieve || exit 1 require "fileinto"; if anyof ( header :contains "X-Spam-Flag" "YES", header :contains "subject" "***SPAM***" ) { fileinto "Spam"; } EOF sievec /home/sieve/globalfilter.sieve chown -R vmail:mail /home/sieve With: sed -i -e "s/#sieve_before =/sieve_before = \/home\/sieve\/globalfilter.sieve/w /dev/stdout" /etc/dovecot/conf.d/90-sieve.conf
On Tuesday, March 21, 2017 7:07 PM, Robert Moskowitz <rgm@htt-consult.com> wrote:
I notice you are creating a sieve directory in /home/ as if it was a system user, then you change ownership to vmail. I would create the sieve directory directly in /home/vmail or whatever $HOME vmail user has (mine is /var/vmail). But that's just my particular taste :)
On 03/22/2017 04:25 AM, chaouche yacine wrote:
I picked this up years ago from another howto. Lots of pieces of his work, I am reworking. I can see your point. I t puts all the mail related stuff into /home/vmail for backups, rather than the /home backup. I would have to change managesieve the same so that user sieves go there too. No big deal.
Must think on this.
thanks
Hi Yassine,
That did not work, is there a way to see is the script is been run?
----------------original message-----------------
From:chaouche yacine [yacinechaouche@yahoo.com ]
To:Ger Hooton Scoil Chroí Íosa Blarney [ghooton@scins.ie ],
dovecot@dovecot.org Date:Tue, 21 Mar 2017 13:06:14 +0000 (UTC)
Please consider the environment before printing this email. Ger Hooton Systems Administrator Scoil Chroí Íosa Blarney. Blarney. Co. Cork
Thanks Robert, how do I do that?
----------------original message-----------------
From:Robert Moskowitz [rgm@htt-consult.com ]
To:Ger Hooton Scoil Chroí Íosa Blarney [ghooton@scins.ie ], chaouche
yacine [yacinechaouche@yahoo.com ], dovecot@dovecot.org Date:Tue, 21
Mar 2017 09:47:18 -0400
Please consider the environment before printing this email. Ger Hooton Systems Administrator Scoil Chroí Íosa Blarney. Blarney. Co. Cork
I did chmod -R 777 /var/lib/dovecot and it worked. I just need to figure out what the correct setting are. Thanks everyone //Ger
----------------original message-----------------
From:Ger Hooton Scoil Chroí Íosa Blarney [ghooton@scins.ie ]
To:Robert Moskowitz [rgm@htt-consult.com ], chaouche yacine
[yacinechaouche@yahoo.com ], dovecot@dovecot.org Date:Tue, 21 Mar 2017
14:05:17 +0000
Please consider the environment before printing this email. Ger Hooton Systems Administrator Scoil Chroí Íosa Blarney. Blarney. Co. Cork
ownership may also have been the issue, but we will no know what the permissions were before you changed them.
I would have tried
chown -R vmail:mail /var/lib/dovecot
Where vmail:mail is the user:group dovecot is running with. This is how I do it.
On 03/21/2017 10:14 AM, Ger Hooton Scoil Chroí Íosa Blarney wrote:
I have a backup so I can look at that.
----------------original message-----------------
From:Robert Moskowitz [rgm@htt-consult.com ]
To:Ger Hooton Scoil Chroí Íosa Blarney [ghooton@scins.ie ], chaouche
yacine [yacinechaouche@yahoo.com ], dovecot@dovecot.org Date:Tue, 21
Mar 2017 10:20:34 -0400
Please consider the environment before printing this email. Ger Hooton Systems Administrator Scoil Chroí Íosa Blarney. Blarney. Co. Cork
On my Debian 7 system I do not have a uid vmail
----------------original message-----------------
From:Robert Moskowitz [rgm@htt-consult.com ]
To:Ger Hooton Scoil Chroí Íosa Blarney [ghooton@scins.ie ], chaouche
yacine [yacinechaouche@yahoo.com ], dovecot@dovecot.org Date:Tue, 21
Mar 2017 10:20:34 -0400
Please consider the environment before printing this email. Ger Hooton Systems Administrator Scoil Chroí Íosa Blarney. Blarney. Co. Cork
participants (3)
-
chaouche yacine
-
Ger Hooton Scoil Chroí Íosa Blarney
-
Robert Moskowitz