Hi! Since antispam plugin is deprecated and we would really prefer people not to use it, we wrote instructions on how to replace it with IMAPSieve. Comments and suggestions are most welcome. https://wiki.dovecot.org/HowTo/AntispamWithSieve --- Aki Tuomi Dovecot oy
On 10-02-17 09:06, Aki Tuomi wrote:> Hi! > Since antispam plugin is deprecated and we would really prefer people > not to use it, we wrote instructions on how to replace it with > IMAPSieve. Comments and suggestions are most welcome. > > https://wiki.dovecot.org/HowTo/AntispamWithSieve >Could you elaborate on the fact that it's deprecated? I never saw anything about that? The wiki page wasn't mentioning that it's deprecated since this morning? Kind regards, Tom
On 10.02.2017 10:35, Tom Hendrikx wrote:> > On 10-02-17 09:06, Aki Tuomi wrote: >> Hi! >> Since antispam plugin is deprecated and we would really prefer people >> not to use it, we wrote instructions on how to replace it with >> IMAPSieve. Comments and suggestions are most welcome. >> >> https://wiki.dovecot.org/HowTo/AntispamWithSieve >> > Could you elaborate on the fact that it's deprecated? I never saw > anything about that? The wiki page wasn't mentioning that it's > deprecated since this morning? > > Kind regards, > TomIt has not been maintained for ages and we have decided to officially deprecate it now. We believe that IMAPSieve does this much better than this plugin. Aki
Nice. Finally got around to switching. Had to add filter to my dspam pipe (another one I'm overdue for replacing) . Antispam plugin seems to have automatically converted line endings from "mail-type" '\r\n' into linux plain '\n' . Like so: sed -e 's/\r$//' | dspam ... Den 10. feb. 2017 09:06, skrev Aki Tuomi:> Hi! > Since antispam plugin is deprecated and we would really prefer people > not to use it, we wrote instructions on how to replace it with > IMAPSieve. Comments and suggestions are most welcome. > > https://wiki.dovecot.org/HowTo/AntispamWithSieve > > --- > Aki Tuomi > Dovecot oy >
Aki Tuomi wrote on 10.02.2017 15:06:> Hi! > Since antispam plugin is deprecated and we would really prefer people > not to use it, we wrote instructions on how to replace it with > IMAPSieve. Comments and suggestions are most welcome. > > https://wiki.dovecot.org/HowTo/AntispamWithSieve > > --- > Aki Tuomi > Dovecot oyWe just implemented this according to the wiki. Works great and without any hiccups. Thanks, Aki
Il 10/02/2017 09:06, Aki Tuomi ha scritto:> Hi! > Since antispam plugin is deprecated and we would really prefer people > not to use it, we wrote instructions on how to replace it with > IMAPSieve. Comments and suggestions are most welcome. > > https://wiki.dovecot.org/HowTo/AntispamWithSieveHi, imap_stats plugin is required? -- Alessio Cecchi Postmaster @ http://www.qboxmail.it https://www.linkedin.com/in/alessice
On 10.02.2017 09:06, Aki Tuomi wrote:> Since antispam plugin is deprecated and we would really prefer people > not to use it, we wrote instructions on how to replace it with IMAPSieve.In my setup, I use the following sieve script globally for all users: if header :is "X-Spam-Flag" "YES" { fileinto "Junk"; stop; } This allows processing based on spam flags set by Amavis/SpamAssassin. I wonder if the method shown in https://wiki.dovecot.org/HowTo/AntispamWithSieve will cause incoming mail (via LMTP) that is already flagged as spam to be processed by report-spam.sieve and, in consequence, will be learned as spam for a second time, which would of course be undesirable? -Ralph
On Fri, Feb 10, 2017 at 03:52:52PM +0100, Ralph Seichter wrote:>On 10.02.2017 09:06, Aki Tuomi wrote: > >> Since antispam plugin is deprecated and we would really prefer people >> not to use it, we wrote instructions on how to replace it with IMAPSieve. > >In my setup, I use the following sieve script globally for all users: > > if header :is "X-Spam-Flag" "YES" { > fileinto "Junk"; > stop; > } > >This allows processing based on spam flags set by Amavis/SpamAssassin. >I wonder if the method shown in > > https://wiki.dovecot.org/HowTo/AntispamWithSieve > >will cause incoming mail (via LMTP) that is already flagged as spam to >be processed by report-spam.sieve and, in consequence, will be learned >as spam for a second time, which would of course be undesirable?It shouldn't do. Check out https://wiki.dovecot.org/Pigeonhole/Sieve/Plugins/IMAPSieve, which explains that sieve is normally only used at delivery time, but the sieve_imapsieve plugin runs a *different* sieve script based on IMAP actions (for example, COPY). So, when you deliver, your main script tells dovecot WHERE to deliver to. When you issue and IMAP COPY command, the Antispam scripts tell dovecot to pipe the message to spamassassin. The delivery does not involve IMAP and the IMAP COPY does not constitute redelivery. -- For more information, please reread.
Op 2/10/2017 om 2:20 PM schreef Alessio Cecchi:> Il 10/02/2017 09:06, Aki Tuomi ha scritto: >> Hi! >> Since antispam plugin is deprecated and we would really prefer people >> not to use it, we wrote instructions on how to replace it with >> IMAPSieve. Comments and suggestions are most welcome. >> >> https://wiki.dovecot.org/HowTo/AntispamWithSieve > Hi, > > imap_stats plugin is required?No, that is just part of the example. Regards, Stephan.
> On February 10, 2017 at 10:06 AM Aki Tuomi <aki.tuomi at dovecot.fi> wrote: > > > Hi! > Since antispam plugin is deprecated and we would really prefer people > not to use it, we wrote instructions on how to replace it with > IMAPSieve. Comments and suggestions are most welcome. > > https://wiki.dovecot.org/HowTo/AntispamWithSieve > > --- > Aki Tuomi > Dovecot oyHi everyone, thank you all for your feedback, questions and comments. We have upgraded the documentation based on this, including information how to exclude Trash folder in ham script. Aki
On Sun, Feb 12, 2017 at 3:52 PM, Aki Tuomi <aki.tuomi at dovecot.fi> wrote:> > > On February 10, 2017 at 10:06 AM Aki Tuomi <aki.tuomi at dovecot.fi> wrote: > > > > > > Hi! > > Since antispam plugin is deprecated and we would really prefer people > > not to use it, we wrote instructions on how to replace it with > > IMAPSieve. Comments and suggestions are most welcome. > > > > https://wiki.dovecot.org/HowTo/AntispamWithSieve > > > > --- > > Aki Tuomi > > Dovecot oy > > Hi everyone, > > thank you all for your feedback, questions and comments. We have upgraded > the documentation based on this, including information how to exclude Trash > folder in ham script. > > Aki >Thank you all very much. I am now running into a very weird issue. Whenever an Junk email is ?seen? I get the following error: Debug: sieve: vnd.dovecot.execute extension: no bin or socket directory specified; extension is unconfigured (both sieve_execute_bin_dir and sieve_execute_socket_dir are not set) Feb 12 18:02:54 imap(user at domain): Debug: imapsieve: Static mailbox rule [1]: mailbox=`Junk' from=`*' causes=(COPY) => before=`file:/usr/local/lib/dovecot/sieve/report-spam.sieve' after=(none) Feb 12 18:02:54 imap(user at dmain): Debug: imapsieve: Static mailbox rule [2]: mailbox=`*' from=`Junk' causes=(COPY) => before=`file:/usr/local/lib/dovecot/sieve/report-ham.sieve' after=(none) Also it automatically creates a .spamassassin/ folder in the user: -rw------- 1 vmail vmail 136 Feb 10 17:33 .dovecot.lda-dupes lrwx------ 1 vmail vmail 17 Mar 13 2016 .dovecot.sieve@ -> managesieve.sieve -rw------- 1 vmail vmail 322 Feb 11 03:02 .dovecot.svbin drwx------ 2 vmail vmail 512 Feb 12 18:04 .spamassassin/ drwx------ 5 vmail vmail 512 Feb 10 17:32 Drafts/ drwx------ 5 vmail vmail 512 Feb 12 18:09 Junk/ drwx------ 5 vmail vmail 512 Feb 11 17:36 Saved/ drwx------ 5 vmail vmail 512 Jan 16 11:55 Sent/ drwx------ 5 vmail vmail 512 Feb 12 18:09 Trash/ drwx------ 2 vmail vmail 1024 Feb 12 18:07 cur/ -rw------- 1 vmail vmail 21 Mar 13 2016 dovecot-acl-list -rw------- 1 vmail vmail 68 Oct 17 13:19 dovecot-keywords -rw------- 1 vmail vmail 245 Feb 12 18:07 dovecot-uidlist -rw------- 1 vmail vmail 8 Jun 9 2016 dovecot-uidvalidity -r--r--r-- 1 vmail vmail 0 Mar 12 2016 dovecot-uidvalidity.56e48129 -rw------- 1 vmail vmail 640 Feb 11 22:24 dovecot.index -rw------- 1 vmail vmail 27788 Feb 12 18:07 dovecot.index.cache -rw------- 1 vmail vmail 25996 Feb 12 18:07 dovecot.index.log -rw------- 1 vmail vmail 192 Feb 12 16:04 dovecot.mailbox.log -rw------- 1 vmail vmail 181 Feb 10 17:34 managesieve.sieve drwx------ 2 vmail vmail 512 Feb 12 17:46 new/ -rw------- 1 vmail vmail 39 Jun 9 2016 subscriptions drwx------ 2 vmail vmail 512 Feb 12 18:04 tmp/ Any ideas ? I am attaching my config. Thanks # 2.2.27 (c0f36b0): /usr/local/etc/dovecot/dovecot.conf # Pigeonhole version 0.4.16 (fed8554) # OS: FreeBSD 10.3-RELEASE-p11 amd64 ufs auth_mechanisms = plain login auth_verbose = yes default_client_limit = 2560 default_process_limit = 512 dict { acl = mysql:/usr/local/etc/dovecot/dovecot-dict-sql.conf.ext quota = mysql:/usr/local/etc/dovecot/dovecot-dict-sql.conf.ext } log_path = /var/log/dovecot.log mail_home = /usr/local/vhosts/mail/%d/%n mail_location = maildir:/usr/local/vhosts/mail/%d/%n:LAYOUT=fs mail_max_userip_connections = 20 mail_plugins = quota acl mail_privileged_group = vmail mail_shared_explicit_inbox = yes 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 mbox_write_locks = fcntl namespace { inbox = no list = children location maildir:/usr/local/vhosts/mail/%%d/%%n:LAYOUT=fs:INDEX=/usr/local/vhosts/indexes/%d/%n/shared/%%u:INDEXPVT=/usr/local/vhosts/indexes/%d/%n/shared/%%u prefix = shared/%%d/%%n/ separator = / subscriptions = no type = shared } namespace inbox { inbox = yes list = yes location mailbox Drafts { auto = subscribe special_use = \Drafts } mailbox Junk { auto = subscribe special_use = \Junk } mailbox Sent { auto = subscribe special_use = \Sent } mailbox Trash { auto = subscribe special_use = \Trash } prefix separator = / type = private } passdb { args = /usr/local/etc/dovecot/dovecot-sql.conf.ext driver = sql } plugin { acl = vfile acl_shared_dict = proxy::acl imapsieve_mailbox1_before file:/usr/local/lib/dovecot/sieve/report-spam.sieve imapsieve_mailbox1_causes = COPY imapsieve_mailbox1_name = Junk imapsieve_mailbox2_before file:/usr/local/lib/dovecot/sieve/report-ham.sieve imapsieve_mailbox2_causes = COPY imapsieve_mailbox2_from = Junk imapsieve_mailbox2_name = * quota = dict:User quota::proxy::quota quota_rule2 = Trash:storage=+100M sieve = /usr/local/vhosts/mail/%d/%n/.dovecot.sieve sieve_before = /usr/local/vhosts/sieve/before.d/ sieve_dir = /usr/local/vhosts/mail/%d/%n sieve_global_dir = /usr/local/vhosts/sieve/%d sieve_global_extensions = +vnd.dovecot.pipe +vnd.dovecot.execute sieve_global_path = /usr/local/vhosts/sieve/%d/default.sieve sieve_pipe_bin_dir = /usr/local/lib/dovecot/sieve sieve_plugins = sieve_imapsieve sieve_extprograms } protocols = imap lmtp sieve sieve service auth-worker { user = vmail } service auth { unix_listener /var/spool/postfix/private/auth { group = postfix mode = 0666 user = postfix } unix_listener auth-userdb { mode = 0600 user = vmail } user = dovecot } service dict { unix_listener dict { mode = 0600 user = vmail } } service imap-login { inet_listener imap { port = 143 } } service lmtp { unix_listener /var/spool/postfix/private/dovecot-lmtp { group = postfix mode = 0600 user = postfix } } service managesieve-login { inet_listener sieve { port = 4190 } process_min_avail = 0 service_count = 1 vsz_limit = 64 M } ssl_cert = </usr/local/etc/postfix/keys/mail.my.domain.crt ssl_key = # hidden, use -P to show it userdb { args = /usr/local/etc/dovecot/dovecot-sql.conf.ext driver = sql } protocol lmtp { mail_plugins = quota acl sieve } protocol imap { imap_client_workarounds = tb-extra-mailbox-sep mail_plugins = quota acl imap_quota imap_acl imap_sieve } protocol lda { mail_plugins = quota acl sieve acl postmaster_address = root } local xxx.xxx.xxx.xxx { protocol imap { ssl_cert = </usr/local/etc/postfix/keys/mail.my.domain.crt ssl_key = # hidden, use -P to show it } } -- George Kontostanos ---
Any opinion on dspam's interoperability with this? On Fri, Feb 10, 2017 at 1:07 AM -0700, "Aki Tuomi" <aki.tuomi at dovecot.fi> wrote: Hi! Since antispam plugin is deprecated and we would really prefer people not to use it, we wrote instructions on how to replace it with IMAPSieve. Comments and suggestions are most welcome. https://wiki.dovecot.org/HowTo/AntispamWithSieve --- Aki Tuomi Dovecot oy
Den 12. feb. 2017 21:44, skrev ebroch at whitehorsetc.com:> > > Any opinion on dspam's interoperability with this? > >Just follow the wiki and replace sa-learn scripts with calling dspam. Dspam direct pipe needs mail-line-endings (\r\n) translated into unix line-endings (\r). like so: ----- learn-spam.sh --------- #!/bin/sh sed -e 's/\r$//' | /usr/bin/dspam --source=error --class=spam ----- learn-ham.sh ---------- #!/bin/sh sed -e 's/\r$//' | /usr/bin/dspam --source=error --class=innocent ------ Theese will be invoked with the owner of the mailbox as current uid, so that is all.
Glad I poked around on the list today! Thanks to all for the suggestions about integration with dspam. I'll definitely have to look into this, as I rely on moving messages to a specific folder with various IMAP clients to retrain dspam false positives and negatives. A quick pair of questions: * Does Dovecot support the IMAP "MOVE" command at this time? * If so, what is the syntax for "COPY or MOVE" for the _causes variables? I did see messages from 2011 discussing it, but nothing since. While the script looks like it could be modified for use with dspam (with the great suggestions from others on the list), it has the same problem as "antispam" with bulk moves being serialized and tying of the client until they complete. I'll probably have to break down and look into using FreeBSD's auditd to trigger the actions and then de-queue the successfully processed messages. Sieve doesn't look like it can handle asynchronous processing, but I'd certainly be interested if I'm missing something there. One less thing to configure and maintain! Jeff On 2/12/17 5:52 AM, Aki Tuomi wrote:>> On February 10, 2017 at 10:06 AM Aki Tuomi <aki.tuomi at dovecot.fi> wrote: >> >> >> Hi! >> Since antispam plugin is deprecated and we would really prefer people >> not to use it, we wrote instructions on how to replace it with >> IMAPSieve. Comments and suggestions are most welcome. >> >> https://wiki.dovecot.org/HowTo/AntispamWithSieve >> >> --- >> Aki Tuomi >> Dovecot oy > Hi everyone, > > thank you all for your feedback, questions and comments. We have upgraded the documentation based on this, including information how to exclude Trash folder in ham script. > > Aki >
Greetings to the list :) I've been meaning to ask a couple of questions about the imapsieve for antispam. Firstly, I guess that the example at the bottom of the page "https://wiki2.dovecot.org/Pigeonhole/Sieve/Plugins/IMAPSieve" is meant to link to the new example at "https://wiki2.dovecot.org/HowTo/AntispamWithSieve" now? Also... in "imapsieve_mailboxX_name = ${directory}" is the string a literal, or is it working with the 'special use' flagged directories from the xx-mailboxes.conf? I'm asking as though I only have a few users to worry about, different mail clients each have their favourite special folders. IE thunderbird uses "junk" but one Outlook express version likes "Junk E-mail" and I have a different favourite from another version of OE too. So in mailboxes.conf I just added extra special use lines which seemed to make things happy. Otherwise I ended up with the server configured 'spam' folder showing as basic folder, and then each client adding it's own chosen spamfolder each time too. But, if the imapsieve is only matching to literal foldernames, should I just duplicate the trigger lines for each type of junk folder or is there a method to have the sieve script enumerate all the options listed by 'special use' or is there a better method for this? I want to put the spam-mail-filing script as a global sieve script as all users will need it, rather than duplicating out for each user. Many thanks , Andy R On 10/02/2017 09:06, Aki Tuomi wrote:> Hi! > Since antispam plugin is deprecated and we would really prefer people > not to use it, we wrote instructions on how to replace it with > IMAPSieve. Comments and suggestions are most welcome. > > https://wiki.dovecot.org/HowTo/AntispamWithSieve > > --- > Aki Tuomi > Dovecot oy >
Some answers inline. Aki On 01.03.2017 00:42, Andy R wrote:> Greetings to the list :) > > > I've been meaning to ask a couple of questions about the imapsieve for > antispam. > > > Firstly, I guess that the example at the bottom of the page > "https://wiki2.dovecot.org/Pigeonhole/Sieve/Plugins/IMAPSieve" is > meant to link to the new example at > "https://wiki2.dovecot.org/HowTo/AntispamWithSieve" now? >Thanks, fixed.> > Also... in "imapsieve_mailboxX_name = ${directory}" is the string a > literal, or is it working with the 'special use' flagged directories > from the xx-mailboxes.conf? I'm asking as though I only have a few > users to worry about, different mail clients each have their favourite > special folders. IE thunderbird uses "junk" but one Outlook express > version likes "Junk E-mail" and I have a different favourite from > another version of OE too. So in mailboxes.conf I just added extra > special use lines which seemed to make things happy. Otherwise I ended > up with the server configured 'spam' folder showing as basic folder, > and then each client adding it's own chosen spamfolder each time too. >It is a mailbox mask, not special use flag.> > But, if the imapsieve is only matching to literal foldernames, should > I just duplicate the trigger lines for each type of junk folder or is > there a method to have the sieve script enumerate all the options > listed by 'special use' or is there a better method for this? I want > to put the spam-mail-filing script as a global sieve script as all > users will need it, rather than duplicating out for each user. >There is no way to match special use folders at the moment, but I like the idea.> > > Many thanks , > > > Andy R > > > On 10/02/2017 09:06, Aki Tuomi wrote: >> Hi! >> Since antispam plugin is deprecated and we would really prefer people >> not to use it, we wrote instructions on how to replace it with >> IMAPSieve. Comments and suggestions are most welcome. >> >> https://wiki.dovecot.org/HowTo/AntispamWithSieve >> >> --- >> Aki Tuomi >> Dovecot oy >>