Trying to do antispam with Sieve
Adi Pircalabu
adi at ddns.com.au
Wed Nov 14 04:51:53 EET 2018
On 2018-11-14 13:11, Adi Pircalabu wrote:
> Hi,
>
> Using https://wiki.dovecot.org/HowTo/AntispamWithSieve I'm trying to
> execute scripts when moving to/from Spam folder, however nothing's
> happening. The actions are:
> 1. Move to Spam: redirect :copy "spamcop_spam at domain.local";
> 2. Move from Spam: redirect :copy "spamcop_ham at domain.local";
[...]
> /usr/lib64/dovecot/sieve/report-spam.sieve contains:
> require ["vnd.dovecot.pipe", "copy", "imapsieve", "environment",
> "variables"];
> redirect :copy "spamcop_spam at domain.local";
> /usr/lib64/dovecot/sieve/report-ham.sieve contains:
> require ["vnd.dovecot.pipe", "copy", "imapsieve", "environment",
> "variables"];
> redirect :copy "spamcop_ham at domain.local";
More information after enabling mail_debug, in maillog I see:
Nov 14 13:41:52 plesk12 dovecot: service=imap, user=adi1 at adit1.local,
ip=[::1]. Debug: Module loaded:
/usr/libexec/dovecot/modules/lib95_imap_sieve_plugin.so
Nov 14 13:41:52 plesk12 dovecot: service=imap, user=adi1 at adit1.local,
ip=[::1]. Debug: imapsieve: Mail set keywords
Nov 14 13:41:52 plesk12 dovecot: service=imap, user=adi1 at adit1.local,
ip=[::1]. Debug: imapsieve: mailbox INBOX.Spam: FLAG event (changed
flags: Junk)
Nov 14 13:41:52 plesk12 dovecot: service=imap, user=adi1 at adit1.local,
ip=[::1]. Debug: sieve: Pigeonhole version 0.4.16 (fed8554) initializing
Nov 14 13:41:52 plesk12 dovecot: service=imap, user=adi1 at adit1.local,
ip=[::1]. Debug: sieve: include: sieve_global is not set; it is
currently not possible to include `:global' scripts.
Nov 14 13:41:52 plesk12 dovecot: service=imap, user=adi1 at adit1.local,
ip=[::1]. Debug: sieve: Sieve imapsieve plugin for Pigeonhole version
0.4.16 (fed8554) loaded
Nov 14 13:41:52 plesk12 dovecot: service=imap, user=adi1 at adit1.local,
ip=[::1]. Debug: sieve: Sieve Extprograms plugin for Pigeonhole version
0.4.16 (fed8554) loaded
Nov 14 13:41:52 plesk12 dovecot: service=imap, user=adi1 at adit1.local,
ip=[::1]. Debug: imapsieve: Static mailbox rule [1]: mailbox=`Spam'
from=`*' causes=(COPY) =>
before=`file:/usr/lib64/dovecot/sieve/report-spam.sieve' after=(none)
Nov 14 13:41:52 plesk12 dovecot: service=imap, user=adi1 at adit1.local,
ip=[::1]. Debug: imapsieve: Static mailbox rule [2]: mailbox=`*'
from=`Spam' causes=(COPY) =>
before=`file:/usr/lib64/dovecot/sieve/report-ham.sieve' after=(none)
Nov 14 13:41:52 plesk12 dovecot: service=imap, user=adi1 at adit1.local,
ip=[::1]. Debug: Module loaded:
/usr/libexec/dovecot/modules/lib95_imap_sieve_plugin.so
Nov 14 13:41:52 plesk12 dovecot: service=imap, user=adi1 at adit1.local,
ip=[::1]. Debug: imapsieve: mailbox INBOX: MOVE event
Nov 14 13:41:52 plesk12 dovecot: service=imap, user=adi1 at adit1.local,
ip=[::1]. Debug: sieve: Pigeonhole version 0.4.16 (fed8554) initializing
Nov 14 13:41:52 plesk12 dovecot: service=imap, user=adi1 at adit1.local,
ip=[::1]. Debug: sieve: include: sieve_global is not set; it is
currently not possible to include `:global' scripts.
Nov 14 13:41:52 plesk12 dovecot: service=imap, user=adi1 at adit1.local,
ip=[::1]. Debug: sieve: Sieve imapsieve plugin for Pigeonhole version
0.4.16 (fed8554) loaded
Nov 14 13:41:52 plesk12 dovecot: service=imap, user=adi1 at adit1.local,
ip=[::1]. Debug: sieve: Sieve Extprograms plugin for Pigeonhole version
0.4.16 (fed8554) loaded
Nov 14 13:41:52 plesk12 dovecot: service=imap, user=adi1 at adit1.local,
ip=[::1]. Debug: imapsieve: Static mailbox rule [1]: mailbox=`Spam'
from=`*' causes=(COPY) =>
before=`file:/usr/lib64/dovecot/sieve/report-spam.sieve' after=(none)
Nov 14 13:41:52 plesk12 dovecot: service=imap, user=adi1 at adit1.local,
ip=[::1]. Debug: imapsieve: Static mailbox rule [2]: mailbox=`*'
from=`Spam' causes=(COPY) =>
before=`file:/usr/lib64/dovecot/sieve/report-ham.sieve' after=(none)
So imapsieve "sees" the configuration, then I went and enabled debugging
in the 2 sieve scripts which now read:
1. /usr/lib64/dovecot/sieve/report-spam.sieve
require ["vnd.dovecot.pipe", "copy", "imapsieve", "vnd.dovecot.debug"];
debug_log "/var/tmp/report-spam.sieve.debug";
redirect :copy "spamcop_spam at domain.local";
2. /usr/lib64/dovecot/sieve/report-ham.sieve
require ["vnd.dovecot.pipe", "copy", "imapsieve", "vnd.dovecot.debug"];
debug_log "/var/tmp/report-ham.sieve.debug";
redirect :copy "spamcop_ham at domain.local";
Should I expect to see debugging in /var/tmp/report-ham.sieve.debug and
/var/tmp/report-spam.sieve.debug, respectively? The 2 files aren't
created, nothing in that directory.
BTW, getenforce=Disabled.
--
Adi Pircalabu
More information about the dovecot
mailing list