On Tue, Aug 22, 2017 at 01:55:45PM +0300, Aki Tuomi wrote:> > >On 22.08.2017 13:37, Darac Marjal wrote: >> Hello all, >> >> Hopefully this is something fairly simple. >> >> I've been trying to set up the Sieve Antispam system as detailed at >> https://wiki2.dovecot.org/HowTo/AntispamWithSieve, but at the moment, >> whenever I change mailboxes I get the following message logged: >> >> Aug 22 09:30:45 remy dovecot: imap(darac at darac.org.uk): Error: >> imapsieve: mailbox INBOX: Failed to read /shared/imapsieve/script >> mailbox attribute >> >> and my script does not run when I move files between folders. >> >> My sieve files are chmod'ed 0644 and the shell script used to pipe >> into spamassassin is 0755, so it *should* work, shouldn't it? Is there >> something I've missed? >> > >Can you show doveconf -n and your sieve scripts? > >AkiCertainly: ---8<--- doveconf -n ---8<--- # 2.2.31 (65cde28): /etc/dovecot/dovecot.conf # Pigeonhole version 0.4.19 (e5c7051) # OS: Linux 4.9.0-1-686-pae i686 Debian buster/sid xfs auth_mechanisms = digest-md5 cram-md5 plain auth_verbose = yes imap_id_log = * info_log_path = /var/log/dovecot.info lda_mailbox_autosubscribe = yes log_timestamp = "%Y-%m-%d %H:%M:%S " login_log_format_elements = service=%s user=<%u> session=%{session} method=%m rip=%r lip=%l mpid=%e %c %k mail_access_groups = mail users mail_gid = vmail mail_home = /var/mail/%u mail_location = mdbox:/var/mail/%u/Mail mail_max_userip_connections = 50 mail_plugins = " zlib fts fts_lucene stats fts fts_lucene stats" mail_privileged_group = mail mail_uid = vmail 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 vnd.dovecot.pipe vnd.dovecot.execute namespace { hidden = no ignore_on_failure = yes inbox = no list = children location = mbox:~/archive:INDEX=~/archive-indexes prefix = _ARCHIVE/ subscriptions = no } namespace { hidden = no inbox = no list = yes location = mdbox:/var/mail/%u/Mail:MAILBOXDIR=expunged prefix = .EXPUNGED/ subscriptions = no } namespace inbox { inbox = yes location = mailbox Drafts { special_use = \Drafts } mailbox Junk { special_use = \Junk } mailbox Sent { special_use = \Sent } mailbox "Sent Messages" { special_use = \Sent } mailbox Trash { special_use = \Trash } prefix = } passdb { args = /etc/dovecot/passwd driver = passwd-file } plugin { antispam_backend = pipe antispam_crm_binary = /bin/false antispam_debug_target = syslog antispam_pipe_program = /usr/bin/sa-learn-pipe.sh antispam_pipe_program_notspam_arg = --ham antispam_pipe_program_spam_arg = --spam antispam_pipe_tmpdir = /tmp antispam_spam_pattern_ignorecase = SPAM antispam_trash_pattern_ignorecase = trash;Deleted * fts = lucene fts_lucene = whitespace_chars=@. imapsieve_mailbox1_before = file:/usr/lib/dovecot/sieve/learn-spam.sieve imapsieve_mailbox1_causes = COPY imapsieve_mailbox1_name = Spam imapsieve_mailbox2_before = file:/usr/lib/dovecot/sieve/learn-spam.sieve imapsieve_mailbox2_causes = COPY imapsieve_mailbox2_name = spam imapsieve_mailbox3_before = file:/usr/lib/dovecot/sieve/learn-ham.sieve imapsieve_mailbox3_causes = COPY imapsieve_mailbox3_from = Spam imapsieve_mailbox3_name = * imapsieve_mailbox4_before = file:/usr/lib/dovecot/sieve/learn-ham.sieve imapsieve_mailbox4_causes = COPY imapsieve_mailbox4_from = spam imapsieve_mailbox4_name = * imapsieve_url = sieve://mail.darac.org.uk lazy_expunge = .EXPUNGED/ sieve = file:~/sieve;active=~/.dovecot.sieve sieve_execute_bin_dir = /usr/lib/dovecot/sieve sieve_extensions = +vnd.dovecot.pipe +vnd.dovecot.execute sieve_pipe_bin_dir = /usr/lib/dovecot/sieve sieve_plugins = sieve_imapsieve sieve_extprograms sieve_spamtest_max_header = X-Spam-Score: score=-?[[:digit:]]+\.[[:digit:]].*required=([[:digit:]]+\.[[:digit:]]) sieve_spamtest_status_header = X-Spam-Score: score=(-?[[:digit:]]+\.[[:digit:]]).* sieve_spamtest_status_type = score stats_refresh = 30 secs stats_track_cmds = yes zlib_save = lz4 zlib_save_level = 2 } postmaster_address = postmaster at darac.org.uk protocols = " imap lmtp sieve" service auth { unix_listener /var/spool/postfix/private/auth { group = postfix mode = 0660 user = postfix } unix_listener auth-userdb { group = vmail mode = 0777 user = vmail } } service lmtp { inet_listener lmtp { address = 192.168.101.8 port = 20024 } unix_listener /var/spool/postfix/private/dovecot-lmtp { group = postfix mode = 0666 user = postfix } } service managesieve-login { inet_listener sieve { port = 4190 } inet_listener sieve_deprecated { port = 2000 } } service stats { fifo_listener stats-mail { mode = 0600 user = vmail } } ssl_cert = </var/lib/dehydrated/certs/mail.darac.org.uk/fullchain.pem ssl_cipher_list = AES128+EECDH:AES128+EDH ssl_client_ca_dir = /etc/ssl/certs ssl_dh_parameters_length = 2048 ssl_key = # hidden, use -P to show it ssl_prefer_server_ciphers = yes userdb { args = /etc/dovecot/passwd default_fields = uid=vmail gid=vmail home=/var/mail/%u driver = passwd-file } protocol lmtp { mail_fsync = optimized mail_plugins = " zlib fts fts_lucene stats sieve" } protocol lda { mail_fsync = optimized mail_plugins = " zlib fts fts_lucene stats sieve" } protocol imap { mail_plugins = " zlib fts fts_lucene stats zlib imap_zlib imap_stats imap_sieve stats imap_stats" } ---8<--- learn-spam.sieve ---8<--- require ["vnd.dovecot.pipe", "copy", "imapsieve", "environment", "variables"]; if environment :matches "imap.user" "*" { set "username" "${1}"; } pipe :copy "SA-Learn-Pipe" ["--spam", "${username}"]; ---8<--- learn-ham.sieve ---8<--- re ["vnd.dovecot.pipe", "copy", "imapsieve", "environment", "variables"]; if environment :matches "imap.mailbox" "*" { set "mailbox" "${1}"; } if string "${mailbox}" "Trash" { stop; } if environment :matches "imap.user" "*" { set "username" "${1}"; } pipe :copy "SA-Learn-Pipe" ["--ham", "${username}"]; ---8<--- SA-Learn-Pipe ---8<--- #!/bin/bash [ -x /usr/bin/sa-learn ] || exit 0 logger "Learning from message" logger $(id) logger "IMAP User = ${2}" # sa-learn does now accept messages on stdin # However, we still need this script to avoid putting sa-learn in the sieve-exec folder exec /usr/bin/sa-learn -u ${2} ${1} -- For more information, please reread. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 906 bytes Desc: not available URL: <http://dovecot.org/pipermail/dovecot/attachments/20170822/296fc9c2/attachment.sig>
Op 22-8-2017 om 13:03 schreef Darac Marjal:> On Tue, Aug 22, 2017 at 01:55:45PM +0300, Aki Tuomi wrote: >> >> >> On 22.08.2017 13:37, Darac Marjal wrote: >>> Hello all, >>> >>> Hopefully this is something fairly simple. >>> >>> I've been trying to set up the Sieve Antispam system as detailed at >>> https://wiki2.dovecot.org/HowTo/AntispamWithSieve, but at the moment, >>> whenever I change mailboxes I get the following message logged: >>> >>> ? Aug 22 09:30:45 remy dovecot: imap(darac at darac.org.uk): Error: >>> imapsieve: mailbox INBOX: Failed to read /shared/imapsieve/script >>> mailbox attribute >>> >>> and my script does not run when I move files between folders. >>> >>> My sieve files are chmod'ed 0644 and the shell script used to pipe >>> into spamassassin is 0755, so it *should* work, shouldn't it? Is there >>> something I've missed? >>> >> >> Can you show doveconf -n and your sieve scripts?Looks like you didn't configure Dovecot for use of the IMAP METADATA extension. That is a prerequisite for providing IMAPSIEVE support to your users. https://wiki.dovecot.org/ImapMetadata The main missing configuration is the mail_attribute_dict setting. The error message you got was very unhelpful. That is fixed now: https://github.com/dovecot/pigeonhole/commit/dc20a45fae8c5e402d1493847c38d72c9670c64e Regards, Stephan.> > Certainly: > > ---8<---? doveconf -n? ---8<--- > > # 2.2.31 (65cde28): /etc/dovecot/dovecot.conf > # Pigeonhole version 0.4.19 (e5c7051) > # OS: Linux 4.9.0-1-686-pae i686 Debian buster/sid xfs > auth_mechanisms = digest-md5 cram-md5 plain > auth_verbose = yes > imap_id_log = * > info_log_path = /var/log/dovecot.info > lda_mailbox_autosubscribe = yes > log_timestamp = "%Y-%m-%d %H:%M:%S " > login_log_format_elements = service=%s user=<%u> session=%{session} > method=%m rip=%r lip=%l mpid=%e %c %k > mail_access_groups = mail users > mail_gid = vmail > mail_home = /var/mail/%u > mail_location = mdbox:/var/mail/%u/Mail > mail_max_userip_connections = 50 > mail_plugins = " zlib fts fts_lucene stats fts fts_lucene stats" > mail_privileged_group = mail > mail_uid = vmail > 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 vnd.dovecot.pipe > vnd.dovecot.execute > namespace { > ?hidden = no > ?ignore_on_failure = yes > ?inbox = no > ?list = children > ?location = mbox:~/archive:INDEX=~/archive-indexes > ?prefix = _ARCHIVE/ > ?subscriptions = no > } > namespace { > ?hidden = no > ?inbox = no > ?list = yes > ?location = mdbox:/var/mail/%u/Mail:MAILBOXDIR=expunged > ?prefix = .EXPUNGED/ > ?subscriptions = no > } > namespace inbox { > ?inbox = yes > ?location = ?mailbox Drafts { > ?? special_use = \Drafts > ?} > ?mailbox Junk { > ?? special_use = \Junk > ?} > ?mailbox Sent { > ?? special_use = \Sent > ?} > ?mailbox "Sent Messages" { > ?? special_use = \Sent > ?} > ?mailbox Trash { > ?? special_use = \Trash > ?} > ?prefix = } > passdb { > ?args = /etc/dovecot/passwd > ?driver = passwd-file > } > plugin { > ?antispam_backend = pipe > ?antispam_crm_binary = /bin/false > ?antispam_debug_target = syslog > ?antispam_pipe_program = /usr/bin/sa-learn-pipe.sh > ?antispam_pipe_program_notspam_arg = --ham > ?antispam_pipe_program_spam_arg = --spam > ?antispam_pipe_tmpdir = /tmp > ?antispam_spam_pattern_ignorecase = SPAM > ?antispam_trash_pattern_ignorecase = trash;Deleted * > ?fts = lucene > ?fts_lucene = whitespace_chars=@. > ?imapsieve_mailbox1_before = file:/usr/lib/dovecot/sieve/learn-spam.sieve > ?imapsieve_mailbox1_causes = COPY > ?imapsieve_mailbox1_name = Spam > ?imapsieve_mailbox2_before = file:/usr/lib/dovecot/sieve/learn-spam.sieve > ?imapsieve_mailbox2_causes = COPY > ?imapsieve_mailbox2_name = spam > ?imapsieve_mailbox3_before = file:/usr/lib/dovecot/sieve/learn-ham.sieve > ?imapsieve_mailbox3_causes = COPY > ?imapsieve_mailbox3_from = Spam > ?imapsieve_mailbox3_name = * > ?imapsieve_mailbox4_before = file:/usr/lib/dovecot/sieve/learn-ham.sieve > ?imapsieve_mailbox4_causes = COPY > ?imapsieve_mailbox4_from = spam > ?imapsieve_mailbox4_name = * > ?imapsieve_url = sieve://mail.darac.org.uk > ?lazy_expunge = .EXPUNGED/ > ?sieve = file:~/sieve;active=~/.dovecot.sieve > ?sieve_execute_bin_dir = /usr/lib/dovecot/sieve > ?sieve_extensions = +vnd.dovecot.pipe +vnd.dovecot.execute > ?sieve_pipe_bin_dir = /usr/lib/dovecot/sieve > ?sieve_plugins = sieve_imapsieve sieve_extprograms > ?sieve_spamtest_max_header = X-Spam-Score: > score=-?[[:digit:]]+\.[[:digit:]].*required=([[:digit:]]+\.[[:digit:]]) > ?sieve_spamtest_status_header = X-Spam-Score: > score=(-?[[:digit:]]+\.[[:digit:]]).* > ?sieve_spamtest_status_type = score > ?stats_refresh = 30 secs > ?stats_track_cmds = yes > ?zlib_save = lz4 > ?zlib_save_level = 2 > } > postmaster_address = postmaster at darac.org.uk > protocols = " imap lmtp sieve" > service auth { > ?unix_listener /var/spool/postfix/private/auth { > ?? group = postfix > ?? mode = 0660 > ?? user = postfix > ?} > ?unix_listener auth-userdb { > ?? group = vmail > ?? mode = 0777 > ?? user = vmail > ?} > } > service lmtp { > ?inet_listener lmtp { > ?? address = 192.168.101.8 > ?? port = 20024 > ?} > ?unix_listener /var/spool/postfix/private/dovecot-lmtp { > ?? group = postfix > ?? mode = 0666 > ?? user = postfix > ?} > } > service managesieve-login { > ?inet_listener sieve { > ?? port = 4190 > ?} > ?inet_listener sieve_deprecated { > ?? port = 2000 > ?} > } > service stats { > ?fifo_listener stats-mail { > ?? mode = 0600 > ?? user = vmail > ?} > } > ssl_cert = </var/lib/dehydrated/certs/mail.darac.org.uk/fullchain.pem > ssl_cipher_list = AES128+EECDH:AES128+EDH > ssl_client_ca_dir = /etc/ssl/certs > ssl_dh_parameters_length = 2048 > ssl_key =? # hidden, use -P to show it > ssl_prefer_server_ciphers = yes > userdb { > ?args = /etc/dovecot/passwd > ?default_fields = uid=vmail gid=vmail home=/var/mail/%u > ?driver = passwd-file > } > protocol lmtp { > ?mail_fsync = optimized > ?mail_plugins = " zlib fts fts_lucene stats sieve" > } > protocol lda { > ?mail_fsync = optimized > ?mail_plugins = " zlib fts fts_lucene stats sieve" > } > protocol imap { > ?mail_plugins = " zlib fts fts_lucene stats zlib imap_zlib imap_stats > imap_sieve stats imap_stats" > } > > ---8<---? learn-spam.sieve? ---8<--- > > require ["vnd.dovecot.pipe", "copy", "imapsieve", "environment", > "variables"]; > > if environment :matches "imap.user" "*" { > ?????? set "username" "${1}"; > } > > pipe :copy "SA-Learn-Pipe" ["--spam", "${username}"]; > > > ---8<---? learn-ham.sieve? ---8<--- > > re ["vnd.dovecot.pipe", "copy", "imapsieve", "environment", "variables"]; > > if environment :matches "imap.mailbox" "*" { > ?set "mailbox" "${1}"; > } > > if string "${mailbox}" "Trash" { > ?stop; > } > > if environment :matches "imap.user" "*" { > ?set "username" "${1}"; > } > > pipe :copy "SA-Learn-Pipe" ["--ham", "${username}"]; > > > ---8<---? SA-Learn-Pipe? ---8<--- > > #!/bin/bash > > [ -x /usr/bin/sa-learn ] || exit 0 > > logger "Learning from message" > logger $(id) > logger "IMAP User = ${2}" > > # sa-learn does now accept messages on stdin > # However, we still need this script to avoid putting sa-learn in the > sieve-exec folder > > exec /usr/bin/sa-learn -u ${2} ${1} > >
On Wed, Aug 23, 2017 at 02:03:06PM +0200, Stephan Bosch wrote:> > >Op 22-8-2017 om 13:03 schreef Darac Marjal: >>On Tue, Aug 22, 2017 at 01:55:45PM +0300, Aki Tuomi wrote: >>> >>> >>>On 22.08.2017 13:37, Darac Marjal wrote: >>>>Hello all, >>>> >>>>Hopefully this is something fairly simple. >>>> >>>>I've been trying to set up the Sieve Antispam system as detailed at >>>>https://wiki2.dovecot.org/HowTo/AntispamWithSieve, but at the moment, >>>>whenever I change mailboxes I get the following message logged: >>>> >>>>? Aug 22 09:30:45 remy dovecot: imap(darac at darac.org.uk): Error: >>>>imapsieve: mailbox INBOX: Failed to read /shared/imapsieve/script >>>>mailbox attribute >>>> >>>>and my script does not run when I move files between folders. >>>> >>>>My sieve files are chmod'ed 0644 and the shell script used to pipe >>>>into spamassassin is 0755, so it *should* work, shouldn't it? Is there >>>>something I've missed? >>>> >>> >>>Can you show doveconf -n and your sieve scripts? > >Looks like you didn't configure Dovecot for use of the IMAP METADATA >extension. That is a prerequisite for providing IMAPSIEVE support to >your users. > >https://wiki.dovecot.org/ImapMetadataExcellent. Yes, that seems to have fixed it. Thank you.> >The main missing configuration is the mail_attribute_dict setting. > >The error message you got was very unhelpful. That is fixed now: > >https://github.com/dovecot/pigeonhole/commit/dc20a45fae8c5e402d1493847c38d72c9670c64e > >Regards, > >Stephan. >-- For more information, please reread. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 906 bytes Desc: not available URL: <http://dovecot.org/pipermail/dovecot/attachments/20170823/c5e3b513/attachment-0001.sig>