🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.debian.bugs.dist
8 messages
8 total messages Started by Noah Meyerhans Sun, 18 Oct 2026 21:40
Bug#1151242: dovecot-sieve: Permission problem with ssl_key_file on e.g. sievec
#1297
Author: Noah Meyerhans
Date: Sun, 18 Oct 2026 21:40
42 lines
3641 bytes
Control: tags -1 + moreinfo

On Sun, Oct 18, 2026 at 10:15:16PM +0200, H.-Dirk Schmitt wrote:
> Package: dovecot-sieve
> Version: 1:2.4.5+dfsg1-4
> Severity: important
> 
> There is still a serious bug in dovecot 2.4.4 with the ssl_key_file.
> If e.g. sievec is invoked.
> 
> → doveconf: Fatal: Error in configuration file /etc/dovecot/conf.d/10-ssl.conf
> line 76: key_file: open(/etc/ssl/private/XXXXXX.key.pem) failed: Permission
> denied
> 
> The same occurs in for every mail deliverd to any user account using mailsieve
> and a lot of error mails are produced degrading the mail-service for the users.
> 
> The problem is upstream discussed in
> https://dovecot.org/mailman3/archives/list/dovecot@dovecot.org/thread/KT7LWWQWEMLKKLKXICBGPG7OGOQIJWEV/
> There is also a weird configuration hack mentioned to mitigate the dovecot bug.
> The bug is that the key_file isn't read before the privileges are dropped e.g.
> for the sieve processing.
> 
> This bug was solved in dovecot 2.4.5.

I'm a bit confused.  You reported this bug against version 2.4.5, but
also claim that it's fixed in 2.4.5.  Do you happen to know exactly
where/what the fix is?  The mailing list thread doesn't seem to identify
it a specific commit as containing the fix.

> I mitigated the problem here with a no-change forky backport for the moment.
> 
> Please upgrade the trixie version from 2.4.4 to 2.4.5 to solve the problem for
> other users.

Trixie contains 2.4.1 (with a bunch of backported bugfixes, not 2.4.4).
Unfortunately dovecot minor versions contain incompatible changes, so we
cannot simply upgrade between them with trixie point releases.  We will
need to identify the specific commit so we can introduce a targeted fix
into trixie's version.

noah
Bug#1151242: dovecot-sieve: Permission problem with ssl_key_file on e.g. sievec
#1388
Author: Noah Meyerhans
Date: Mon, 19 Oct 2026 20:30
95 lines
5523 bytes
On Mon, Oct 19, 2026 at 12:49:52AM +0200, H.-Dirk Schmitt wrote:
>    That is the reason 2.4.5 was picked up.
>    I can't identify the fix on github – sorry. 
> 
>    > Trixie contains 2.4.1 (with a bunch of backported bugfixes, not 2.4.4).
> 
>    Sorry this was a typo in in the 3rd number.
> 
>    > Unfortunately dovecot minor versions contain incompatible changes, so we
>    > cannot simply upgrade between them with trixie point releases.  We will
>    > need to identify the specific commit so we can introduce a targeted fix
>    > into trixie's version.
> 
>    Maybe it can be added to backports?
>    The forky version compiles as backport without any changes.

Backports isn't really the place for this, for multiple reasons.  It
should be fixed in the main archive.

Unfortunately, I haven't been able to find a suitable looking change
from the 2.4.4..2.4.5 range upstream.  I have also been unable to come
up with a way to reproduce the failure.

From your description, as well as the mailing list discussion, it seems
like issue is that when a dovecot program is run as a user that does not
have permission to access some file referenced in the configuration,
typically a TLS key.  So, to try to reproduce this failure, I've set up
the following and tested it with the dovecot 1:2.4.1+dfsg1-6 packages
from the original trixie release.  I have not encountered any errors,
though, so something must be missing.  Can you tell from here what's
missing?  If you can provide a minimal repro configuration, that would
be helpful.

Certificates are locked down:

# ls -l /etc/dovecot/private/tls/
total 8
-r-------- 1 1000 1000 1529 May  8  2025 example.net.crt
-r-------- 1 1000 1000 1704 May  8  2025 example.net.key

And what I think are the relevant parts of `doveconf -n`:

dovecot_config_version = 2.4.0
dovecot_storage_version = 2.4.0
mail_gid = vmail
mail_uid = vmail
mail_home = /home/vmail/users/%{user | username}/mail
mail_path = /home/vmail/users/%{user | username}/mail
mail_privileged_group = mail
ssl_server {
  cert_file = /etc/dovecot/private/tls/example.net.crt
  key_file = /etc/dovecot/private/tls/example.net.key
}
protocol lda {
  mail_plugins {
    sieve = yes
  }
  sieve_script personal {
    driver = file
    path = /home/vmail/users/%{user | username}/mail.sieve
  }
}
protocol lmtp {
  auth_username_format = %{user | username | lower}
  mail_plugins {
    sieve = yes
  }
  sieve_script personal {
    path = /home/vmail/users/%{user | username}/mail.sieve
  }
}

