On 03/21/2017 11:32 AM, chaouche yacine wrote:>> On Tuesday, March 21, 2017 3:03 PM, Robert Moskowitz <rgm at
htt-consult.com> wrote:
>> On 03/21/2017 09:06 AM, chaouche yacine wrote:
>>> 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.
>> I don't get that reading:
>> https://wiki2.dovecot.org/Pigeonhole/Sieve/Configuration
>>
>> Either file or directory. If a file, it searches for the svbin of that
>> name, otherwise compiles your script. If directory, executes all in
the
>>
>> directory.
> 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."
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