Sieve: reject certain mime-types and notify recipient
I have to reject office files for a certain domain plus notifying the original recipient about the rejection too.
require ["fileinto","reject","body","enotify","variables"];
if allof (address :contains ["To","TO","Cc","CC"] "@example.org", body :content "application/msword" :contains "") { set "to" "${1}"; # :matches is used to get the value of the Subject header if header :matches "Subject" "*" { set "subject" "${1}"; } # :matches is used to get the value of the From header if header :matches "From" "*" { set "from" "${1}"; } notify :message "Rejected Office Datei ${from}: ${subject}" "${to}"; reject text: Aus Sicherheitsgründen nehmen wir keine Office Dateien mehr an. Bitte senden Sie uns ein PDF. . ; }
A manual sievec call gives not error and if I remove everything but the reject line it works.
Any ideas?
--
Ralf Becker EGroupware GmbH [www.egroupware.org] Handelsregister HRB Kaiserslautern 3587 Geschäftsführer Birgit und Ralf Becker Leibnizstr. 17, 67663 Kaiserslautern, Germany Telefon +49 631 31657-0
I case someone is interesed too, why it was not working:
Am 14.01.19 um 20:22 schrieb Ralf Becker:
I have to reject office files for a certain domain plus notifying the original recipient about the rejection too.
require ["fileinto","reject","body","enotify","variables"];
if allof (address :contains ["To","TO","Cc","CC"] "@example.org", body :content "application/msword" :contains "") { set "to" "${1}";
The set does not work in allof with an other condition, so I use now:
if address :contains ["To","TO","Cc","CC"] "@example.org" { set "to" "${1}"; }
# :matches is used to get the value of the Subject header if header :matches "Subject" "*" { set "subject" "${1}"; } # :matches is used to get the value of the From header if header :matches "From" "*" { set "from" "${1}"; } notify :message "Rejected Office Datei ${from}: ${subject}" "${to}";
The notify needs as argument "mailto:${to}".
reject text: Aus Sicherheitsgründen nehmen wir keine Office Dateien mehr an. Bitte senden Sie uns ein PDF. . ; }
A manual sievec call gives not error and if I remove everything but the reject line it works.
Any ideas?
I used the sieve-test binary to figure out why it was not working.
My full script for checking mime-types as well as extensions and also notifying the orginal recipient is now the following:
require [ "foreverypart", "mime", "fileinto","reject","body","enotify","variables"];
if address :contains ["To","TO","Cc","CC"] "@example.org" { # :matches is used to get value of to, subject and from if address :matches ["To","TO","Cc","CC"] "*" { set "to" "${1}"; } if header :matches "Subject" "*" { set "subject" "${1}"; } if header :matches "From" "*" { set "from" "${1}"; }
# reject based on mime-type if allof(body :content "application/msword" :contains "", body :content "application/msexcel" :contains "") { # send notification to original recipient notify :message "Rejected Office Datei von ${from}: ${subject}" "mailto:${to}"; # send rejection message to sender reject text: Aus Sicherheitsgründen nehmen wir keine Office Dateien mehr an. Bitte senden Sie uns ein PDF.
Ralf Becker EGroupware GmbH . ; stop; } # reject based on extension of attachment foreverypart { if header :mime :param "filename" :matches ["Content-Type", "Content-Disposition"] ["*.doc","*.xsl"] { # send notification to original recipient notify :message "Rejected Dateierweiterung/Fileextension ${from}: ${subject}" "mailto:${to}"; # send rejection message to sender reject text: Aus Sicherheitsgründen nehmen wir kein Office Dateien mehr an. Bitte senden Sie uns ein PDF.
Ralf Becker EGroupware GmbH . ; stop; } } }
Ralf
-- Ralf Becker EGroupware GmbH [www.egroupware.org] Handelsregister HRB Kaiserslautern 3587 Geschäftsführer Birgit und Ralf Becker Leibnizstr. 17, 67663 Kaiserslautern, Germany Telefon +49 631 31657-0
i recently upgraded a server from dovecot 2.1 to 2.3 unfortunately sieve does not appear to be working. The user scripts have not changed, and neither has the dovecont config. using managesieve allows me to create new sieve files and setting one as default updates the link in ~/ to point to the correct file, but the .dovecot.svbin file is not changed (unless i run sievec /home/username/.dovecot.sieve ) I have tested an out of office script that was working on the old system, and a simple test script that flags the mail as $label1 as per an example. email arrives in users mailboxes but sieve scripts don't appear to be doing anything. below is the output of doveconf -n (hostname changed for security)
# 2.3.1 (8e2f634): /etc/dovecot/dovecot.conf # Pigeonhole version 0.5.1 (d9bc6dfe) # OS: Linux 4.19.14 x86_64 Slackware 14.2 ext4 # Hostname: mail.myserver.net base_dir = /var/run/dovecot/ debug_log_path = /var/log/dovecot.log default_client_limit = 6000 default_process_limit = 1300 hostname = mail.myserver.net info_log_path = /var/log/dovecot.info lda_mailbox_autocreate = yes lda_mailbox_autosubscribe = yes listen = 10.1.1.100 login_greeting = Dovecot at mcfadyens.net login_log_format_elements = user=<%u> method=%m rip=%r lip=%l mpid=%e %c mail_location = maildir:/var/spool/dovecot/%n mail_log_prefix = "%s(%u): " 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 passdb { driver = shadow } plugin { mail_log_events = delete undelete expunge copy mailbox_delete mailbox_rename mail_log_fields = uid box msgid size mail_log_group_events = yes sieve = file:~/sieve;active=~/.dovecot.sieve sieve_dir = ~/sieve sieve_user_log = ~/.dovecot.sieve.log } protocols = imap lmtp sieve service managesieve-login { inet_listener sieve { port = 4190 } service_count = 0 vsz_limit = 128 M } ssl = required ssl_cert = </etc/ssl/certs/dovecot.cert ssl_dh = # hidden, use -P to show it ssl_key = # hidden, use -P to show it userdb { driver = passwd } protocol lda { mail_plugins = " sieve" } protocol lmtp { mail_plugins = " sieve" } protocol imap { mail_max_userip_connections = 30 }
Any pointers on what might be wrong or how to test would be appreciated, thanks, Tim (the os is 64bit slackware 14.2, in case it is relevant)
On 19/01/2019 08:01, Aki Tuomi wrote:
On 19 January 2019 at 02:07 Tim Dickson via dovecot < dovecot@dovecot.org <mailto:dovecot@dovecot.org>> wrote:
i recently upgraded a server from dovecot 2.1 to 2.3 unfortunately sieve does not appear to be working. The user scripts have not changed, and neither has the dovecont config. using managesieve allows me to create new sieve files and setting one as default updates the link in ~/ to point to the correct file, but the .dovecot.svbin file is not changed (unless i run sievec /home/username/.dovecot.sieve ) I have tested an out of office script that was working on the old system, and a simple test script that flags the mail as $label1 as per an example. email arrives in users mailboxes but sieve scripts don't appear to be doing anything. below is the output of doveconf -n (hostname changed for security)
# 2.3.1 (8e2f634): /etc/dovecot/dovecot.conf # Pigeonhole version 0.5.1 (d9bc6dfe) # OS: Linux 4.19.14 x86_64 Slackware 14.2 ext4 # Hostname: mail.myserver.net base_dir = /var/run/dovecot/ debug_log_path = /var/log/dovecot.log default_client_limit = 6000 default_process_limit = 1300 hostname = mail.myserver.net info_log_path = /var/log/dovecot.info lda_mailbox_autocreate = yes lda_mailbox_autosubscribe = yes listen = 10.1.1.100 login_greeting = Dovecot at mcfadyens.net login_log_format_elements = user=<%u> method=%m rip=%r lip=%l mpid=%e %c mail_location = maildir:/var/spool/dovecot/%n mail_log_prefix = "%s(%u): " 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 passdb { driver = shadow } plugin { mail_log_events = delete undelete expunge copy mailbox_delete mailbox_rename mail_log_fields = uid box msgid size mail_log_group_events = yes sieve = file:~/sieve;active=~/.dovecot.sieve sieve_dir = ~/sieve sieve_user_log = ~/.dovecot.sieve.log } protocols = imap lmtp sieve service managesieve-login { inet_listener sieve { port = 4190 } service_count = 0 vsz_limit = 128 M } ssl = required ssl_cert = </etc/ssl/certs/dovecot.cert ssl_dh = # hidden, use -P to show it ssl_key = # hidden, use -P to show it userdb { driver = passwd } protocol lda { mail_plugins = " sieve" } protocol lmtp { mail_plugins = " sieve" } protocol imap { mail_max_userip_connections = 30 }
Any pointers on what might be wrong or how to test would be appreciated, thanks, Tim (the os is 64bit slackware 14.2, in case it is relevant)
Can you turn on mail_debug=yes and provide logs of delivery?
Aki Tuomi
relevant info from /var/log/dovecot.info (domain changed for privacy)
Jan 19 09:26:58 master: Info: Dovecot v2.3.1 (8e2f634) starting up for imap, lmtp, sieve (core dumps disabled) Jan 19 09:27:09 lda(tim): Info: msgid=<c35e8888-bcb4-0b26-9e9e-e16d60f20b01@mydomain.net>: saved mail to INBOX
relevant info from /var/log/dovecot.log (domain changed for privacy)
Jan 19 09:27:09 lda(tim): Debug: Loading modules from directory:
/usr/lib64/dovecot
Jan 19 09:27:09 lda(tim): Debug: Module loaded:
/usr/lib64/dovecot/lib90_sieve_plugin.so
Jan 19 09:27:09 lda(tim): Debug: auth USER input: tim
system_groups_user=tim uid=1003 gid=100 home=/home/tim
Jan 19 09:27:09 lda(tim): Debug: Effective uid=1003, gid=100, home=/home/tim
Jan 19 09:27:09 lda(tim): Debug: maildir++: root=/var/spool/dovecot/tim,
index=, indexpvt=, control=, inbox=/var/spool/dovecot/tim, alt=
Jan 19 09:27:09 lda(tim): Debug: none: root=, index=, indexpvt=,
control=, inbox=, alt=
Jan 19 09:27:09 lda(tim): Debug: Destination address:
<tim@mail.myserver.net> (source: user@hostname)
Jan 19 09:27:09 lda(tim): Debug: sieve: Pigeonhole version 0.5.1
(d9bc6dfe) initializing
Jan 19 09:27:09 lda(tim): Debug: sieve: include: sieve_global is not
set; it is currently not possible to include :global' scripts. Jan 19 09:27:09 lda(tim): Debug: sieve: file storage: Using active Sieve script path: /home/tim/.dovecot.sieve Jan 19 09:27:09 lda(tim): Debug: sieve: file storage: Using script storage path: /home/tim/sieve Jan 19 09:27:09 lda(tim): Debug: sieve: file storage: Relative path to sieve storage in active link: sieve/ Jan 19 09:27:09 lda(tim): Debug: sieve: file storage: Using Sieve script path: /home/tim/.dovecot.sieve Jan 19 09:27:09 lda(tim): Debug: sieve: file script: Opened script
test' from `/home/tim/.dovecot.sieve'
Jan 19 09:27:09 lda(tim): Debug: sieve: Using the following location for
user's Sieve script: /home/tim/.dovecot.sieve
Jan 19 09:27:09 lda(tim): Debug: Mailbox stdin: Opened mail UID=1
because: header Return-Path (Cache file is unusable)
Jan 19 09:27:09 lda(tim): Debug: INBOX: Mailbox opened because: lib-lda
delivery
Jan 19 09:27:09 lda(tim): Debug: Mailbox stdin: Opened mail UID=1
because: copying
Jan 19 09:27:09 imap(heather): Debug: Effective uid=1002, gid=100,
home=/home/heather
Jan 19 09:27:09 imap(heather): Debug: maildir++:
root=/var/spool/dovecot/heather, index=, indexpvt=, control=,
inbox=/var/spool/dovecot/heather, alt=
Jan 19 09:27:09 imap(heather): Debug: Sent: Mailbox opened because: append
Jan 19 09:27:10 imap(heather): Debug: Effective uid=1002, gid=100,
home=/home/heather
Jan 19 09:27:10 imap(heather): Debug: maildir++:
root=/var/spool/dovecot/heather, index=, indexpvt=, control=,
inbox=/var/spool/dovecot/heather, alt=
Jan 19 09:27:10 imap(heather): Debug: Sent: Mailbox opened because: SELECT
As you can see, the test was sending a mail from user heather to user tim on the same server (for speed). The mail arrived at tim mailbox, but no actions appear to have been taken. I can provide more info if needed. The only thing I have edited (for privacy) in the logs is the server domain name.
On 19/01/2019 10:02, Aki Tuomi wrote:
On 19 January 2019 at 11:51 Tim Dickson via dovecot < dovecot@dovecot.org <mailto:dovecot@dovecot.org>> wrote:
On 19/01/2019 08:01, Aki Tuomi wrote:
On 19 January 2019 at 02:07 Tim Dickson via dovecot < dovecot@dovecot.org <mailto:dovecot@dovecot.org> <mailto:
i recently upgraded a server from dovecot 2.1 to 2.3 unfortunately sieve does not appear to be working. The user
not changed, and neither has the dovecont config. using managesieve allows me to create new sieve files and setting one as default updates the link in ~/ to point to the correct file, but the .dovecot.svbin file is not changed (unless i run sievec /home/username/.dovecot.sieve ) I have tested an out of office script that was working on the old system, and a simple test script that flags the mail as $label1 as
dovecot@dovecot.org <mailto:dovecot@dovecot.org>>> wrote: scripts have per
an example. email arrives in users mailboxes but sieve scripts don't appear to be doing anything. below is the output of doveconf -n (hostname changed for security)
# 2.3.1 (8e2f634): /etc/dovecot/dovecot.conf # Pigeonhole version 0.5.1 (d9bc6dfe) # OS: Linux 4.19.14 x86_64 Slackware 14.2 ext4 # Hostname: mail.myserver.net base_dir = /var/run/dovecot/ debug_log_path = /var/log/dovecot.log default_client_limit = 6000 default_process_limit = 1300 hostname = mail.myserver.net info_log_path = /var/log/dovecot.info lda_mailbox_autocreate = yes lda_mailbox_autosubscribe = yes listen = 10.1.1.100 login_greeting = Dovecot at mcfadyens.net login_log_format_elements = user=<%u> method=%m rip=%r lip=%l mpid=%e %c mail_location = maildir:/var/spool/dovecot/%n mail_log_prefix = "%s(%u): " 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 passdb { driver = shadow } plugin { mail_log_events = delete undelete expunge copy mailbox_delete mailbox_rename mail_log_fields = uid box msgid size mail_log_group_events = yes sieve = file:~/sieve;active=~/.dovecot.sieve sieve_dir = ~/sieve sieve_user_log = ~/.dovecot.sieve.log } protocols = imap lmtp sieve service managesieve-login { inet_listener sieve { port = 4190 } service_count = 0 vsz_limit = 128 M } ssl = required ssl_cert = </etc/ssl/certs/dovecot.cert ssl_dh = # hidden, use -P to show it ssl_key = # hidden, use -P to show it userdb { driver = passwd } protocol lda { mail_plugins = " sieve" } protocol lmtp { mail_plugins = " sieve" } protocol imap { mail_max_userip_connections = 30 }
Any pointers on what might be wrong or how to test would be appreciated, thanks, Tim (the os is 64bit slackware 14.2, in case it is relevant)
Can you turn on mail_debug=yes and provide logs of delivery?
Aki Tuomi relevant info from /var/log/dovecot.info (domain changed for privacy)
Jan 19 09:26:58 master: Info: Dovecot v2.3.1 (8e2f634) starting up for imap, lmtp, sieve (core dumps disabled) Jan 19 09:27:09 lda(tim): Info: msgid=< c35e8888-bcb4-0b26-9e9e-e16d60f20b01@mydomain.net <mailto:c35e8888-bcb4-0b26-9e9e-e16d60f20b01@mydomain.net>>: saved mail to INBOX
relevant info from /var/log/dovecot.log (domain changed for privacy)
Jan 19 09:27:09 lda(tim): Debug: Loading modules from directory: /usr/lib64/dovecot Jan 19 09:27:09 lda(tim): Debug: Module loaded: /usr/lib64/dovecot/lib90_sieve_plugin.so Jan 19 09:27:09 lda(tim): Debug: auth USER input: tim system_groups_user=tim uid=1003 gid=100 home=/home/tim Jan 19 09:27:09 lda(tim): Debug: Effective uid=1003, gid=100, home=/home/tim Jan 19 09:27:09 lda(tim): Debug: maildir++: root=/var/spool/dovecot/tim, index=, indexpvt=, control=, inbox=/var/spool/dovecot/tim, alt= Jan 19 09:27:09 lda(tim): Debug: none: root=, index=, indexpvt=, control=, inbox=, alt= Jan 19 09:27:09 lda(tim): Debug: Destination address: < tim@mail.myserver.net <mailto:tim@mail.myserver.net>> (source: user@hostname) Jan 19 09:27:09 lda(tim): Debug: sieve: Pigeonhole version 0.5.1 (d9bc6dfe) initializing Jan 19 09:27:09 lda(tim): Debug: sieve: include: sieve_global is not set; it is currently not possible to include
:global' scripts. Jan 19 09:27:09 lda(tim): Debug: sieve: file storage: Using active Sieve script path: /home/tim/.dovecot.sieve Jan 19 09:27:09 lda(tim): Debug: sieve: file storage: Using script storage path: /home/tim/sieve Jan 19 09:27:09 lda(tim): Debug: sieve: file storage: Relative path to sieve storage in active link: sieve/ Jan 19 09:27:09 lda(tim): Debug: sieve: file storage: Using Sieve script path: /home/tim/.dovecot.sieve Jan 19 09:27:09 lda(tim): Debug: sieve: file script: Opened script
test' from `/home/tim/.dovecot.sieve' Jan 19 09:27:09 lda(tim): Debug: sieve: Using the following location for user's Sieve script: /home/tim/.dovecot.sieve Jan 19 09:27:09 lda(tim): Debug: Mailbox stdin: Opened mail UID=1 because: header Return-Path (Cache file is unusable) Jan 19 09:27:09 lda(tim): Debug: INBOX: Mailbox opened because: lib-lda delivery Jan 19 09:27:09 lda(tim): Debug: Mailbox stdin: Opened mail UID=1 because: copying Jan 19 09:27:09 imap(heather): Debug: Effective uid=1002, gid=100, home=/home/heather Jan 19 09:27:09 imap(heather): Debug: maildir++: root=/var/spool/dovecot/heather, index=, indexpvt=, control=, inbox=/var/spool/dovecot/heather, alt= Jan 19 09:27:09 imap(heather): Debug: Sent: Mailbox opened because: append Jan 19 09:27:10 imap(heather): Debug: Effective uid=1002, gid=100, home=/home/heather Jan 19 09:27:10 imap(heather): Debug: maildir++: root=/var/spool/dovecot/heather, index=, indexpvt=, control=, inbox=/var/spool/dovecot/heather, alt= Jan 19 09:27:10 imap(heather): Debug: Sent: Mailbox opened because: SELECTAs you can see, the test was sending a mail from user heather to user tim on the same server (for speed). The mail arrived at tim mailbox, but no actions appear to have been taken. I can provide more info if needed. The only thing I have edited (for privacy) in the logs is the server domain name.
Can you share the script too?
Aki Tuomi
both scripts are below (server/domain changed for privacy) the current test script active (test.sieve) is
require ["envelope", "imap4flags"]; if envelope "from" "heather@myserver.net" { addflag "$label1"; }
the out of office script (outofoffice.sieve) which was working previously is
require "vacation"; vacation :days 1 :addresses [ "tim@myserver.net" ] :subject "Out of Office reply" :mime text: MIME-Version: 1.0 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML><HEAD><TITLE>Auto-reply from tim </TITLE></HEAD> <BODY> Thank you for your email.<BR><P> i'm out on this weekend.<P> Best Regards <P> tim test <P> <BR> <P> <font color="navy" face="verdana" size="2"><strong> MyCompany Ltd<br> </strong></font> <font color="blue" face="verdana" size="1"> MyStreet<br> myyown<br> Mystatel<br> mypostcode<br> <br> Tel: +44 (0) mytel<br> Fax: +44 (0) myfax<br> <br> <a href="mailto:tim@myserver.net">tim@myserver.net</a> </font> </BODY></HTML> . ;
Op 19/01/2019 om 10:51 schreef Tim Dickson via dovecot:
On 19/01/2019 08:01, Aki Tuomi wrote:
On 19 January 2019 at 02:07 Tim Dickson via dovecot < dovecot@dovecot.org <mailto:dovecot@dovecot.org>> wrote:
i recently upgraded a server from dovecot 2.1 to 2.3 unfortunately sieve does not appear to be working. The user scripts have not changed, and neither has the dovecont config. using managesieve allows me to create new sieve files and setting one as default updates the link in ~/ to point to the correct file, but the .dovecot.svbin file is not changed (unless i run sievec /home/username/.dovecot.sieve ) I have tested an out of office script that was working on the old system, and a simple test script that flags the mail as $label1 as per an example. email arrives in users mailboxes but sieve scripts don't appear to be doing anything. below is the output of doveconf -n (hostname changed for security)
relevant info from /var/log/dovecot.info (domain changed for privacy)
Jan 19 09:26:58 master: Info: Dovecot v2.3.1 (8e2f634) starting up for imap, lmtp, sieve (core dumps disabled) Jan 19 09:27:09 lda(tim): Info: msgid=<c35e8888-bcb4-0b26-9e9e-e16d60f20b01@mydomain.net>: saved mail to INBOX
This tells me that the Sieve plugin did not save the message (there is no "sieve: " prefix). So, this is not a "keep" action. Saving the mail to INBOX directly like that only happens when Sieve is not involved to begin with (plugin disabled or no Sieve scripts found) or when Sieve bails out upon error.
relevant info from /var/log/dovecot.log (domain changed for privacy)
Jan 19 09:27:09 lda(tim): Debug: Loading modules from directory: /usr/lib64/dovecot Jan 19 09:27:09 lda(tim): Debug: Module loaded: /usr/lib64/dovecot/lib90_sieve_plugin.so Jan 19 09:27:09 lda(tim): Debug: auth USER input: tim system_groups_user=tim uid=1003 gid=100 home=/home/tim Jan 19 09:27:09 lda(tim): Debug: Effective uid=1003, gid=100, home=/home/tim Jan 19 09:27:09 lda(tim): Debug: maildir++: root=/var/spool/dovecot/tim, index=, indexpvt=, control=, inbox=/var/spool/dovecot/tim, alt= Jan 19 09:27:09 lda(tim): Debug: none: root=, index=, indexpvt=, control=, inbox=, alt= Jan 19 09:27:09 lda(tim): Debug: Destination address: <tim@mail.myserver.net> (source: user@hostname) Jan 19 09:27:09 lda(tim): Debug: sieve: Pigeonhole version 0.5.1 (d9bc6dfe) initializing Jan 19 09:27:09 lda(tim): Debug: sieve: include: sieve_global is not set; it is currently not possible to include
:global' scripts. Jan 19 09:27:09 lda(tim): Debug: sieve: file storage: Using active Sieve script path: /home/tim/.dovecot.sieve Jan 19 09:27:09 lda(tim): Debug: sieve: file storage: Using script storage path: /home/tim/sieve Jan 19 09:27:09 lda(tim): Debug: sieve: file storage: Relative path to sieve storage in active link: sieve/ Jan 19 09:27:09 lda(tim): Debug: sieve: file storage: Using Sieve script path: /home/tim/.dovecot.sieve Jan 19 09:27:09 lda(tim): Debug: sieve: file script: Opened script
test' from `/home/tim/.dovecot.sieve' Jan 19 09:27:09 lda(tim): Debug: sieve: Using the following location for user's Sieve script: /home/tim/.dovecot.sieve
Here, all Sieve involvement abruptly seems to stop, which is very very weird.
I'd expect this to end in some sort of error message. Is there a
/var/log/dovecot.error or something like that? You can verify where
things are logged using sudo doveadm log find
.
Regards,
Stephan.
On 19/01/2019 17:54, Stephan Bosch wrote:
Op 19/01/2019 om 10:51 schreef Tim Dickson via dovecot:
On 19/01/2019 08:01, Aki Tuomi wrote:
On 19 January 2019 at 02:07 Tim Dickson via dovecot < dovecot@dovecot.org <mailto:dovecot@dovecot.org>> wrote:
i recently upgraded a server from dovecot 2.1 to 2.3 unfortunately sieve does not appear to be working. The user scripts have not changed, and neither has the dovecont config. using managesieve allows me to create new sieve files and setting one as default updates the link in ~/ to point to the correct file, but the .dovecot.svbin file is not changed (unless i run sievec /home/username/.dovecot.sieve ) I have tested an out of office script that was working on the old system, and a simple test script that flags the mail as $label1 as per an example. email arrives in users mailboxes but sieve scripts don't appear to be doing anything. below is the output of doveconf -n (hostname changed for security)
relevant info from /var/log/dovecot.info (domain changed for privacy)
Jan 19 09:26:58 master: Info: Dovecot v2.3.1 (8e2f634) starting up for imap, lmtp, sieve (core dumps disabled) Jan 19 09:27:09 lda(tim): Info: msgid=<c35e8888-bcb4-0b26-9e9e-e16d60f20b01@mydomain.net>: saved mail to INBOX
This tells me that the Sieve plugin did not save the message (there is no "sieve: " prefix). So, this is not a "keep" action. Saving the mail to INBOX directly like that only happens when Sieve is not involved to begin with (plugin disabled or no Sieve scripts found) or when Sieve bails out upon error.
relevant info from /var/log/dovecot.log (domain changed for privacy)
Jan 19 09:27:09 lda(tim): Debug: Loading modules from directory: /usr/lib64/dovecot Jan 19 09:27:09 lda(tim): Debug: Module loaded: /usr/lib64/dovecot/lib90_sieve_plugin.so Jan 19 09:27:09 lda(tim): Debug: auth USER input: tim system_groups_user=tim uid=1003 gid=100 home=/home/tim Jan 19 09:27:09 lda(tim): Debug: Effective uid=1003, gid=100, home=/home/tim Jan 19 09:27:09 lda(tim): Debug: maildir++: root=/var/spool/dovecot/tim, index=, indexpvt=, control=, inbox=/var/spool/dovecot/tim, alt= Jan 19 09:27:09 lda(tim): Debug: none: root=, index=, indexpvt=, control=, inbox=, alt= Jan 19 09:27:09 lda(tim): Debug: Destination address: <tim@mail.myserver.net> (source: user@hostname) Jan 19 09:27:09 lda(tim): Debug: sieve: Pigeonhole version 0.5.1 (d9bc6dfe) initializing Jan 19 09:27:09 lda(tim): Debug: sieve: include: sieve_global is not set; it is currently not possible to include
:global' scripts. Jan 19 09:27:09 lda(tim): Debug: sieve: file storage: Using active Sieve script path: /home/tim/.dovecot.sieve Jan 19 09:27:09 lda(tim): Debug: sieve: file storage: Using script storage path: /home/tim/sieve Jan 19 09:27:09 lda(tim): Debug: sieve: file storage: Relative path to sieve storage in active link: sieve/ Jan 19 09:27:09 lda(tim): Debug: sieve: file storage: Using Sieve script path: /home/tim/.dovecot.sieve Jan 19 09:27:09 lda(tim): Debug: sieve: file script: Opened script
test' from `/home/tim/.dovecot.sieve' Jan 19 09:27:09 lda(tim): Debug: sieve: Using the following location for user's Sieve script: /home/tim/.dovecot.sieveHere, all Sieve involvement abruptly seems to stop, which is very very weird.
I'd expect this to end in some sort of error message. Is there a /var/log/dovecot.error or something like that? You can verify where things are logged using
sudo doveadm log find
.Regards,
Stephan.
output of doveadm log find Looking for log files from /var/log Debug: /var/log/dovecot.log Info: /var/log/dovecot.info Warning: /var/log/maillog Error: /var/log/maillog Fatal: /var/log/maillog
I have listed below the section of /var/log/maillog which appears to be relevant . (domain changed for privacy)
Jan 18 23:13:46 mail dovecot: lda(tim): Error: sieve: Failed to initialize script execution: Invalid postmaster_address: invalid address `postmaster@' specified for the postmaster_address setting Jan 18 23:13:46 mail sm-mta[866]: x0INDhct000865: to=<tim@myserver.net>, ctladdr=<heather@myserver.net> (1002/100), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=33291, dsn=2.0.0, stat=Sent Jan 18 23:21:14 mail dovecot: master: Warning: Killed with signal 15 (by pid=905 uid=0 code=kill)
There are other mails with the same "invalid address `postmaster@' to other users. Is a postmaster address is required for sieve to work.? if so where should it go. is it the sieve_user_email declaration ? thanks.
Op 20/01/2019 om 00:21 schreef Tim Dickson via dovecot:
On 19/01/2019 17:54, Stephan Bosch wrote:
relevant info from /var/log/dovecot.log (domain changed for privacy)
Jan 19 09:27:09 lda(tim): Debug: Loading modules from directory: /usr/lib64/dovecot Jan 19 09:27:09 lda(tim): Debug: Module loaded: /usr/lib64/dovecot/lib90_sieve_plugin.so Jan 19 09:27:09 lda(tim): Debug: auth USER input: tim system_groups_user=tim uid=1003 gid=100 home=/home/tim Jan 19 09:27:09 lda(tim): Debug: Effective uid=1003, gid=100, home=/home/tim Jan 19 09:27:09 lda(tim): Debug: maildir++: root=/var/spool/dovecot/tim, index=, indexpvt=, control=, inbox=/var/spool/dovecot/tim, alt= Jan 19 09:27:09 lda(tim): Debug: none: root=, index=, indexpvt=, control=, inbox=, alt= Jan 19 09:27:09 lda(tim): Debug: Destination address: <tim@mail.myserver.net> (source: user@hostname) Jan 19 09:27:09 lda(tim): Debug: sieve: Pigeonhole version 0.5.1 (d9bc6dfe) initializing Jan 19 09:27:09 lda(tim): Debug: sieve: include: sieve_global is not set; it is currently not possible to include
:global' scripts. Jan 19 09:27:09 lda(tim): Debug: sieve: file storage: Using active Sieve script path: /home/tim/.dovecot.sieve Jan 19 09:27:09 lda(tim): Debug: sieve: file storage: Using script storage path: /home/tim/sieve Jan 19 09:27:09 lda(tim): Debug: sieve: file storage: Relative path to sieve storage in active link: sieve/ Jan 19 09:27:09 lda(tim): Debug: sieve: file storage: Using Sieve script path: /home/tim/.dovecot.sieve Jan 19 09:27:09 lda(tim): Debug: sieve: file script: Opened script
test' from `/home/tim/.dovecot.sieve' Jan 19 09:27:09 lda(tim): Debug: sieve: Using the following location for user's Sieve script: /home/tim/.dovecot.sieveHere, all Sieve involvement abruptly seems to stop, which is very very weird.
I'd expect this to end in some sort of error message. Is there a /var/log/dovecot.error or something like that? You can verify where things are logged using
sudo doveadm log find
.output of doveadm log find Looking for log files from /var/log Debug: /var/log/dovecot.log Info: /var/log/dovecot.info Warning: /var/log/maillog Error: /var/log/maillog Fatal: /var/log/maillog
I have listed below the section of /var/log/maillog which appears to be relevant . (domain changed for privacy)
Jan 18 23:13:46 mail dovecot: lda(tim): Error: sieve: Failed to initialize script execution: Invalid postmaster_address: invalid address `postmaster@' specified for the postmaster_address setting Jan 18 23:13:46 mail sm-mta[866]: x0INDhct000865: to=<tim@myserver.net>, ctladdr=<heather@myserver.net> (1002/100), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=33291, dsn=2.0.0, stat=Sent Jan 18 23:21:14 mail dovecot: master: Warning: Killed with signal 15 (by pid=905 uid=0 code=kill)
There are other mails with the same "invalid address `postmaster@' to other users. Is a postmaster address is required for sieve to work.? if so where should it go. is it the sieve_user_email declaration ? thanks.
Aha! So, you tripped over a 2.3.1 bug. The best way to work around this is by setting a proper explicit value for the global postmaster_address setting (https://wiki.dovecot.org/LDA). So, Pigeonhole does not define this setting; it is defined by Dovecot LDA/LMTP.
Regards,
Stephan.
On 20/01/2019 11:29, Stephan Bosch wrote:
Op 20/01/2019 om 00:21 schreef Tim Dickson via dovecot:
On 19/01/2019 17:54, Stephan Bosch wrote:
relevant info from /var/log/dovecot.log (domain changed for privacy)
Jan 19 09:27:09 lda(tim): Debug: Loading modules from directory: /usr/lib64/dovecot Jan 19 09:27:09 lda(tim): Debug: Module loaded: /usr/lib64/dovecot/lib90_sieve_plugin.so Jan 19 09:27:09 lda(tim): Debug: auth USER input: tim system_groups_user=tim uid=1003 gid=100 home=/home/tim Jan 19 09:27:09 lda(tim): Debug: Effective uid=1003, gid=100, home=/home/tim Jan 19 09:27:09 lda(tim): Debug: maildir++: root=/var/spool/dovecot/tim, index=, indexpvt=, control=, inbox=/var/spool/dovecot/tim, alt= Jan 19 09:27:09 lda(tim): Debug: none: root=, index=, indexpvt=, control=, inbox=, alt= Jan 19 09:27:09 lda(tim): Debug: Destination address: <tim@mail.myserver.net> (source: user@hostname) Jan 19 09:27:09 lda(tim): Debug: sieve: Pigeonhole version 0.5.1 (d9bc6dfe) initializing Jan 19 09:27:09 lda(tim): Debug: sieve: include: sieve_global is not set; it is currently not possible to include
:global' scripts. Jan 19 09:27:09 lda(tim): Debug: sieve: file storage: Using active Sieve script path: /home/tim/.dovecot.sieve Jan 19 09:27:09 lda(tim): Debug: sieve: file storage: Using script storage path: /home/tim/sieve Jan 19 09:27:09 lda(tim): Debug: sieve: file storage: Relative path to sieve storage in active link: sieve/ Jan 19 09:27:09 lda(tim): Debug: sieve: file storage: Using Sieve script path: /home/tim/.dovecot.sieve Jan 19 09:27:09 lda(tim): Debug: sieve: file script: Opened script
test' from `/home/tim/.dovecot.sieve' Jan 19 09:27:09 lda(tim): Debug: sieve: Using the following location for user's Sieve script: /home/tim/.dovecot.sieveHere, all Sieve involvement abruptly seems to stop, which is very very weird.
I'd expect this to end in some sort of error message. Is there a /var/log/dovecot.error or something like that? You can verify where things are logged using
sudo doveadm log find
.output of doveadm log find Looking for log files from /var/log Debug: /var/log/dovecot.log Info: /var/log/dovecot.info Warning: /var/log/maillog Error: /var/log/maillog Fatal: /var/log/maillog
I have listed below the section of /var/log/maillog which appears to be relevant . (domain changed for privacy)
Jan 18 23:13:46 mail dovecot: lda(tim): Error: sieve: Failed to initialize script execution: Invalid postmaster_address: invalid address `postmaster@' specified for the postmaster_address setting Jan 18 23:13:46 mail sm-mta[866]: x0INDhct000865: to=<tim@myserver.net>, ctladdr=<heather@myserver.net> (1002/100), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=33291, dsn=2.0.0, stat=Sent Jan 18 23:21:14 mail dovecot: master: Warning: Killed with signal 15 (by pid=905 uid=0 code=kill)
There are other mails with the same "invalid address `postmaster@' to other users. Is a postmaster address is required for sieve to work.? if so where should it go. is it the sieve_user_email declaration ? thanks.
Aha! So, you tripped over a 2.3.1 bug. The best way to work around this is by setting a proper explicit value for the global postmaster_address setting (https://wiki.dovecot.org/LDA). So, Pigeonhole does not define this setting; it is defined by Dovecot LDA/LMTP.
Regards,
Stephan.
Brilliant. that fixed it. the scripts are running again, and my test, and out of office is working. So it is just that there is no default for that field, and the example comments need to be updated. (i just checked the 2.3.4 source and the example 15-lda.conf still implies a default, or has the behaviour been fixed in newer versions so it works?) I'll let the slackware build maintainer know so it can be added to the readme for 2.3.1 version.
many thanks everyone for your assistance. regards, Tim
participants (4)
-
Aki Tuomi
-
Ralf Becker
-
Stephan Bosch
-
Tim Dickson