From: Chuck Lever <cel@kernel.org>
To: <kernel-tls-handshake@lists.linux.dev>
Subject: [PATCH v1 3/9] tlshd: Fail the handshake when a configured trust store is missing
Date: Tue, 1 Dec 2026 16:42:42 -0500 [thread overview]
Message-ID: <20261201214249.296675-4-cel@kernel.org> (raw)
In-Reply-To: <20261201214249.296675-1-cel@kernel.org>
tlshd_config_get_truststore() returns false when the configured
x509.truststore file does not exist, which is the same result it
returns when the option is unset. Both callers then load the system
trust store in its place. On the server side, a typo in the path or
a file removed after configuration turns client authentication over
to every public CA, and the only sign is a debug-level message.
tlshd_config_get_crl() treats a missing x509.crl file the same way,
so revocation checking stops without notice.
Drop the access() checks so both functions return the configured
pathname whether or not the file exists. GnuTLS then fails to load
the missing file, and the handshake fails. Log that failure on the
server side, as the client side already does. An unset option still
selects the system trust store.
Fixes: ad57063880e1 ("config: supply meaningful error for non-existing pathnames")
Fixes: 88a93dc33f41 ("tlshd: Add server-side CRL checking")
Fixes: 9ab34c1b1054 ("Add client-side CRL checking")
Signed-off-by: Chuck Lever <cel@kernel.org>
---
src/tlshd/config.c | 10 ----------
src/tlshd/server.c | 4 +++-
2 files changed, 3 insertions(+), 11 deletions(-)
diff --git a/src/tlshd/config.c b/src/tlshd/config.c
index b1fdd0c0e1b2..e62830daec63 100644
--- a/src/tlshd/config.c
+++ b/src/tlshd/config.c
@@ -465,11 +465,6 @@ bool tlshd_config_get_truststore(int peer_type, char **bundle)
"x509.truststore", NULL);
if (!pathname)
return false;
- if (access(pathname, F_OK)) {
- tlshd_log_debug("tlshd cannot access \"%s\"", pathname);
- g_free(pathname);
- return false;
- }
*bundle = strdup(pathname);
g_free(pathname);
@@ -502,11 +497,6 @@ bool tlshd_config_get_crl(int peer_type, char **result)
"x509.crl", NULL);
if (!pathname)
return false;
- if (access(pathname, F_OK)) {
- tlshd_log_debug("tlshd cannot access \"%s\"", pathname);
- g_free(pathname);
- return false;
- }
*result = strdup(pathname);
g_free(pathname);
diff --git a/src/tlshd/server.c b/src/tlshd/server.c
index 4cb97b03c4a1..341b047cc894 100644
--- a/src/tlshd/server.c
+++ b/src/tlshd/server.c
@@ -294,8 +294,10 @@ static int tlshd_server_get_truststore(gnutls_certificate_credentials_t cred)
free(pathname);
} else
ret = gnutls_certificate_set_x509_system_trust(cred);
- if (ret < 0)
+ if (ret < 0) {
+ tlshd_log_gnutls_error(ret);
return ret;
+ }
tlshd_log_debug("System trust: Loaded %d certificate(s).", ret);
if (tlshd_config_get_crl(PEER_TYPE_SERVER, &pathname)) {
--
2.56.0
next prev parent reply other threads:[~2026-12-01 21:42 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 21:42 [PATCH v1 0/9] Security-related fixes Chuck Lever
2026-12-01 21:42 ` [PATCH v1 1/9] tlshd: Require the clientAuth key purpose on client certificates Chuck Lever
2026-12-02 0:38 ` Alistair
2026-12-01 21:42 ` [PATCH v1 2/9] tlshd: Require the serverAuth key purpose on server certificates Chuck Lever
2026-12-02 0:40 ` Alistair
2026-12-01 21:42 ` Chuck Lever [this message]
2026-12-02 0:42 ` [PATCH v1 3/9] tlshd: Fail the handshake when a configured trust store is missing Alistair
2026-12-01 21:42 ` [PATCH v1 4/9] tlshd: Accept only "psk" keys in the QUIC server PSK callback Chuck Lever
2026-12-02 0:46 ` Alistair
2026-12-01 21:42 ` [PATCH v1 5/9] tlshd: Match session tags only after the client certificate verifies Chuck Lever
2026-12-02 0:48 ` Alistair
2026-12-01 21:42 ` [PATCH v1 6/9] tlshd: Fix the direction of the certificate validity filters Chuck Lever
2026-12-02 0:59 ` Alistair
2026-12-01 21:42 ` [PATCH v1 7/9] tlshd: Re-arm select() on each pass of the QUIC handshake loop Chuck Lever
2026-12-02 1:02 ` Alistair
2026-12-01 21:42 ` [PATCH v1 8/9] tlshd: Link a configured keyring only when root owns it Chuck Lever
2026-12-02 1:03 ` Alistair
2026-12-01 21:42 ` [PATCH v1 9/9] tlshd: Validate DN strings as UTF-8 before glob matching Chuck Lever
2026-12-02 1:04 ` Alistair
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261201214249.296675-4-cel@kernel.org \
--to=cel@kernel.org \
--cc=kernel-tls-handshake@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.