Konstantinos Tsakiltzidis
2018-Mar-02 17:09 UTC
Sieve filter imapflags with "flagvar" not working
Following the rfc5232, Sieve Email Filtering: Imap4flags Extension
the following filter doesn't work when the `"flagvar"` part is
added
require "imap4flags";
if header :contains "X-Spam" "Yes" {
? setflag "flagvar" "spam";
}
removing the `"flagvar"` part works as expected
# 2.2.33.2 (d6601f4ec): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.4.21 (92477967)
# OS: Linux 4.9.0-6-amd64 x86_64 Debian 9.1 ext4
lda_mailbox_autocreate = yes
lda_mailbox_autosubscribe = yes
mail_debug = yes
mail_location = maildir:/var/vmail/%d/%n
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
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 ? separator = .
? subscriptions = yes
? type = private
}
namespace modulus {
? list = children
? location = maildir:/var/vmail/%d/Public:INDEXPVT=~/public/indexes
? mailbox admin {
??? auto = subscribe
? }
? mailbox support {
??? auto = subscribe
? }
? mailbox telecoms {
??? auto = subscribe
? }
? prefix = Public.
? separator = .
? subscriptions = yes
? type = public
}
passdb {
? driver = pam
}
plugin {
? acl = vfile
? mail_log_events = flag_change
? mail_log_fields = box flags uid
? sieve = ~/dovecot.sieve
? sieve_before = /var/vmail/global.sieve
? sieve_dir = ~/sieve
? sieve_global_dir = /var/vmail/sieve
}
protocols = " imap lmtp sieve lmtp"
service auth {
? unix_listener /var/spool/postfix/private/auth {
??? group = mail
??? mode = 0666
??? user = postfix
? }
? unix_listener auth-userdb {
??? group = mail
??? mode = 0666
??? user = vmail
? }
}
service imap-login {
? inet_listener imap {
??? port = 0
? }
}
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
}
service managesieve {
? process_limit = 1024
}
ssl = required
ssl_cert = </etc/ssl/certs/mail.crt
ssl_key =? # hidden, use -P to show it
userdb {
? driver = passwd
}
protocol imap {
? mail_max_userip_connections = 20
? mail_plugins = " mail_log notify acl"
? passdb {
??? args = /etc/dovecot/dovecot-ldap-users.conf.ext
??? driver = ldap
??? name ? }
? userdb {
??? args = uid=vmail gid=mail home=/var/vmail/%d/%n
??? driver = static
??? name ? }
}
protocol lda {
? mail_plugins = " sieve acl"
? userdb {
??? args = /etc/dovecot/dovecot-ldap-users.conf.ext
??? driver = ldap
??? name ??? override_fields = uid=vmail gid=mail home=/var/vmail/%d/%n
? }
? userdb {
??? args = /etc/dovecot/dovecot-ldap-groups.conf.ext
??? driver = ldap
??? name ??? override_fields = uid=vmail gid=mail
home=/var/vmail/%d/Public/.%n
mail=maildir:/var/vmail/%d/Public/.%n
? }
}
protocol lmtp {
? mail_plugins = " sieve acl"
? postmaster_address = postmaster at modulus.gr
? userdb {
??? args = /etc/dovecot/dovecot-ldap-users.conf.ext
??? driver = ldap
??? name ??? override_fields = uid=vmail gid=mail home=/var/vmail/%d/%n
? }
? userdb {
??? args = /etc/dovecot/dovecot-ldap-groups.conf.ext
??? driver = ldap
??? name ??? override_fields = uid=vmail gid=mail
home=/var/vmail/%d/Public/.%n
mail=maildir:/var/vmail/%d/Public/.%n
? }
}
protocol doveadm {
? userdb {
??? args = /etc/dovecot/dovecot-ldap-users.conf.ext
??? driver = ldap
??? name ??? override_fields = uid=vmail gid=mail home=/var/vmail/%d/%n
? }
? userdb {
??? args = /etc/dovecot/dovecot-ldap-groups.conf.ext
??? driver = ldap
??? name ??? override_fields = uid=vmail gid=mail
home=/var/vmail/%d/Public/.%n
mail=maildir:/var/vmail/%d/Public/.%n
? }
}
protocol sieve {
? mail_max_userip_connections = 10
? managesieve_implementation_string = Dovecot Pigeonhole
? managesieve_logout_format = bytes=%i/%o
? managesieve_max_line_length = 65536
? passdb {
??? args = /etc/dovecot/dovecot-ldap-users.conf.ext
??? driver = ldap
??? name ? }
? userdb {
??? args = uid=vmail gid=mail home=/var/vmail/%d/%n
??? driver = static
??? name ? }
}
What version of pigeonhole are you using? This was fixed recently.
--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 214-642-9640 E-Mail: larryrtx at gmail.com
US Mail: 5708 Sabbia Drive, Round Rock, TX 78665-2106
?On 3/2/18, 11:09 AM, "dovecot on behalf of Konstantinos Tsakiltzidis"
<dovecot-bounces at dovecot.org on behalf of ktsakiltzidis at modulus.gr>
wrote:
Following the rfc5232, Sieve Email Filtering: Imap4flags Extension
the following filter doesn't work when the `"flagvar"` part is
added
require "imap4flags";
if header :contains "X-Spam" "Yes" {
setflag "flagvar" "spam";
}
removing the `"flagvar"` part works as expected
# 2.2.33.2 (d6601f4ec): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.4.21 (92477967)
# OS: Linux 4.9.0-6-amd64 x86_64 Debian 9.1 ext4
lda_mailbox_autocreate = yes
lda_mailbox_autosubscribe = yes
mail_debug = yes
mail_location = maildir:/var/vmail/%d/%n
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
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 separator = .
subscriptions = yes
type = private
}
namespace modulus {
list = children
location = maildir:/var/vmail/%d/Public:INDEXPVT=~/public/indexes
mailbox admin {
auto = subscribe
}
mailbox support {
auto = subscribe
}
mailbox telecoms {
auto = subscribe
}
prefix = Public.
separator = .
subscriptions = yes
type = public
}
passdb {
driver = pam
}
plugin {
acl = vfile
mail_log_events = flag_change
mail_log_fields = box flags uid
sieve = ~/dovecot.sieve
sieve_before = /var/vmail/global.sieve
sieve_dir = ~/sieve
sieve_global_dir = /var/vmail/sieve
}
protocols = " imap lmtp sieve lmtp"
service auth {
unix_listener /var/spool/postfix/private/auth {
group = mail
mode = 0666
user = postfix
}
unix_listener auth-userdb {
group = mail
mode = 0666
user = vmail
}
}
service imap-login {
inet_listener imap {
port = 0
}
}
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
}
service managesieve {
process_limit = 1024
}
ssl = required
ssl_cert = </etc/ssl/certs/mail.crt
ssl_key = # hidden, use -P to show it
userdb {
driver = passwd
}
protocol imap {
mail_max_userip_connections = 20
mail_plugins = " mail_log notify acl"
passdb {
args = /etc/dovecot/dovecot-ldap-users.conf.ext
driver = ldap
name }
userdb {
args = uid=vmail gid=mail home=/var/vmail/%d/%n
driver = static
name }
}
protocol lda {
mail_plugins = " sieve acl"
userdb {
args = /etc/dovecot/dovecot-ldap-users.conf.ext
driver = ldap
name override_fields = uid=vmail gid=mail
home=/var/vmail/%d/%n
}
userdb {
args = /etc/dovecot/dovecot-ldap-groups.conf.ext
driver = ldap
name override_fields = uid=vmail gid=mail
home=/var/vmail/%d/Public/.%n
mail=maildir:/var/vmail/%d/Public/.%n
}
}
protocol lmtp {
mail_plugins = " sieve acl"
postmaster_address = postmaster at modulus.gr
userdb {
args = /etc/dovecot/dovecot-ldap-users.conf.ext
driver = ldap
name override_fields = uid=vmail gid=mail
home=/var/vmail/%d/%n
}
userdb {
args = /etc/dovecot/dovecot-ldap-groups.conf.ext
driver = ldap
name override_fields = uid=vmail gid=mail
home=/var/vmail/%d/Public/.%n
mail=maildir:/var/vmail/%d/Public/.%n
}
}
protocol doveadm {
userdb {
args = /etc/dovecot/dovecot-ldap-users.conf.ext
driver = ldap
name override_fields = uid=vmail gid=mail
home=/var/vmail/%d/%n
}
userdb {
args = /etc/dovecot/dovecot-ldap-groups.conf.ext
driver = ldap
name override_fields = uid=vmail gid=mail
home=/var/vmail/%d/Public/.%n
mail=maildir:/var/vmail/%d/Public/.%n
}
}
protocol sieve {
mail_max_userip_connections = 10
managesieve_implementation_string = Dovecot Pigeonhole
managesieve_logout_format = bytes=%i/%o
managesieve_max_line_length = 65536
passdb {
args = /etc/dovecot/dovecot-ldap-users.conf.ext
driver = ldap
name }
userdb {
args = uid=vmail gid=mail home=/var/vmail/%d/%n
driver = static
name }
}
Konstantinos Tsakiltzidis
2018-Mar-02 17:22 UTC
Sieve filter imapflags with "flagvar" not working
debian package Version: 1:2.2.33.2-1~bpo9+1 On 03/02/2018 07:13 PM, Larry Rosenman wrote:> What version of pigeonhole are you using? This was fixed recently. > >
Op 3/2/2018 om 6:09 PM schreef Konstantinos Tsakiltzidis:> Following the rfc5232, Sieve Email Filtering: Imap4flags Extension > > the following filter doesn't work when the `"flagvar"` part is added > > require "imap4flags"; > > if header :contains "X-Spam" "Yes" { > > ? setflag "flagvar" "spam"; > > }You should be getting an error logged somewhere. Using a flag variable is not allowed, unless the variables extension is enabled. So, you must add `require "variables";' for this script to make sense at all. Regards, Stephan.> removing the `"flagvar"` part works as expected > > > # 2.2.33.2 (d6601f4ec): /etc/dovecot/dovecot.conf > # Pigeonhole version 0.4.21 (92477967) > # OS: Linux 4.9.0-6-amd64 x86_64 Debian 9.1 ext4 > lda_mailbox_autocreate = yes > lda_mailbox_autosubscribe = yes > mail_debug = yes > mail_location = maildir:/var/vmail/%d/%n > 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 > 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 > ? separator = . > ? subscriptions = yes > ? type = private > } > namespace modulus { > ? list = children > ? location = maildir:/var/vmail/%d/Public:INDEXPVT=~/public/indexes > ? mailbox admin { > ??? auto = subscribe > ? } > ? mailbox support { > ??? auto = subscribe > ? } > ? mailbox telecoms { > ??? auto = subscribe > ? } > ? prefix = Public. > ? separator = . > ? subscriptions = yes > ? type = public > } > passdb { > ? driver = pam > } > plugin { > ? acl = vfile > ? mail_log_events = flag_change > ? mail_log_fields = box flags uid > ? sieve = ~/dovecot.sieve > ? sieve_before = /var/vmail/global.sieve > ? sieve_dir = ~/sieve > ? sieve_global_dir = /var/vmail/sieve > } > protocols = " imap lmtp sieve lmtp" > service auth { > ? unix_listener /var/spool/postfix/private/auth { > ??? group = mail > ??? mode = 0666 > ??? user = postfix > ? } > ? unix_listener auth-userdb { > ??? group = mail > ??? mode = 0666 > ??? user = vmail > ? } > } > service imap-login { > ? inet_listener imap { > ??? port = 0 > ? } > } > 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 > } > service managesieve { > ? process_limit = 1024 > } > ssl = required > ssl_cert = </etc/ssl/certs/mail.crt > ssl_key =? # hidden, use -P to show it > userdb { > ? driver = passwd > } > protocol imap { > ? mail_max_userip_connections = 20 > ? mail_plugins = " mail_log notify acl" > ? passdb { > ??? args = /etc/dovecot/dovecot-ldap-users.conf.ext > ??? driver = ldap > ??? name > ? } > ? userdb { > ??? args = uid=vmail gid=mail home=/var/vmail/%d/%n > ??? driver = static > ??? name > ? } > } > protocol lda { > ? mail_plugins = " sieve acl" > ? userdb { > ??? args = /etc/dovecot/dovecot-ldap-users.conf.ext > ??? driver = ldap > ??? name > ??? override_fields = uid=vmail gid=mail home=/var/vmail/%d/%n > ? } > ? userdb { > ??? args = /etc/dovecot/dovecot-ldap-groups.conf.ext > ??? driver = ldap > ??? name > ??? override_fields = uid=vmail gid=mail home=/var/vmail/%d/Public/.%n > mail=maildir:/var/vmail/%d/Public/.%n > ? } > } > protocol lmtp { > ? mail_plugins = " sieve acl" > ? postmaster_address = postmaster at modulus.gr > ? userdb { > ??? args = /etc/dovecot/dovecot-ldap-users.conf.ext > ??? driver = ldap > ??? name > ??? override_fields = uid=vmail gid=mail home=/var/vmail/%d/%n > ? } > ? userdb { > ??? args = /etc/dovecot/dovecot-ldap-groups.conf.ext > ??? driver = ldap > ??? name > ??? override_fields = uid=vmail gid=mail home=/var/vmail/%d/Public/.%n > mail=maildir:/var/vmail/%d/Public/.%n > ? } > } > protocol doveadm { > ? userdb { > ??? args = /etc/dovecot/dovecot-ldap-users.conf.ext > ??? driver = ldap > ??? name > ??? override_fields = uid=vmail gid=mail home=/var/vmail/%d/%n > ? } > ? userdb { > ??? args = /etc/dovecot/dovecot-ldap-groups.conf.ext > ??? driver = ldap > ??? name > ??? override_fields = uid=vmail gid=mail home=/var/vmail/%d/Public/.%n > mail=maildir:/var/vmail/%d/Public/.%n > ? } > } > protocol sieve { > ? mail_max_userip_connections = 10 > ? managesieve_implementation_string = Dovecot Pigeonhole > ? managesieve_logout_format = bytes=%i/%o > ? managesieve_max_line_length = 65536 > ? passdb { > ??? args = /etc/dovecot/dovecot-ldap-users.conf.ext > ??? driver = ldap > ??? name > ? } > ? userdb { > ??? args = uid=vmail gid=mail home=/var/vmail/%d/%n > ??? driver = static > ??? name > ? } > } >
Konstantinos Tsakiltzidis
2018-Mar-05 10:47 UTC
Sieve filter imapflags with "flagvar" not working
tried also with `require "variables"` doesn't seem to work, the flag is not added at all On 03/03/2018 09:54 AM, Stephan Bosch wrote:> Op 3/2/2018 om 6:09 PM schreef Konstantinos Tsakiltzidis: >> Following the rfc5232, Sieve Email Filtering: Imap4flags Extension >> >> the following filter doesn't work when the `"flagvar"` part is added >> >> require "imap4flags"; >> >> if header :contains "X-Spam" "Yes" { >> >> ? setflag "flagvar" "spam"; >> >> } > You should be getting an error logged somewhere. Using a flag variable > is not allowed, unless the variables extension is enabled. So, you must > add `require "variables";' for this script to make sense at all. > > Regards, > > Stephan. > > > > >> removing the `"flagvar"` part works as expected >> >> >> # 2.2.33.2 (d6601f4ec): /etc/dovecot/dovecot.conf >> # Pigeonhole version 0.4.21 (92477967) >> # OS: Linux 4.9.0-6-amd64 x86_64 Debian 9.1 ext4 >> lda_mailbox_autocreate = yes >> lda_mailbox_autosubscribe = yes >> mail_debug = yes >> mail_location = maildir:/var/vmail/%d/%n >> 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 >> 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 >> ? separator = . >> ? subscriptions = yes >> ? type = private >> } >> namespace modulus { >> ? list = children >> ? location = maildir:/var/vmail/%d/Public:INDEXPVT=~/public/indexes >> ? mailbox admin { >> ??? auto = subscribe >> ? } >> ? mailbox support { >> ??? auto = subscribe >> ? } >> ? mailbox telecoms { >> ??? auto = subscribe >> ? } >> ? prefix = Public. >> ? separator = . >> ? subscriptions = yes >> ? type = public >> } >> passdb { >> ? driver = pam >> } >> plugin { >> ? acl = vfile >> ? mail_log_events = flag_change >> ? mail_log_fields = box flags uid >> ? sieve = ~/dovecot.sieve >> ? sieve_before = /var/vmail/global.sieve >> ? sieve_dir = ~/sieve >> ? sieve_global_dir = /var/vmail/sieve >> } >> protocols = " imap lmtp sieve lmtp" >> service auth { >> ? unix_listener /var/spool/postfix/private/auth { >> ??? group = mail >> ??? mode = 0666 >> ??? user = postfix >> ? } >> ? unix_listener auth-userdb { >> ??? group = mail >> ??? mode = 0666 >> ??? user = vmail >> ? } >> } >> service imap-login { >> ? inet_listener imap { >> ??? port = 0 >> ? } >> } >> 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 >> } >> service managesieve { >> ? process_limit = 1024 >> } >> ssl = required >> ssl_cert = </etc/ssl/certs/mail.crt >> ssl_key =? # hidden, use -P to show it >> userdb { >> ? driver = passwd >> } >> protocol imap { >> ? mail_max_userip_connections = 20 >> ? mail_plugins = " mail_log notify acl" >> ? passdb { >> ??? args = /etc/dovecot/dovecot-ldap-users.conf.ext >> ??? driver = ldap >> ??? name >> ? } >> ? userdb { >> ??? args = uid=vmail gid=mail home=/var/vmail/%d/%n >> ??? driver = static >> ??? name >> ? } >> } >> protocol lda { >> ? mail_plugins = " sieve acl" >> ? userdb { >> ??? args = /etc/dovecot/dovecot-ldap-users.conf.ext >> ??? driver = ldap >> ??? name >> ??? override_fields = uid=vmail gid=mail home=/var/vmail/%d/%n >> ? } >> ? userdb { >> ??? args = /etc/dovecot/dovecot-ldap-groups.conf.ext >> ??? driver = ldap >> ??? name >> ??? override_fields = uid=vmail gid=mail home=/var/vmail/%d/Public/.%n >> mail=maildir:/var/vmail/%d/Public/.%n >> ? } >> } >> protocol lmtp { >> ? mail_plugins = " sieve acl" >> ? postmaster_address = postmaster at modulus.gr >> ? userdb { >> ??? args = /etc/dovecot/dovecot-ldap-users.conf.ext >> ??? driver = ldap >> ??? name >> ??? override_fields = uid=vmail gid=mail home=/var/vmail/%d/%n >> ? } >> ? userdb { >> ??? args = /etc/dovecot/dovecot-ldap-groups.conf.ext >> ??? driver = ldap >> ??? name >> ??? override_fields = uid=vmail gid=mail home=/var/vmail/%d/Public/.%n >> mail=maildir:/var/vmail/%d/Public/.%n >> ? } >> } >> protocol doveadm { >> ? userdb { >> ??? args = /etc/dovecot/dovecot-ldap-users.conf.ext >> ??? driver = ldap >> ??? name >> ??? override_fields = uid=vmail gid=mail home=/var/vmail/%d/%n >> ? } >> ? userdb { >> ??? args = /etc/dovecot/dovecot-ldap-groups.conf.ext >> ??? driver = ldap >> ??? name >> ??? override_fields = uid=vmail gid=mail home=/var/vmail/%d/Public/.%n >> mail=maildir:/var/vmail/%d/Public/.%n >> ? } >> } >> protocol sieve { >> ? mail_max_userip_connections = 10 >> ? managesieve_implementation_string = Dovecot Pigeonhole >> ? managesieve_logout_format = bytes=%i/%o >> ? managesieve_max_line_length = 65536 >> ? passdb { >> ??? args = /etc/dovecot/dovecot-ldap-users.conf.ext >> ??? driver = ldap >> ??? name >> ? } >> ? userdb { >> ??? args = uid=vmail gid=mail home=/var/vmail/%d/%n >> ??? driver = static >> ??? name >> ? } >> } >>