Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796161371; b=jGK+i6qWcR4Xfo1hp1vc3ThAHOOq9ziMkyYlziee9y9AUrDtJulIsrfSmUTR1O+fI73w mp3Yr30e4YCCJMAwujk/SYPi6a9Rgn8A47+vXlT3rOpq0GwusUzPo47Gd6mjO9RH5ggbH 6AYzIa/CY701ykswkYCx8lil22D3jo0H9pny1KETlP70658uYa5bphXWrbNaC6iyPzuKx v04gZ97v44Jtbaqwvu/DueFQZdH4T794vQ3wDT4n6KX9tZijH0z/DENojxZARlS66Bx0Q qvfTHxRqwPAiHcMVCA4a3RKMoTvqYv1Yk2FcmiEDYsMeNvJ0L12HoOvZpzhmpDuTkmw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796161371; h=Received:DKIM-Signature:From:To:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=gsQpbQj+dvTCFzSrLRG80w46FIlJCpFDcDoj1AAJ7+k=; b=Ayp1tE3IMJ2JutIauSx2ZA+N0bWZhE3Hs1U7iMTSTgzgs99y0cyYwPBbVAnZEUq+owXe vi4UzAt3NhW3RJ0fuUQ7nz982ngkFu7u90xYkAZmCbIRcPBm2JWmu5Zq59el68J3HHrRF uNktHE7U9zjnBRZtCc3D9g4kZtD5agua/1zRCyA4rIwcz/A0YxaZuLKWy7dZWsfGXRVCD 0jMj0HeGIrcES6QD1uMDxTRy8UVfAr7MRR7XFIIl4HMMjdubNZsVDeAxUZsSdT9DuForR Xsi2E1r2ig48h4quJ3xg1L1QUalErztmY5IE2aFdO6emIJnbmx6LsEWYWrqKSuxsSwg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ekU1H1dG; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D34F606A325 for ; Tue, 1 Dec 2026 21:42:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ekU1H1dG Received: by smtp.kernel.org (Postfix) with ESMTPSA id 094381F00893 for ; Tue, 1 Dec 2026 21:42:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796161371; bh=gsQpbQj+dvTCFzSrLRG80w46FIlJCpFDcDoj1AAJ7+k=; h=From:To:Subject:Date:In-Reply-To:References; b=ekU1H1dGCzpLcwl04m7QEVD7J7PWyDo8lIz2J7Unm0jcj2XBU83NR23cWVTTUA2BI rAqZh3G7BSJ1FVktdQhr437uODCdmhIsYRg2hee+A1yzgUqum8DZMBRlkhif4jGPW9 YBp1U0YzBRc+v0NzZ88mhdUM48h/z+dmmm0NgKGNCNNw+PZyfE8aXzOL8FXXOntjF4 YosDFeT56fAPDc1+e7RaCSLS5eyRJL2M0Nq3bgbTpzEpXsCcUperjgTOnN/lP7g08h f3vHbkWV+r9P2KUs+hFXD91UrPNiFq2Xv1pHCINOnTK0yX7nh2Y3GLUgD2F1UdFSlF l59hRCqZC+/3Q== From: Chuck Lever To: 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 Message-ID: <20261201214249.296675-4-cel@kernel.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261201214249.296675-1-cel@kernel.org> References: <20261201214249.296675-1-cel@kernel.org> X-Mailing-List: kernel-tls-handshake@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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