I've then created a virtual user with a sieve script that does some
simple filtering:

root@94faf4d30408:/home/vmail/users/testuser# cat mail.sieve
require ["fileinto", "envelope"];
if header :is "X-Sieve-Test" "yes" {
  fileinto "incoming/filtered";
} else {
  keep;
}

And sent mail to that user using /usr/lib/dovecot/deliver:

root@94faf4d30408:/home/vmail/users/testuser# cat | runuser -u vmail -g vmail -- /usr/lib/dovecot/deliver -e -f mailer-daemon -a testuser -d testuser
From: mailer-daemon
To: noahm <noahm@localhost>
Subject: test message
X-Sieve-Test: yes
Message-ID: <this-is-a-test-message-3311@some-host.somewhere>

testing delivery

lda(testuser)<113><6YMTBeF31mpxAAAA1oRN5w>: Info: sieve: msgid=<this-is-a-test-message-3311@some-host.somewhere>: fileinto action: stored mail into mailbox 'incoming/filtered'
Bug#1151242: dovecot-sieve: Permission problem with ssl_key_file on e.g. sievec
#1478
Author: Noah Meyerhans
Date: Tue, 20 Oct 2026 18:30
26 lines
3504 bytes
On Tue, Oct 20, 2026 at 05:16:59PM +0200, Edmund Lodewijks wrote:
> Have you tried with the certificates outside of /etc/dovecot? I think that is where the issues start. But I am not at my pc, so can’t test now. 
> 

That doesn't seem to be it.

root@1e17878e1058:/home/vmail# doveconf -n|grep -A3 ssl_server
ssl_server {
  cert_file = /etc/tls/example.net.crt
  key_file = /etc/tls/example.net.key
}
root@1e17878e1058:/home/vmail# ls -ld /etc/tls /etc/tls/*
drwx------ 2 1000 1000 4096 Oct 19 18:10 /etc/tls
-r-------- 1 1000 1000 1529 May  8  2025 /etc/tls/example.net.crt
-r-------- 1 1000 1000 1704 May  8  2025 /etc/tls/example.net.key

Sieve compilation and filtering still works without error when deliver is
invoked as the vmail user:

root@1e17878e1058:/home/vmail/users/testuser# ls -l mail.*
-rw-r--r-- 1 vmail vmail 122 Oct 19 19:44 mail.sieve
root@1e17878e1058:/home/vmail/users/testuser# generate-test-mail.sh | runuser -u vmail -g vmail -- /usr/lib/dovecot/deliver -e -f mailer-daemon -a testuser -d testuser
lda(testuser)<48><FKxnB5Kt12owAAAAOT1REg>: Info: sieve: msgid=<this-is-a-test-message-899@some-host.somewhere>: fileinto action: stored mail into mailbox 'incoming/filtered'
root@1e17878e1058:/home/vmail/users/testuser# ls -l mail.*
-rw-r--r-- 1 vmail vmail 122 Oct 19 19:44 mail.sieve
-rw-r--r-- 1 vmail vmail 317 Oct 20 18:06 mail.svbin
Bug#1151242: dovecot-sieve: Permission problem with ssl_key_file on e.g. sievec
#1702
Author: Noah Meyerhans
Date: Thu, 22 Oct 2026 15:10
36 lines
3769 bytes
On Thu, Oct 22, 2026 at 03:30:34PM +0200, H.-Dirk Schmitt wrote:
>    In difference to my ssl related configuration is:
>    ssl = yes
>    ssl_server_cert_file = /etc/dovecot/private/c42-client.cert.pem
>    ssl_server_key_file = /etc/dovecot/private/c42-client.key.pem
>    ssl_server_ca_file = /etc/ssl/certs/c42-srv-ca.crt
>    ssl_min_protocol = TLSv1.2
>    ssl_server {
>      cert_file = /etc/ssl/c42/c42-client.cert.pem
>      dh_file = /etc/dovecot/dh.pem
>      key_file = /etc/ssl/private/c42-client.key.pem
>    }

I think that's it.  I only had the top-level ssl_server_* settings, I
did not have the ssl_server block.  When I added that, I encountered the
reported failure:

# cat /etc/dovecot/conf.d/10-ssl.conf
ssl = yes
ssl_server_cert_file = /etc/tls/example.net.crt
ssl_server_key_file = /etc/tls/example.net.key
ssl_min_protocol = TLSv1.2
ssl_server {
    key_file = /etc/tls/example.net.key
}

# generate-test-mail.sh | runuser -u vmail -g vmail -- /usr/lib/dovecot/deliver -e -f mailer-daemon -a testuser -d testuser
doveconf: Fatal: Error in configuration file /etc/dovecot/conf.d/10-ssl.conf line 8: key_file: open(/etc/tls/example.net.key) failed: Permission denied


Is it not sufficient for your configuration to list the ssl_server_*
settings and omit the ssl_server block?  The docs don't indicate a need
to define an ssl_server block in a normal configuration:
https://doc.dovecot.org/2.4.5/core/config/ssl.html#configuration-overview

