Hello, I noticed that since a recent update my sieve filter is not working anymore. I tried to debug it with mail_debug = yes
in /etc/dovecot/conf.d/10-logging.conf
but I can’t seem to get to the root of the problem. Thanks in advance!
Hello @chris
your filter connect to Roundcube ? same issue happened with 1.6.2 solved by review basic setup of the filter and found port blocked by csf so unblocked it
I don’t know the reason but solved
note : after update to 1.6.5 issue didn’t appear
I wish this help you
Thanks a lot for your help @nada. I’m fairly new to this setup: you’re talking about port 4190, am I correct? Where / how exactly did you unblock it? (If I allow that port in the Firewall gui for the servers ip nothing changes.) These are my (untouched) dovecot config files:
/etc/dovecot/dovecot.conf
protocols = imap pop3
listen = *, ::
base_dir = /var/run/dovecot/
login_greeting = Mail Delivery Agent
!include conf.d/*.conf
!include_try conf.d/domains/*.conf
service stats {
unix_listener stats-writer {
group = mail
mode = 0660
user = dovecot
}
}
service stats {
unix_listener stats-writer {
group = mail
mode = 0660
user = dovecot
}
}
namespace {
type = private
separator = /
inbox = yes
list = yes
mailbox Archive {
auto = subscribe
special_use = \Archive
}
mailbox Drafts {
auto = subscribe
special_use = \Drafts
}
mailbox Trash {
auto = subscribe
special_use = \Trash
}
mailbox "Deleted Messages" {
auto = no
special_use = \Trash
}
mailbox Spam {
auto = subscribe
special_use = \Junk
}
mailbox Junk {
auto = no
special_use = \Junk
}
mailbox Sent {
auto = subscribe
special_use = \Sent
}
mailbox "Sent Mail" {
auto = no
special_use = \Sent
}
mailbox "Sent Messages" {
auto = no
special_use = \Sent
}
}
/etc/dovecot/conf.d/10-auth.conf
disable_plaintext_auth = no
auth_username_format = %u
auth_verbose = yes
auth_mechanisms = plain login
!include auth-passwdfile.conf.ext
/etc/dovecot/conf.d/10-logging.conf
log_path = /var/log/dovecot.log
/etc/dovecot/conf.d/20-imap.conf
##
## IMAP specific settings
##
protocol imap {
# Maximum IMAP command line length. Some clients generate very long command
# lines with huge mailboxes, so you may need to raise this if you get
# "Too long argument" or "IMAP command line too large" errors often.
#imap_max_line_length = 64k
# Maximum number of IMAP connections allowed for a user from each IP address.
# NOTE: The username is compared case-sensitively.
#mail_max_userip_connections = 10
# Space separated list of plugins to load (default is global mail_plugins).
#mail_plugins = $mail_plugins
mail_plugins = quota imap_quota imap_sieve
# IMAP logout format string:
# %i - total number of bytes read from client
# %o - total number of bytes sent to client
#imap_logout_format = bytes=%i/%o
# Override the IMAP CAPABILITY response. If the value begins with '+',
# add the given capabilities on top of the defaults (e.g. +XFOO XBAR).
#imap_capability =
# How long to wait between "OK Still here" notifications when client is
# IDLEing.
#imap_idle_notify_interval = 2 mins
# ID field names and values to send to clients. Using * as the value makes
# Dovecot use the default value. The following fields have default values
# currently: name, version, os, os-version, support-url, support-email.
#imap_id_send =
# ID fields sent by client to log. * means everything.
#imap_id_log =
# Workarounds for various client bugs:
# delay-newmail:
# Send EXISTS/RECENT new mail notifications only when replying to NOOP
# and CHECK commands. Some clients ignore them otherwise, for example OSX
# Mail (<v2.1). Outlook Express breaks more badly though, without this it
# may show user "Message no longer in server" errors. Note that OE6 still
# breaks even with this workaround if synchronization is set to
# "Headers Only".
# tb-extra-mailbox-sep:
# Thunderbird gets somehow confused with LAYOUT=fs (mbox and dbox) and
# adds extra '/' suffixes to mailbox names. This option causes Dovecot to
# ignore the extra '/' instead of treating it as invalid mailbox name.
# tb-lsub-flags:
# Show \Noselect flags for LSUB replies with LAYOUT=fs (e.g. mbox).
# This makes Thunderbird realize they aren't selectable and show them
# greyed out, instead of only later giving "not selectable" popup error.
#
# The list is space-separated.
#imap_client_workarounds =
}
Roundcube should work fine without opening ports.
What is the exact error?
Thanks @eris, I’m trying to find out what the cause of the issue is. I added mail_debug=yes
to root@host:/etc/dovecot/sieve# nano 20-managesieve.conf
within the protocol sieve { }
block.
Are the logs being written to /var/log/syslog
by default?
I think /var/log/dovecot?
I thought so too: so I checked again /var/log/dovecot.log
but nothing other than login/logout logs:
Jul 30 10:11:12 imap-login: Info: Login: user=<[email protected]>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=7271, TLS, session=<rOtRTwHlUrt/AAAB>
Jul 30 10:11:12 imap([email protected])<7271><rOtRTwHlUrt/AAAB>: Info: Disconnected: Logged out in=499 out=12896 deleted=0 expunged=0 trashed=0 hdr_count=24 hdr_bytes=5658 body_count=0 body_bytes=0
Unfortunately I can’t seem to activate the logging / debug sieve. I checked if managesieve-login and dovecot-managesieved are installed and checked these config files with the original installation files:
20-managesieve.conf
90-sieve-extprograms.conf
90-sieve.conf
Could you suggest me where else to look, or do I need to check the status of certain services?
I’m on HestiaCP 1.6.5 with Ubuntu 22.04 (upgraded from 20.04).
P.s. during the last upgrade these services were restarted by default:
Restart should not affect them…
Exactly, I thought so too… Sieve also seems connected:
root@host:~# telnet host.myhestiacp.com 4190
Trying 127.0.0.1...
Connected to host.myhestiacp.com.
Escape character is '^]'.
"IMPLEMENTATION" "Dovecot Pigeonhole"
"SIEVE" "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 imapflags notify imapsieve vnd.dovecot.imapsieve"
"NOTIFY" "mailto"
"SASL" "PLAIN LOGIN"
"STARTTLS"
"VERSION" "1.0"
OK "Mail Delivery Agent"
BYE "Disconnected for inactivity."
Connection closed by foreign host.
If I enable mail_debug = yes
in /etc/dovecot/dovecot.conf
I get this as, hopefully helpful, log output:
Jul 31 22:01:38 imap-login: Info: Login: user=<[email protected]>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=59942, TLS, session=<G0flWR/lNJF/AAAB>
Jul 31 22:01:38 imap([email protected])<59942><G0flWR/lNJF/AAAB>: Debug: Loading modules from directory: /usr/lib/dovecot/modules
Jul 31 22:01:38 imap([email protected])<59942><G0flWR/lNJF/AAAB>: Debug: Module loaded: /usr/lib/dovecot/modules/lib10_quota_plugin.so
Jul 31 22:01:38 imap([email protected])<59942><G0flWR/lNJF/AAAB>: Debug: Module loaded: /usr/lib/dovecot/modules/lib11_imap_quota_plugin.so
Jul 31 22:01:38 imap([email protected])<59942><G0flWR/lNJF/AAAB>: Debug: Module loaded: /usr/lib/dovecot/modules/lib95_imap_sieve_plugin.so
Jul 31 22:01:38 imap([email protected])<59942><G0flWR/lNJF/AAAB>: Debug: Added userdb setting: plugin/quota_rule=*:storage=0M
Jul 31 22:01:38 imap([email protected])<59942><G0flWR/lNJF/AAAB>: Debug: Effective uid=1002, gid=8, home=/home/chris
Jul 31 22:01:38 imap([email protected])<59942><G0flWR/lNJF/AAAB>: Debug: Quota root: name=User quota backend=maildir args=
Jul 31 22:01:38 imap([email protected])<59942><G0flWR/lNJF/AAAB>: Debug: Quota rule: root=User quota mailbox=* bytes=0 messages=0
Jul 31 22:01:38 imap([email protected])<59942><G0flWR/lNJF/AAAB>: Debug: Quota grace: root=User quota bytes=0 (10%)
Jul 31 22:01:38 imap([email protected])<59942><G0flWR/lNJF/AAAB>: Debug: Namespace : type=private, prefix=, sep=/, inbox=yes, hidden=no, list=yes, subscriptions=yes location=maildir:/home/chris/mail/mydomain.com/info
Jul 31 22:01:38 imap([email protected])<59942><G0flWR/lNJF/AAAB>: Debug: maildir++: root=/home/chris/mail/mydomain.com/info, index=, indexpvt=, control=, inbox=/home/chris/mail/mydomain.com/info, alt=
Jul 31 22:01:38 imap([email protected])<59942><G0flWR/lNJF/AAAB>: Debug: quota: quota_over_flag check: quota_over_script unset - skipping
Jul 31 22:01:38 imap([email protected])<59942><G0flWR/lNJF/AAAB>: Debug: Mailbox INBOX: Mailbox opened because: STATUS
Jul 31 22:01:38 imap([email protected])<59942><G0flWR/lNJF/AAAB>: Debug: Mailbox INBOX: Mailbox opened because: SELECT
Jul 31 22:01:38 imap([email protected])<59942><G0flWR/lNJF/AAAB>: Info: Disconnected: Logged out in=209 out=1265 deleted=0 expunged=0 trashed=0 hdr_count=0 hdr_bytes=0 body_count=0 body_bytes=0```
I don’t see anything related sieve that is not working
What is exactly not working?
Doesn’t it filter or doesn’t it send any forwarders / auto reply?
It doesn’t want to filter or send any forwarders and replies when I configure them from Roundcube sieve. (Forwarders and replies do work if I set them up within HestiaCP GUI).
So neither the default x-spam-flag spam filter or any custom filters work. F.e. if I try to filter e-mails with subjet ‘singer’ into the folder ‘Singing’.
require ["fileinto"];
# rule:[SPAM]
if header :contains "x-spam-flag" "YES"
{
fileinto "INBOX.Spam";
}
# rule:[Singing]
if allof (header :contains "subject" "singer")
{
fileinto "Singing";
}
PS. Can it be a problem of incorrect file permissions / ownship?
root@host:/etc/dovecot/sieve# ls -l
total 24
-rw-r--r-- 1 root root 3050 Jul 30 12:10 20-managesieve.conf
-rw-r--r-- 1 root root 1825 Jan 17 2022 90-sieve-extprograms.conf
-rw-r--r-- 1 root root 10428 Jul 30 19:15 90-sieve.conf
-rw-r--r-- 1 root root 108 Jan 17 2022 default
root@host:/etc/dovecot/sieve# cd ..
root@host:/etc/dovecot# ls -l
total 44
drwxr-xr-x 3 root root 4096 Jul 29 21:20 conf.d
-rw-r----- 1 root dovecot 1507 Aug 26 2019 dovecot-dict-auth.conf.ext
-rw-r----- 1 root dovecot 522 Jul 14 00:21 dovecot-dict-sql.conf.ext
-rw-r----- 1 root dovecot 5824 Aug 26 2019 dovecot-sql.conf.ext
-rw-r--r-- 1 root root 1205 Jul 31 21:57 dovecot.conf
-rw-r--r-- 1 root root 4343 Jul 7 19:13 dovecot.conf.ucf-dist
-rw-r--r-- 1 root root 1200 Jul 30 08:18 dovecot.conf.vst.back
drwx------ 2 root root 4096 Jan 17 2022 private
drwxr-xr-x 2 root root 4096 Jul 30 19:16 sieve
root@host:/etc/dovecot#
Should be fine
Thank you @eris. Do you have any other thoughts on this issue? I’m slowly pulling my hair at this point…
Ok… I found the solution by editing: /etc/exim4/exim4.conf.template
-
Within the ‘Routers Configuration’ I changed the
localuser:
Old value:transport = local_delivery
New value:transport = dovecot_virtual_delivery
-
Within the ‘Transports Configuration’ I added the following block right between the
local_spam_delivery
and theaddress_pipe
:
dovecot_virtual_delivery:
driver = pipe
command = /usr/lib/dovecot/dovecot-lda -e -d $local_part@$domain -f $sender_address -a $original_local_part@$original_domain
delivery_date_add
envelope_to_add
return_path_add
log_output = true
log_defer_output = true
user = ${extract{2}{:}{${lookup{$local_part}lsearch{/etc/exim4/domains/${lookup{$domain}dsearch{/etc/exim4/domains/}}/passwd}}}}
group = mail
return_output
You did upgrade from 20.04 to 22.04?
That might the issue
Yes, I did. But I did follow the documentation with these commands, so I never thought it could be an exim4 related issue:
rm -f /etc/exim4/exim4.conf.template
cp -f /usr/local/hestia/install/deb/exim/exim4.conf.4.94.template /etc/exim4/exim4.conf.template
Anyway, I’m glad it’s working again since it’s a vital function in my setup/ for my clients.