From: Chuck Lever <cel@kernel.org>
To: <kernel-tls-handshake@lists.linux.dev>
Subject: [PATCH v1 1/9] tlshd: Require the clientAuth key purpose on client certificates
Date: Tue, 1 Dec 2026 16:42:40 -0500 [thread overview]
Message-ID: <20261201214249.296675-2-cel@kernel.org> (raw)
In-Reply-To: <20261201214249.296675-1-cel@kernel.org>
tlshd_server_x509_verify_function() checks a client's certificate
chain with gnutls_certificate_verify_peers3(). With a NULL hostname,
that call hands GnuTLS no typed data at all, so GnuTLS does not check
the extended key usage of the end-entity certificate. A certificate
issued only for TLS server authentication passes, and tlshd reports
the peer to the kernel as authenticated. When no server trust store
is configured, the trust anchors are the system's public CAs, which
now issue serverAuth-only certificates. Any holder of such a
certificate is then accepted as an mTLS client by NFSD.
Pass GNUTLS_KP_TLS_WWW_CLIENT to gnutls_certificate_verify_peers().
GnuTLS then rejects an end-entity certificate whose extended key
usage extension omits clientAuth and anyPurpose. A certificate that
carries no extended key usage extension is still accepted, as RFC
5280 Section 4.2.1.12 permits.
Fixes: 9d1b6a30d57c ("tlshd: Basic support for ServerHello")
Signed-off-by: Chuck Lever <cel@kernel.org>
---
src/tlshd/server.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/tlshd/server.c b/src/tlshd/server.c
index 10a63c2a6a63..4cb97b03c4a1 100644
--- a/src/tlshd/server.c
+++ b/src/tlshd/server.c
@@ -330,11 +330,15 @@ static int tlshd_server_get_truststore(gnutls_certificate_credentials_t cred)
static int tlshd_server_x509_verify_function(gnutls_session_t session,
struct tlshd_handshake_parms *parms)
{
+ gnutls_typed_vdata_st data = {
+ .type = GNUTLS_DT_KEY_PURPOSE_OID,
+ .data = (void *)GNUTLS_KP_TLS_WWW_CLIENT,
+ };
const gnutls_datum_t *peercerts;
unsigned int i, status, num_peercerts;
int ret;
- ret = gnutls_certificate_verify_peers3(session, NULL, &status);
+ ret = gnutls_certificate_verify_peers(session, &data, 1, &status);
switch (ret) {
case GNUTLS_E_SUCCESS:
break;
@@ -350,10 +354,6 @@ static int tlshd_server_x509_verify_function(gnutls_session_t session,
goto certificate_error;
}
- /* To do: Examine extended key usage information here, if we want
- * to get picky. Kernel would have to tell us what to look for
- * via a netlink attribute. */
-
peercerts = gnutls_certificate_get_peers(session, &num_peercerts);
if (!peercerts || num_peercerts == 0) {
tlshd_log_debug("The peer cert list is empty.");
--
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 ` Chuck Lever [this message]
2026-12-02 0:38 ` [PATCH v1 1/9] tlshd: Require the clientAuth key purpose on client certificates 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 ` [PATCH v1 3/9] tlshd: Fail the handshake when a configured trust store is missing Chuck Lever
2026-12-02 0:42 ` 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-2-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.