noah
Bug#1151242: dovecot-sieve: Permission problem with ssl_key_file on e.g. sievec
#1716
Author: Noah Meyerhans
Date: Thu, 22 Oct 2026 17:40
25 lines
3812 bytes
On Thu, Oct 22, 2026 at 06:25:41PM +0200, H.-Dirk Schmitt wrote:
>    > Is it not sufficient for your configuration to list the ssl_server_*
>    > settings and omit the ssl_server block?  The docs don't indicate a need
>    > to define an ssl_server block in a normal configuration:
>    > [1]https://doc.dovecot.org/2.4.5/core/config/ssl.html#configuration-overview
> 
>    I'm not sure. I migrated my old 2.3 configuration with the help
>    of [2]https://dovecot.org/upgrader 
>    Wasn't the `ssl = true` the triggering point?

No, I had that in my config all along.  What I posted earlier was only
what I suspected as the relevant part of the doveconf -n output; I
figured actually enabling ssl was assumed.

Try updating your config to drop the ssl_server {} block and see if that
resolves the issue for you.  Based on what I've seen, I suspect it will.
Note that you can move the nested dh_file setting to a top-level
ssl_server_dh_file setting to go along with the rest of the top-level
settings.

If this works, that doesn't change the fact that this is a bug that
should be fixed, but it may reduce the urgency of it and let you move
back to the trixie packages.

noah
Bug#1151242: dovecot-sieve: Permission problem with ssl_key_file on e.g. sievec
#1802
Author: Noah Meyerhans
Date: Fri, 23 Oct 2026 13:50
11 lines
3000 bytes
Control: tags -1 + confirmed patch

Ok, I believe this patch should fix things.  It fixes the failure in my
testing.  Will you be able to validate the fix if I provide you with a
test build?

https://salsa.debian.org/noahm/dovecot/-/commit/d7f4599b31cd48ec9887064c7e6ad8476deb215c

based on 8799b7ef6 from upstream.

noah
Bug#1151242: dovecot-sieve: Permission problem with ssl_key_file on e.g. sievec
#1809
Author: Noah Meyerhans
Date: Fri, 23 Oct 2026 14:50
30 lines
4434 bytes
On Fri, Oct 23, 2026 at 03:53:04PM +0200, H.-Dirk Schmitt wrote:
> > Ok, I believe this patch should fix things.  It fixes the failure in my
> > testing.  Will you be able to validate the fix if I provide you with a
> > test build?
> > 
> > [https://salsa.debian.org/noahm/dovecot/-/commit/d7f4599b31cd48ec9887064c7e6ad8476deb215c](https://salsa.debian.org/noahm/dovecot/-/commit/d7f4599b31cd48ec9887064c7e6ad8476deb215c)
> > 
> > based on 8799b7ef6 from upstream.
> > 
> > noah
> >
> 
> No problem – send me the url where to fetch the deb files.  
> 
> Currently installed: dpkg -l dovec* |rg ^i
> 
> 	ii  dovecot-core          1:2.4.5+dfsg1-4-c42-bpo-1 amd64        secure POP3/IMAP server - core files
> 	ii  dovecot-imapd         1:2.4.5+dfsg1-4-c42-bpo-1 amd64        secure POP3/IMAP server - IMAP daemon
> 	ii  dovecot-ldap          1:2.4.5+dfsg1-4-c42-bpo-1 amd64        secure POP3/IMAP server - LDAP support
> 	ii  dovecot-lmtpd         1:2.4.5+dfsg1-4-c42-bpo-1 amd64        secure POP3/IMAP server - LMTP server
> 	ii  dovecot-managesieved  1:2.4.5+dfsg1-4-c42-bpo-1 amd64        secure POP3/IMAP server - ManageSieve server
> 	ii  dovecot-sieve         1:2.4.5+dfsg1-4-c42-bpo-1 amd64        secure POP3/IMAP server - Sieve filters support

There's an amd64 build in my people.debian.org repo.  See
https://people.debian.org/~noahm/repo/ for usage details.  The version
is 1:2.4.1+dfsg1-6+deb13u8~test1.  You can grab the .debs directly from
https://people.debian.org/~noahm/repo/pool/main/d/dovecot/ if you don't
want to use apt.

noah
Bug#1151242: dovecot-sieve: Permission problem with ssl_key_file on e.g. sievec
#1866
Author: Noah Meyerhans
Date: Fri, 23 Oct 2026 18:00
18 lines
3463 bytes
Control: tags -1 = pending

On Fri, Oct 23, 2026 at 06:00:23PM +0200, H.-Dirk Schmitt wrote:
> 
> The downgraded system with your packages is working correctly.  
> Thanks for your work.
> 

Thanks for the confirmation. I've queued the fix for inclusion in the
next stable upload.  In the meantime, you can safely continue using the
packages from my repository, as all content that they contain is
targeted for a trixie stable update and they'll be automatically
upgraded to the main packages once they're published.  However, I
recommend that you disable my repository if you've got it configured in
apt.  I may publish other packages there that aren't ready for
production use.

noah
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads