Sam Mulvey
2013-Dec-14 18:05 UTC
[Dovecot] Possible pigeonhole dealing with negative numerical values
Using dovecot 2.2.9 and pigeonhole 0.4.2
The system is a Xen VM running Arch Linux x86_64, presently up to date,
on an XFS filesystem in an LVM2 partition. After recently updating my
mail server, I found that a sieve rule I had which would check
X-Spam-Score for a value over a certain number, in my case 2.5. In my
most recent update, negative values would trip the rule.
Here's the rule in question:
# rule:[Spam Filter Subject]
if anyof (header :contains "Subject" "[SPAM]", header :value
"gt"
:comparator "i;as
cii-numeric" "X-Spam-Score" "2.5")
{
fileinto "Spam Box";
stop;
}
I have a successful work-around by checking the numerical value and also
insuring that the header doesn't contain a '-', and things work as
they
should. Possible the bug could be in my Sieve interface, which is a
RoundCube plugin. Otherwise things are working great.
If there's anything I can add, please let me know. Thanks!
-Sam
dovecot -n output:
# 2.2.9: /etc/dovecot/dovecot.conf
# OS: Linux 3.12.4-1-ARCH x86_64 xfs
auth_cache_size = 512 k
auth_cache_ttl = 10 mins
auth_mechanisms = plain login
auth_verbose = yes
default_internal_user = mailstore
first_valid_gid = 50
first_valid_uid = 50
hostname = tacomatelematics.com
last_valid_gid = 50
last_valid_uid = 50
lda_mailbox_autocreate = yes
mail_gid = 50
mail_location = maildir:/var/spool/mail/%d/%n/Maildir/
mail_privileged_group = postfix
mail_uid = 50
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 ihave
namespace {
inbox = yes
location prefix separator = .
type = private
}
passdb {
args = /etc/dovecot/dovecot-sql.conf.ext
driver = sql
}
plugin {
sieve = ~/.dovecot.sieve
sieve_dir = ~/sieve
}
postmaster_address = postmaster at tacomatelematics.com
protocols = imap pop3 lmtp sieve
service auth {
unix_listener /var/spool/postfix/private/auth {
group = postfix
mode = 0666
user = postfix
}
unix_listener auth-master {
group = mailstore
mode = 01130
user = mailstore
}
unix_listener auth-userdb {
group = mailstore
mode = 0600
user = mailstore
}
}
service managesieve-login {
inet_listener sieve {
port = 4190
}
inet_listener sieve_deprecated {
port = 2000
}
}
ssl_cert = </etc/certificate.pem
ssl_key = </etc/certificate.pem
userdb {
args = /etc/dovecot/dovecot-sql.conf.ext
driver = sql
}
protocol lmtp {
mail_plugins = " sieve"
}
protocol lda {
mail_plugins = " sieve"
}
Stephan Bosch
2013-Dec-14 21:37 UTC
[Dovecot] Possible pigeonhole dealing with negative numerical values
On 12/14/2013 7:05 PM, Sam Mulvey wrote:> Using dovecot 2.2.9 and pigeonhole 0.4.2 > > The system is a Xen VM running Arch Linux x86_64, presently up to date, > on an XFS filesystem in an LVM2 partition. After recently updating my > mail server, I found that a sieve rule I had which would check > X-Spam-Score for a value over a certain number, in my case 2.5. In my > most recent update, negative values would trip the rule. > > Here's the rule in question: > > # rule:[Spam Filter Subject] > if anyof (header :contains "Subject" "[SPAM]", header :value "gt" > :comparator "i;as > cii-numeric" "X-Spam-Score" "2.5") > { > fileinto "Spam Box"; > stop; > }http://tools.ietf.org/html/rfc5231#section-3 : `Note: the "i;ascii-numeric" comparator does not support negative numbers.`> I have a successful work-around by checking the numerical value and also > insuring that the header doesn't contain a '-', and things work as they > should. Possible the bug could be in my Sieve interface, which is a > RoundCube plugin. Otherwise things are working great. > > If there's anything I can add, please let me know. Thanks!Checking for a minus is a good workaround. However, there is also a special set of nice Sieve extensions for the purpose of checking spam score: http://tools.ietf.org/html/rfc5235 . It requires some configuration at the server (http://wiki2.dovecot.org/Pigeonhole/Sieve/Extensions/SpamtestVirustest), so it may not always be available. Of course, Roundcube also needs to support it for it to be useful, but I am not sure whether it can normally use those extensions. A quick peek at the sources of the managesieve plugin shows that it probably doesn't support the spamtest extension: https://github.com/roundcube/roundcubemail/blob/master/plugins/managesieve/lib/Roundcube/rcube_sieve_script.php#L29 I also took a quick peek at the source code of JohnDoh's sieverules plugin for RoundCube, and it looks like that one does have support for it. Note that that is a different (more feature-rich) Sieve plugin than the managesieve plugin included in the RoundCube distribution itself. Regards, Stephan.