Setting up sieve with spam learning

@lbutlr kremels at kreme.com
Tue Feb 13 04:41:11 EET 2018


On 2018-02-12 (19:24 MST), @lbutlr <kremels at 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




More information about the dovecot mailing list