Good morning.

 

I am using Dovecot as an IMAP proxy -- using IMAPC -- and the system is working great. Thank you for contributing such great software to the community!

 

I’m using Dovcot 2.3.5 and Pigeonhole 0.5.5.

 

My server is located behind a content-filtering firewall that will mark incoming messages by adding “[SPAM]” to the subject line. I’m trying to use Sieve to identify those messages and move them into the Spam folder. I have a basic Sieve script that looks like this:

 

   require ["fileinto"];

   if anyof (header :contains "Subject" "[SPAM]",

             header :contains "X-Spam-Flag" "Yes")

   {

       fileinto "Spam";

       stop;

   }

 

I can see in the logs that Sieve is loaded, and also the imapsieve_plugin

 

   Debug: sieve: Pigeonhole version 0.5.5 (2483b085) initializing

   Debug: sieve: Sieve imapsieve plugin for Pigeonhole version 0.5.5 (2483b085) loaded

 

Sieve detects outbound messages (from the log: Debug: imapsieve: mailbox INBOX.Sent: APPEND event) but nothing registers for inbound, and my spam_rule is never triggered. Any suggestions?

 

Here is the output from “Dovecot -n”:

 

# 2.3.5 (513208660): /etc/dovecot/dovecot.conf

# Pigeonhole version 0.5.5 (2483b085)

# OS: Linux 3.10.0-957.5.1.el7.x86_64 x86_64 CentOS Linux release 7.6.1810 (Core)  xfs

# Hostname: <redacted>

auth_master_user_separator = *

auth_mechanisms = PLAIN LOGIN

auth_verbose_passwords = plain

deliver_log_format = from=%{from}, envelope_sender=%{from_envelope}, subject=%{subject}, msgid=%m, size=%{size}, %$

dict {

  acl = pgsql:/etc/dovecot/dovecot-share-folder.conf

  quotadict = pgsql:/etc/dovecot/dovecot-used-quota.conf

}

first_valid_uid = 2000

imapc_features = fetch-bodystructure fetch-headers

imapc_host = <redacted>

imapc_port = 993

imapc_ssl = imaps

imapc_ssl_verify = no

last_valid_uid = 2000

listen = * [::]

mail_debug = yes

mail_gid = 2000

mail_home = /var/mail/imapc/home/%d/%n

mail_location = imapc:/var/mail/imapc/%d/%n

mail_plugins = mailbox_alias mail_log notify

mail_uid = 2000

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

namespace inbox {

  inbox = yes

  list = yes

  location =

  prefix =

  separator = .

  type = private

}

passdb {

  args = host=<redacted>

  default_fields = userdb_imapc_user=%u userdb_imapc_password=#hidden_use-P_to_show#

  driver = imap

}

passdb {

  args = /etc/dovecot/dovecot-master-users

  driver = passwd-file

  master = yes

}

plugin {

  imapsieve_default = /var/vmail/sieve/global/spam_rule.sieve

  mail_log_events = delete undelete expunge mailbox_delete mailbox_rename

  mail_log_fields = uid box msgid size from subject

  mailbox_alias_new = Sent Messages

  mailbox_alias_new2 = Sent Items

  mailbox_alias_old = Sent

  mailbox_alias_old2 = Sent

  sieve_global_dir = /var/vmail/sieve/global/

  sieve_max_redirects = 30

  sieve_plugins = sieve_imapsieve

  sieve_trace_debug = yes

  sieve_trace_dir = /var/log/dovecot

  sieve_trace_level = matching

}

protocols = imap sieve

service auth {

  unix_listener /var/spool/postfix/private/dovecot-auth {

    group = postfix

    mode = 0666

    user = postfix

  }

  unix_listener auth-master {

    group = vmail

    mode = 0666

    user = vmail

  }

  unix_listener auth-userdb {

    group = vmail

    mode = 0660

    user = vmail

  }

}

service dict {

  unix_listener dict {

    group = vmail

    mode = 0660

    user = vmail

  }

}

service imap-login {

  process_limit = 500

  service_count = 1

}

service lmtp {

  executable = lmtp -L

  inet_listener lmtp {

    address = 127.0.0.1

    port = 24

  }

  process_min_avail = 5

  unix_listener /var/spool/postfix/private/dovecot-lmtp {

    group = postfix

    mode = 0600

    user = postfix

  }

  user = vmail

}

service managesieve-login {

  inet_listener sieve {

    address = 127.0.0.1

    port = 4190

  }

}

ssl = required

ssl_cert = </etc/letsencrypt/live/mgrids.dynu.com/fullchain.pem

ssl_cipher_list = ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5

ssl_client_ca_file = /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem

ssl_dh = # hidden, use -P to show it

ssl_key = # hidden, use -P to show it

ssl_prefer_server_ciphers = yes

syslog_facility = local5

userdb {

  driver = prefetch

}

protocol imap {

  imap_client_workarounds = tb-extra-mailbox-sep

  mail_max_userip_connections = 30

  mail_plugins = mailbox_alias mail_log notify imap_sieve

}

protocol sieve {

  info_log_path = /var/log/dovecot/sieve-info.log

  log_path = /var/log/dovecot/sieve-err.log

  managesieve_implementation_string = Dovecot Pigeonhole

  managesieve_max_line_length = 65536

}