Setting up sieve with spam learning
Cribbing from the dovecot site I recently added the following lines to my dovecot.conf:
managesieve_notify_capability = mailto managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date index ihave duplicate mime foreverypart extracttext imapsieve vnd.dovecot.imapsieve
plugin { imapsieve_mailbox1_before = file:/usr/lib/dovecot/sieve/report-spam.sieve imapsieve_mailbox1_causes = COPY imapsieve_mailbox1_name = Junk imapsieve_mailbox2_before = file:/usr/lib/dovecot/sieve/report-ham.sieve imapsieve_mailbox2_causes = COPY imapsieve_mailbox2_from = Junk imapsieve_mailbox2_name = * sieve_global_extensions = +vnd.dovecot.pipe +vnd.dovecot.environment sieve_pipe_bin_dir = /usr/lib/dovecot/sieve sieve_plugins = sieve_imapsieve sieve_extprograms }
protocol imap { mail_plugins = " virtual imap_sieve" }
Now, should I see the report-spam or report-ham sieve's logged anywhere? Because I am not seeing them.
On 2018-02-12 (19:24 MST), @lbutlr kremels@kreme.com wrote:
Cribbing from the dovecot site I recently added the following lines to my dovecot.conf:
managesieve_notify_capability = mailto managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date index ihave duplicate mime foreverypart extracttext imapsieve vnd.dovecot.imapsieve
plugin { imapsieve_mailbox1_before = file:/usr/lib/dovecot/sieve/report-spam.sieve imapsieve_mailbox1_causes = COPY imapsieve_mailbox1_name = Junk imapsieve_mailbox2_before = file:/usr/lib/dovecot/sieve/report-ham.sieve imapsieve_mailbox2_causes = COPY imapsieve_mailbox2_from = Junk imapsieve_mailbox2_name = * sieve_global_extensions = +vnd.dovecot.pipe +vnd.dovecot.environment sieve_pipe_bin_dir = /usr/lib/dovecot/sieve sieve_plugins = sieve_imapsieve sieve_extprograms }
protocol imap { mail_plugins = " virtual imap_sieve" }
Now, should I see the report-spam or report-ham sieve's logged anywhere? Because I am not seeing them.
I did find some logging after looking more carefully:
Feb 12 19:29:31 mail dovecot: imap(kreme): Error: sieve: report-spam: line 7: pipe command: invalid program name '/usr/local/bin/sa-learn-spam.sh' Feb 12 19:29:31 mail dovecot: imap(kreme): Error: sieve: report-spam: validation failed Feb 12 19:29:31 mail dovecot: imap(kreme): Error: sieve: Failed to compile script `/usr/lib/dovecot/sieve/report-spam.sieve' Feb 12 19:29:31 mail dovecot: imap(kreme): sieve: left message in mailbox 'Junk'
# ls -ls /usr/local/bin/sa-learn-spam.sh 8 -rwx--x--x 1 root wheel 54 Jan 23 18:12 /usr/local/bin/sa-learn-spam.sh
# ls -lsa /usr/lib/dovecot/sieve/ total 40 8 drwxrwxrwx 2 root wheel 512 Feb 12 19:29 . 8 drwxr-xr-x 3 root wheel 512 Jan 23 18:08 .. 8 -rw-r--r-- 1 root wheel 329 Feb 12 19:29 report-ham.sieve 8 -rw-r--r-- 1 root wheel 214 Feb 12 19:28 report-spam.sieve 8 -rw-r--r-- 1 kreme wheel 354 Feb 12 19:27 report-spam.svbin
# cat /usr/local/bin/sa-learn-spam.sh #!/bin/sh exec /usr/local/bin/sa-learn -u ${1} --spam
-- "He has all the virtues I dislike and none of the vices I admire." Winston Churchill
Make sure you sievec the sieve global scripts.
-- Larry Rosenman http://www.lerctr.org/~ler Phone: +1 214-642-9640 E-Mail: larryrtx@gmail.com US Mail: 5708 Sabbia Drive, Round Rock, TX 78665-2106
On 2/12/18, 8:41 PM, "dovecot on behalf of @lbutlr"
On 2018-02-12 (19:24 MST), @lbutlr <kremels@kreme.com> wrote:
>
> Cribbing from the dovecot site I recently added the following lines to my dovecot.conf:
>
> managesieve_notify_capability = mailto
> managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date index ihave duplicate mime foreverypart extracttext imapsieve vnd.dovecot.imapsieve
>
> plugin {
> imapsieve_mailbox1_before = file:/usr/lib/dovecot/sieve/report-spam.sieve
> imapsieve_mailbox1_causes = COPY
> imapsieve_mailbox1_name = Junk
> imapsieve_mailbox2_before = file:/usr/lib/dovecot/sieve/report-ham.sieve
> imapsieve_mailbox2_causes = COPY
> imapsieve_mailbox2_from = Junk
> imapsieve_mailbox2_name = *
> sieve_global_extensions = +vnd.dovecot.pipe +vnd.dovecot.environment
> sieve_pipe_bin_dir = /usr/lib/dovecot/sieve
> sieve_plugins = sieve_imapsieve sieve_extprograms
> }
>
> protocol imap {
> mail_plugins = " virtual imap_sieve"
> }
>
> Now, should I see the report-spam or report-ham sieve's logged anywhere? Because I am not seeing them.
I did find some logging after looking more carefully:
Feb 12 19:29:31 mail dovecot: imap(kreme): Error: sieve: report-spam: line 7: pipe command: invalid program name '/usr/local/bin/sa-learn-spam.sh'
Feb 12 19:29:31 mail dovecot: imap(kreme): Error: sieve: report-spam: validation failed
Feb 12 19:29:31 mail dovecot: imap(kreme): Error: sieve: Failed to compile script `/usr/lib/dovecot/sieve/report-spam.sieve'
Feb 12 19:29:31 mail dovecot: imap(kreme): sieve: left message in mailbox 'Junk'
# ls -ls /usr/local/bin/sa-learn-spam.sh
8 -rwx--x--x 1 root wheel 54 Jan 23 18:12 /usr/local/bin/sa-learn-spam.sh
# ls -lsa /usr/lib/dovecot/sieve/
total 40
8 drwxrwxrwx 2 root wheel 512 Feb 12 19:29 .
8 drwxr-xr-x 3 root wheel 512 Jan 23 18:08 ..
8 -rw-r--r-- 1 root wheel 329 Feb 12 19:29 report-ham.sieve
8 -rw-r--r-- 1 root wheel 214 Feb 12 19:28 report-spam.sieve
8 -rw-r--r-- 1 kreme wheel 354 Feb 12 19:27 report-spam.svbin
# cat /usr/local/bin/sa-learn-spam.sh
#!/bin/sh
exec /usr/local/bin/sa-learn -u ${1} --spam
--
"He has all the virtues I dislike and none of the vices I admire."
Winston Churchill
On 2018-02-12 (19:45 MST), Larry Rosenman larryrtx@gmail.com wrote:
Make sure you sievec the sieve global scripts.
Id did miss that in the instructions for some reason, but it reports the same error.
# sievec /usr/lib/dovecot/sieve/report-spam.sieve report-spam: line 7: error: pipe command: invalid program name '/usr/local/bin/sa-learn-spam.sh'. report-spam: error: validation failed.
-- The early bird gets the worm, but the second mouse gets the cheese.
On 2018-02-12 (20:11 MST), @lbutlr kremels@kreme.com wrote:
On 2018-02-12 (19:45 MST), Larry Rosenman larryrtx@gmail.com wrote:
Make sure you sievec the sieve global scripts.
Id did miss that in the instructions for some reason, but it reports the same error.
# sievec /usr/lib/dovecot/sieve/report-spam.sieve report-spam: line 7: error: pipe command: invalid program name '/usr/local/bin/sa-learn-spam.sh'. report-spam: error: validation failed.
Aha! I figured it out. The sa-learn-spam.sh file must be int eh same folder, you cannot specify an absolute path.
-- He [Rincewind] wondered how old the tower really was. Older than the University, certainly. Older than the city, which had formed about it like scree around a mountain. Maybe older than geography.
participants (2)
-
@lbutlr
-
Larry Rosenman