[Dovecot] Dovecot 2.0.13 and sieve
Hello all,
I am testing Dovecot 2.0.13, with sieve for the vacation.
I have some problems with the :regex as i can see...
An example:
# Sieve Filter # Generato da Ingo (http://www.horde.org/ingo/) (10/06/2011, 04:45:07)
require ["vacation", "regex"];
# Vacanze if allof ( not exists ["list-help", "list-unsubscribe", "list-subscribe", "list-owner", "list-post", "list-archive", "list-id", "Mailing-List"], not header :comparator "i;ascii-casemap" :is "Precedence" ["list", "bulk", "junk"], not header :comparator "i;ascii-casemap" :matches "To" "Multiple recipients of*" ) { if header :regex "Received" "^.*(2011) (\\(.*\\) )?..:..:.. (\\(.*\\) )?(\\+|\\-)....( \\(.*\\))?$" { if header :regex "Received" "^.*(Jun) (\\(.*\\) )?.... (\\(.*\\) )?..:..:.. (\\(.*\\) )?(\\+|\\-)....( \\(.*\\))?$" { if header :regex "Received" "^.*(10) (\\(.*\\) )?... (\\(.*\\) )?.... (\\(.*\\) )?..:..:.. (\\(.*\\) )?(\\+|\\-)....( \\(.*\\))?$" { vacation :days 7 :addresses "claudio@mediaservice.net" :subject "Test autoresponder" "test autoresponder 22"; } } }
}
If i test this script with sieve-test, the result is the following:
sieve-test .dovecot.sieve new/1307715082.M173915P16839.mail2\,S\=1138\,W\=1168 sieve-test(root): Debug: Effective uid=0, gid=0, home=/root sieve-test(root): Debug: Namespace : type=private, prefix=INBOX., sep=, inbox=yes, hidden=no, list=yes, subscriptions=yes location=maildir:/var/mail/virtual//root sieve-test(root): Debug: maildir++: root=/var/mail/virtual//root, index=, control=, inbox=/var/mail/virtual//root sieve-test(root): Debug: none: root=, index=, control=, inbox=
Performed actions:
(none)
Implicit keep:
- store message in folder: INBOX
sieve-test(root): Info: final result: success
No vacation is performed.....
Then, if i modify the script commenting all the regex for the date, the result is the following:
sieve-test .dovecot.sieve new/1307715082.M173915P16839.mail2\,S\=1138\,W\=1168 sieve-test(root): Debug: Effective uid=0, gid=0, home=/root sieve-test(root): Debug: Namespace : type=private, prefix=INBOX., sep=, inbox=yes, hidden=no, list=yes, subscriptions=yes location=maildir:/var/mail/virtual//root sieve-test(root): Debug: maildir++: root=/var/mail/virtual//root, index=, control=, inbox=/var/mail/virtual//root sieve-test(root): Debug: none: root=, index=, control=, inbox=
Performed actions:
- send vacation message: => seconds : 604800 => subject: Test autoresponder => handle : test autoresponder 22Test autoresponder<default-from><NO-MIME>
START MESSAGE test autoresponder 22 END MESSAGE
Implicit keep:
- store message in folder: INBOX
sieve-test(root): Info: final result: success
But the date is right:
date Fri Jun 10 17:22:14 CEST 2011
So, what is wrong? Any help is well accepted, that script with dovecot 1.x is working correctly.... So, what is changed in dovecot 2.0 sieve?
Cordially,
Claudio Prono.
--
Claudio Prono OPST
System Developer
Gsm: +39-349-54.33.258
@PSS Srl Tel: +39-011-32.72.100
Via San Bernardino, 17 Fax: +39-011-32.46.497
10141 Torino - ITALY http://atpss.net/disclaimer
PGP Key - http://keys.atpss.net/c_prono.asc
Il 14/06/2011 10.06, Claudio Prono ha scritto:
Hello all,
I am testing Dovecot 2.0.13, with sieve for the vacation.
I have some problems with the :regex as i can see...
An example:
# Sieve Filter # Generato da Ingo (http://www.horde.org/ingo/) (10/06/2011, 04:45:07)
require ["vacation", "regex"];
# Vacanze if allof ( not exists ["list-help", "list-unsubscribe", "list-subscribe", "list-owner", "list-post", "list-archive", "list-id", "Mailing-List"], not header :comparator "i;ascii-casemap" :is "Precedence" ["list", "bulk", "junk"], not header :comparator "i;ascii-casemap" :matches "To" "Multiple recipients of*" ) { if header :regex "Received" "^.*(2011) (\\(.*\\) )?..:..:.. (\\(.*\\) )?(\\+|\\-)....( \\(.*\\))?$" { if header :regex "Received" "^.*(Jun) (\\(.*\\) )?.... (\\(.*\\) )?..:..:.. (\\(.*\\) )?(\\+|\\-)....( \\(.*\\))?$" { if header :regex "Received" "^.*(10) (\\(.*\\) )?... (\\(.*\\) )?.... (\\(.*\\) )?..:..:.. (\\(.*\\) )?(\\+|\\-)....( \\(.*\\))?$" { vacation :days 7 :addresses "claudio@mediaservice.net" :subject "Test autoresponder" "test autoresponder 22"; } } }
}
If i test this script with sieve-test, the result is the following:
sieve-test .dovecot.sieve new/1307715082.M173915P16839.mail2\,S\=1138\,W\=1168 sieve-test(root): Debug: Effective uid=0, gid=0, home=/root sieve-test(root): Debug: Namespace : type=private, prefix=INBOX., sep=, inbox=yes, hidden=no, list=yes, subscriptions=yes location=maildir:/var/mail/virtual//root sieve-test(root): Debug: maildir++: root=/var/mail/virtual//root, index=, control=, inbox=/var/mail/virtual//root sieve-test(root): Debug: none: root=, index=, control=, inbox=
Performed actions:
(none)
Implicit keep:
- store message in folder: INBOX
sieve-test(root): Info: final result: success
No vacation is performed.....
Then, if i modify the script commenting all the regex for the date, the result is the following:
sieve-test .dovecot.sieve new/1307715082.M173915P16839.mail2\,S\=1138\,W\=1168 sieve-test(root): Debug: Effective uid=0, gid=0, home=/root sieve-test(root): Debug: Namespace : type=private, prefix=INBOX., sep=, inbox=yes, hidden=no, list=yes, subscriptions=yes location=maildir:/var/mail/virtual//root sieve-test(root): Debug: maildir++: root=/var/mail/virtual//root, index=, control=, inbox=/var/mail/virtual//root sieve-test(root): Debug: none: root=, index=, control=, inbox=
Performed actions:
- send vacation message: => seconds : 604800 => subject: Test autoresponder => handle : test autoresponder 22Test autoresponder<default-from><NO-MIME>
START MESSAGE test autoresponder 22 END MESSAGE
Implicit keep:
- store message in folder: INBOX
sieve-test(root): Info: final result: success
But the date is right:
date Fri Jun 10 17:22:14 CEST 2011
So, what is wrong? Any help is well accepted, that script with dovecot 1.x is working correctly.... So, what is changed in dovecot 2.0 sieve?
Cordially,
Claudio Prono.
Ping, anyone for this problem?
--
Claudio Prono OPST
System Developer
Gsm: +39-349-54.33.258
@PSS Srl Tel: +39-011-32.72.100
Via San Bernardino, 17 Fax: +39-011-32.46.497
10141 Torino - ITALY http://atpss.net/disclaimer
PGP Key - http://keys.atpss.net/c_prono.asc
Op 14-6-2011 10:06, Claudio Prono schreef:
Hello all,
I am testing Dovecot 2.0.13, with sieve for the vacation.
I have some problems with the :regex as i can see...
An example: <snip/>
I didn't know Horde Ingo produces such horribly ugly Sieve code; the header checks are unnecessary and the regexes are highly convolved and should probably be substituted with a `date' test.
<snip/>
No vacation is performed.....
Then, if i modify the script commenting all the regex for the date, the result is the following: <snip/>
But the date is right:
date Fri Jun 10 17:22:14 CEST 2011
So, what is wrong? Any help is well accepted, that script with dovecot 1.x is working correctly.... So, what is changed in dovecot 2.0 sieve?
I'm currently on vacation and I can't quite get my head around these regexes. The best thing you can do now is debug it in more detail by using the sieve-test trace debugging features (using -t and -T options), as documented in the man page. This way, you can see what is matched how and which actions are performed. Then, you can narrow it down to one specific failing test.
Regards,
Stephan.
Il 14/06/2011 23.01, Stephan Bosch ha scritto:
Op 14-6-2011 10:06, Claudio Prono schreef:
Hello all,
I am testing Dovecot 2.0.13, with sieve for the vacation.
I have some problems with the :regex as i can see...
An example: <snip/>
I didn't know Horde Ingo produces such horribly ugly Sieve code; the header checks are unnecessary and the regexes are highly convolved and should probably be substituted with a `date' test.
<snip/>
No vacation is performed.....
Then, if i modify the script commenting all the regex for the date, the result is the following: <snip/>
But the date is right:
date Fri Jun 10 17:22:14 CEST 2011
So, what is wrong? Any help is well accepted, that script with dovecot 1.x is working correctly.... So, what is changed in dovecot 2.0 sieve?
I'm currently on vacation and I can't quite get my head around these regexes. The best thing you can do now is debug it in more detail by using the sieve-test trace debugging features (using -t and -T options), as documented in the man page. This way, you can see what is matched how and which actions are performed. Then, you can narrow it down to one specific failing test.
Regards,
Stephan.
I have tryied with the debug level higher of sieve-test, and the result is the following:
sieve-test -t - -Tlevel=matching /tmp/.dovecot.sieve 1308741872.M858197P18322.mail2\,S\=1138\,W\=1168
## Started executing script '.dovecot'
7: exists test
7: header list-help' is missing 7: headers are missing 7: jump if result is true 7: not jumping 7: header test 7: starting
:is' match with i;ascii-casemap' comparator: 7: extracting
Precedence' headers from message
7: finishing match with result: not matched
7: jump if result is true
7: not jumping
7: header test
7: starting :matches' match with
i;ascii-casemap' comparator:
7: extracting To' headers from message 7: matching value
claudio <claudio@mediaservice.net>'
7: with key Multiple recipients of*' => 0 7: finishing match with result: not matched 7: jump if result is true 7: not jumping 8: header test 8: starting
:regex' match with i;ascii-casemap' comparator: 8: extracting
Received' headers from message
8: matching value from private (charon.mediaservice.net [213.254.20.254])' 8: with regex
^.*(2011) (\(.*\) )?..:..:.. (\(.*\)
)?(\+|\-)....( \(.*\))?$' [id=0] => 0
8: finishing match with result: not matched
8: jump if result is false
8: jumping to line 19
## Finished executing script '.dovecot'
Performed actions:
(none)
Implicit keep:
- store message in folder: INBOX
sieve-test(root): Info: final result: success
As i can see, the regex of the year is not matching.... but why? Also, the other regex for the Month or the day, are not matching (tested commented out).
Any hint?
Cordially,
Claudio Prono.
--
Claudio Prono OPST
System Developer
Gsm: +39-349-54.33.258
@PSS Srl Tel: +39-011-32.72.100
Via San Bernardino, 17 Fax: +39-011-32.46.497
10141 Torino - ITALY http://atpss.net/disclaimer
PGP Key - http://keys.atpss.net/c_prono.asc
Op 22-6-2011 13:36, Claudio Prono schreef:
Il 14/06/2011 23.01, Stephan Bosch ha scritto:
I'm currently on vacation and I can't quite get my head around these regexes. The best thing you can do now is debug it in more detail by using the sieve-test trace debugging features (using -t and -T options), as documented in the man page. This way, you can see what is matched how and which actions are performed. Then, you can narrow it down to one specific failing test.
I have tryied with the debug level higher of sieve-test, and the result is the following:
sieve-test -t - -Tlevel=matching /tmp/.dovecot.sieve 1308741872.M858197P18322.mail2\,S\=1138\,W\=1168
<snip/>
8: header test 8: starting `:regex' match with `i;ascii-casemap' comparator: 8: extracting `Received' headers from message 8: matching value `from private (charon.mediaservice.net
[213.254.20.254])' 8: with regex `^.*(2011) (\(.*\) )?..:..:.. (\(.*\) )?(\+|\-)....( \(.*\))?$' [id=0] => 0 8: finishing match with result: not matched
<snip/>
As i can see, the regex of the year is not matching.... but why? Also, the other regex for the Month or the day, are not matching (tested commented out).
Well, for one, in the value being matched there is no date. Could you provide an example of a failing message so we can check why the data retrieved from the Received header does not contain any date info?
Regards,
Stephan.
Il 22/06/2011 14.29, Stephan Bosch ha scritto:
Op 22-6-2011 13:36, Claudio Prono schreef:
Il 14/06/2011 23.01, Stephan Bosch ha scritto:
I'm currently on vacation and I can't quite get my head around these regexes. The best thing you can do now is debug it in more detail by using the sieve-test trace debugging features (using -t and -T options), as documented in the man page. This way, you can see what is matched how and which actions are performed. Then, you can narrow it down to one specific failing test.
I have tryied with the debug level higher of sieve-test, and the result is the following:
sieve-test -t - -Tlevel=matching /tmp/.dovecot.sieve 1308741872.M858197P18322.mail2\,S\=1138\,W\=1168
<snip/>
8: header test 8: starting `:regex' match with `i;ascii-casemap' comparator: 8: extracting `Received' headers from message 8: matching value `from private (charon.mediaservice.net
[213.254.20.254])' 8: with regex `^.*(2011) (\(.*\) )?..:..:.. (\(.*\) )?(\+|\-)....( \(.*\))?$' [id=0] => 0 8: finishing match with result: not matched
<snip/>
As i can see, the regex of the year is not matching.... but why? Also, the other regex for the Month or the day, are not matching (tested commented out).
Well, for one, in the value being matched there is no date. Could you provide an example of a failing message so we can check why the data retrieved from the Received header does not contain any date info?
Sure, here it is:
Return-Path: <claudio.prono@atpss.net> Delivered-To: claudio@mediaservice.net Received: from private (XXX.mediaservice.net [XXX.XXX.XXX.XXX]) Message-ID: <4E01D0EF.5010300@atpss.net> Date: Wed, 22 Jun 2011 13:24:31 +0200 From: Claudio Prono <claudio.prono@atpss.net> Reply-To: claudio.prono@atpss.net User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; it; rv:1.9.2.17) Gecko/20110414 Lightning/1.0b2 Thunderbird/3.1.10 MIME-Version: 1.0 To: claudio <claudio@mediaservice.net> Subject: test X-Enigmail-Version: 1.1.1 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit
--
Claudio Prono OPST
System Developer
Gsm: +39-349-54.33.258
@PSS Srl Tel: +39-011-32.72.100
Via San Bernardino, 17 Fax: +39-011-32.46.497
10141 Torino - ITALY http://atpss.net/disclaimer
PGP Key - http://keys.atpss.net/c_prono.asc
Op 22-6-2011 14:48, Claudio Prono schreef:
Il 22/06/2011 14.29, Stephan Bosch ha scritto:
As i can see, the regex of the year is not matching.... but why? Also, the other regex for the Month or the day, are not matching (tested commented out). Well, for one, in the value being matched there is no date. Could you
Op 22-6-2011 13:36, Claudio Prono schreef: provide an example of a failing message so we can check why the data retrieved from the Received header does not contain any date info? Sure, here it is:
<snip/>
Received: from private (XXX.mediaservice.net [XXX.XXX.XXX.XXX]) <snip/>
This is not a valid Received header. Looks like something in your mail path eats multi-line (folded) headers. It should look like this (the stuff in parentheses is comment and thus optional):
Received: from dovecot.org ([193.210.130.67]:60628) by drpepper.rename-it.nl with esmtp (Exim 4.72) (envelope-from<dovecot-bounces@dovecot.org>) id 1QZMt9-00017I-4Y for stephan@rename-it.nl; Wed, 22 Jun 2011 14:50:39 +0200
You seem to have only the first line left. I wouldn't know what could cause this.
Regards,
Stephan
Il 22/06/2011 15.24, Stephan Bosch ha scritto:
Op 22-6-2011 14:48, Claudio Prono schreef:
Il 22/06/2011 14.29, Stephan Bosch ha scritto:
As i can see, the regex of the year is not matching.... but why? Also, the other regex for the Month or the day, are not matching (tested commented out). Well, for one, in the value being matched there is no date. Could you
Op 22-6-2011 13:36, Claudio Prono schreef: provide an example of a failing message so we can check why the data retrieved from the Received header does not contain any date info? Sure, here it is:
<snip/>
Received: from private (XXX.mediaservice.net [XXX.XXX.XXX.XXX]) <snip/>
This is not a valid Received header. Looks like something in your mail path eats multi-line (folded) headers. It should look like this (the stuff in parentheses is comment and thus optional):
Received: from dovecot.org ([193.210.130.67]:60628) by drpepper.rename-it.nl with esmtp (Exim 4.72) (envelope-from<dovecot-bounces@dovecot.org>) id 1QZMt9-00017I-4Y for stephan@rename-it.nl; Wed, 22 Jun 2011 14:50:39 +0200
You seem to have only the first line left. I wouldn't know what could cause this.
Ok, is a problem of my internal mails, i have a regex matching my internal class and modifying che headers of the mail on the fly. Now i have made a test with an external mail.
Here is the headers of the mail:
Return-Path: <cybercloud@alice.it> Delivered-To: claudio@mediaservice.net Received: from localhost (localhost [127.0.0.1]) by mail2.mediaservice.net (Postfix) with SMTP id 59263B1827D for <claudio@mediaservice.net>; Wed, 22 Jun 2011 17:43:07 +0200 (CEST) Received: from smtp302.alice.it (smtp302.alice.it [82.57.200.118]) by mail2.mediaservice.net (Postfix) with ESMTP id 256F2B18279 for <claudio@mediaservice.net>; Wed, 22 Jun 2011 17:43:07 +0200 (CEST) Received: from feu14-alice (82.57.204.69) by smtp302.alice.it (8.5.124.08) id 4DEE2478005DA4C7 for claudio@mediaservice.net; Wed, 22 Jun 2011 17:43:06 +0200 Received: from (79.4.123.31) by alicemail.rossoalice.alice.it; Wed, 22 Jun 2011 17:43:06 +0200 Message-ID: <130b804e67b.cybercloud@alice.it> Date: Wed, 22 Jun 2011 17:43:06 +0200 (CEST) From: "cybercloud@alice.it" <cybercloud@alice.it> Reply-To: "cybercloud@alice.it" <cybercloud@alice.it> To: claudio@mediaservice.net Subject: test vacation Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_43520_25034745.1308757386914" X-Originating-IP: 79.4.123.31 X-DSPAM-Result: Whitelisted X-DSPAM-Processed: Wed Jun 22 17:43:07 2011 X-DSPAM-Confidence: 0.9901 X-DSPAM-Probability: 0.0000 X-DSPAM-Signature: 1,4e020d8b286456121419446
------=_Part_43520_25034745.1308757386914 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit
Message
!DSPAM:1,4e020d8b286456121419446!
------=_Part_43520_25034745.1308757386914 Content-Type: text/html;charset="UTF-8" Content-Transfer-Encoding: 7bit
<snip>
And there is the sieve-test:
sieve-test -t - -Tlevel=matching .dovecot.sieve 1308757387.M635481P28650.mail2\,S\=1845\,W\=1893
## Started executing script '.dovecot'
7: exists test
7: header list-help' is missing 7: headers are missing 7: jump if result is true 7: not jumping 7: header test 7: starting
:is' match with i;ascii-casemap' comparator: 7: extracting
Precedence' headers from message
7: finishing match with result: not matched
7: jump if result is true
7: not jumping
7: header test
7: starting :matches' match with
i;ascii-casemap' comparator:
7: extracting To' headers from message 7: matching value
claudio@mediaservice.net'
7: with key Multiple recipients of*' => 0 7: finishing match with result: not matched 7: jump if result is true 7: not jumping 9: header test 9: starting
:regex' match with i;ascii-casemap' comparator: 9: extracting
Received' headers from message
9: matching value from localhost (localhost [127.0.0.1]) by mail2.mediaservice.net (Postfix) wi...' 9: with regex
^.*(May) (\(.*\) )?.... (\(.*\) )?..:..:.. (\(.*\)
)?(\+|\-)....( \(.*\))?$' [id=0] => 0
9: matching value from smtp302.alice.it (smtp302.alice.it [82.57.200.118]) by mail2.mediaservic...' 9: with compiled regex [id=0] => 0 9: matching value
from feu14-alice (82.57.204.69) by
smtp302.alice.it (8.5.124.08) id 4D...'
9: with compiled regex [id=0] => 0
9: matching value `from (79.4.123.31) by
alicemail.rossoalice.alice.it; Wed, 22 Jun 2011 17:43:...'
9: with compiled regex [id=0] => 0
9: finishing match with result: not matched
9: jump if result is false
9: jumping to line 10
## Finished executing script '.dovecot'
Performed actions:
(none)
Implicit keep:
- store message in folder: INBOX
sieve-test(root): Info: final result: success
And also in this case, no vacation at all... but different output.... that can be useful?
Cordially,
Claudio Prono.
!DSPAM:1,4e01ed38232161453618201!
--
Claudio Prono OPST
System Developer
Gsm: +39-349-54.33.258
@PSS Srl Tel: +39-011-32.72.100
Via San Bernardino, 17 Fax: +39-011-32.46.497
10141 Torino - ITALY http://atpss.net/disclaimer
PGP Key - http://keys.atpss.net/c_prono.asc
Op 22-6-2011 17:49, Claudio Prono schreef:
And also in this case, no vacation at all... but different output.... that can be useful?
Eh. I've finally spent some time to conclusively derive what this horrible regex mess is supposed to achieve. Concretely, it checks whether a specific date is mentioned in the Received headers. If not, the vacation is not performed. So, you must check the functionality with a message that has a date matching the regex. In your first e-mail this was 10 June 2011. The trace log you provided in your last e-mail uses a date some time in May (obviously you had the script re-generated by Ingo at some point).
I've modified your test e-mail to have a date of 10 June 2011 and I checked it with the script example you provided: it successfully yields a vacation response.
Regards,
Stephan.
participants (2)
-
Claudio Prono
-
Stephan Bosch