Trying to do antispam with Sieve

Adi Pircalabu adi at ddns.com.au
Wed Nov 14 04:11:15 EET 2018


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";

Here's the configuration I'm working with:
doveconf: Warning: service anvil { client_limit=1000 } is lower than 
required under max. load (1153)
# Pigeonhole version 0.4.16 (fed8554)
# OS: Linux 4.14.80-6.el7xen.x86_64 x86_64 CentOS Linux release 7.5.1804 
(Core)  ext4
auth_mechanisms = plain login digest-md5 cram-md5 apop
auth_username_chars = 
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890&.-_@'
disable_plaintext_auth = no
first_valid_uid = 30
imap_client_workarounds = delay-newmail
imap_logout_format = rcvd=%i, sent=%o
mail_attribute_dict = file:/var/qmail/mailnames/%Ld/dovecot-attributes
mail_fsync = never
mail_home = /var/qmail/mailnames/%Ld/%Ln
mail_location = maildir:/var/qmail/mailnames/%Ld/%Ln/Maildir
mail_log_prefix = "service=%s, user=%u, ip=[%r]. "
mail_max_userip_connections = 100
mail_plugins = " quota"
mailbox_list_index = yes
maildir_very_dirty_syncs = yes
managesieve_logout_format = rcvd=%i, sent=%o
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 imapflags notify imapsieve
mmap_disable = yes
namespace {
   hidden = no
   list = children
   location = 
maildir:/var/qmail/mailnames/%Ld/%%Ln/Maildir:INDEXPVT=/var/qmail/mailnames/%Ld/%Ln/user/%%u/Maildir
   prefix = Other Users.%%n.
   separator = .
   subscriptions = no
   type = shared
}
namespace {
   list = children
   location = 
maildir:/var/qmail/mailnames/%Ld/public/Maildir:INDEXPVT=/var/qmail/mailnames/%Ld/%Ln/public/Maildir
   prefix = Public.
   separator = .
   subscriptions = no
   type = public
}
namespace inbox {
   inbox = yes
   location =
   mailbox Archives {
     auto = subscribe
     special_use = \Archive
   }
   mailbox Drafts {
     auto = subscribe
     special_use = \Drafts
   }
   mailbox Sent {
     auto = subscribe
     special_use = \Sent
   }
   mailbox Spam {
     auto = subscribe
     autoexpunge = 90 days
     special_use = \Junk
   }
   mailbox Templates {
     auto = subscribe
   }
   mailbox Trash {
     auto = subscribe
     special_use = \Trash
   }
   prefix = INBOX.
   separator = .
   type = private
}
passdb {
   driver = plesk
}
plugin {
   acl = vfile
   acl_shared_dict = file:/var/qmail/mailnames/%Ld/shared-mailboxes
   imapsieve_mailbox1_before = 
file:/usr/lib64/dovecot/sieve/report-spam.sieve
   imapsieve_mailbox1_causes = COPY
   imapsieve_mailbox1_name = Spam
   imapsieve_mailbox2_before = 
file:/usr/lib64/dovecot/sieve/report-ham.sieve
   imapsieve_mailbox2_causes = COPY
   imapsieve_mailbox2_from = Spam
   imapsieve_mailbox2_name = *
   quota = maildir:User quota
   quota_grace = 0
   quota_warning = storage=95%% quota-warning 95 %u
   quota_warning2 = storage=99%% quota-warning 99 %u
   sieve = ~/.dovecot.sieve
   sieve_after = /etc/dovecot/sieve/after
   sieve_dir = ~/sieve
   sieve_extensions = +notify +imapflags
   sieve_global_extensions = +vnd.dovecot.pipe +vnd.dovecot.environment
   sieve_pipe_bin_dir = /usr/lib64/dovecot/sieve
   sieve_plugins = sieve_imapsieve sieve_extprograms
}
pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
pop3_logout_format = rcvd=%i, sent=%o, top=%t/%p, retr=%r/%b, del=%d/%m, 
size=%s
protocols = imap pop3 sieve
service auth-worker {
   group =
   user =
}
service auth {
   group =
   unix_listener auth-userdb {
     group = popuser
     mode = 0600
     user = popuser
   }
   user =
}
service imap-login {
   process_limit = 850
   service_count = 1
}
service imap {
   process_limit = 700
   service_count = 1
}
service pop3 {
   process_limit = 700
   service_count = 1
}
service quota-warning {
   executable = script /usr/local/bin/mail-quota-warning.sh
   group = popuser
   unix_listener quota-warning {
     group = popuser
     user = popuser
   }
   user = popuser
}
ssl_cert = </usr/local/psa/admin/conf/httpsd.pem
ssl_cipher_list = HIGH:!aNULL:!MD5
ssl_key =  # hidden, use -P to show it
ssl_protocols = TLSv1 TLSv1.1 TLSv1.2
userdb {
   args = uid=popuser gid=popuser
   driver = static
}
protocol imap {
   imap_metadata = yes
   mail_plugins = " quota imap_quota acl imap_acl imap_sieve"
}
protocol pop3 {
   pop3_uidl_format = UID%u-%v
}
protocol lda {
   mail_fsync = optimized
   mail_plugins = " quota sieve"
}
protocol lmtp {
   mail_fsync = optimized
}

/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";

I must be missing something obvious. Thanks,

-- 
Adi Pircalabu


More information about the dovecot mailing list