From mboxrd@z Thu Jan 1 00:00:00 1970 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=1796161372; b=2JwWQONHP+elCsVib6SxAx0wpRjTyBVc1A5RKDexJcb5LU+neU6s7BT/7SVQtaujRnTk hQJtaowcS1vXL0Vb5BhVNdpZ4TLHog/NwyKPp6ZYd6LqARcTMehwcRCBEJ2M5lDMufIxl 6S94un/uKJFvAPfae2Z8NdrUgwlLaz0mYMegQE1E0D5Rp76uixZ4wOcJfe+K7M10v+nhm Ywlc1laGnWiv4B7pUWRNPul1duHRDH9GqUllbf3mBgIR3/cn4yy7LdWQBOgIqc2q2A/Hv ltj9kZChazD0YYKzAqhYC54+lacRzpLmHSpExKyj8suiD+k9ZFPx1vYSvR6YcSYkASw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796161372; h=Received:DKIM-Signature:From:To:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=X5tp+QVaBxqFZfEF2H8NMl9WYU82l3BavPpvvPgbUUs=; b=D1XhuuplczHafGoR9XyIZZ0NpDJUfN7pmw7GgLDYnsRR7wbtt2S5WUra3I/47WRFBHVG xLHsl71o2iNKX1f0KxSXVhh1a756XTaZCHokLm2bf+uGZDpEhBxFcKNVH945XCjeMVdnZ uHCbzjSSuKPW4KmR3LBqQdgAERez9LfAGDgW+T8YE5W1W4znYhDZ+t3vLz6ekqYsaFGVd T8DXUW3XCS2SNpDDv7bZgmn/UhxgI74Onr6yY2RKCdc8ueEXaPr+le/ka+q/58ImMtn22 a5QUoYcI2/2SyFrEOK7mARsWrjoCuNTH+JFWyBv1YuxS/CxvAzLeNhwh0fTFDY2NG6g== 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=JmEzRSya; 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 6C6BA606A320 for ; Tue, 1 Dec 2026 21:42:52 +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=JmEzRSya Received: by smtp.kernel.org (Postfix) with ESMTPSA id D57A31F00893 for ; Tue, 1 Dec 2026 21:42:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796161372; bh=X5tp+QVaBxqFZfEF2H8NMl9WYU82l3BavPpvvPgbUUs=; h=From:To:Subject:Date:In-Reply-To:References; b=JmEzRSya8obkGJQuA1wZ5PeAb4qd2mfRG1S+DaUXBcY0A985n9zQKHPcpTiMmG16k /NAgsj5qewWNrbhwE8RpOXaCfrL/YDIvtHXEWoYmPNWajfLh13t84LBnRnbiq9fbBo t1QyDVsKZmaJnuMtk+Ew2znbtj7YLjMsD15nAOEp53mOHKlk9KKEXPhTUpm8jVGIXR DKKeb1GryVhsjfUvSLhRatktHrOlSpP0i4kXzwkjZDmLeBD4/Ev6BXrMNrWSJN1lbj P9lnzla7f4wpCmVDC7sSjm8y7aEDxAT5SWnIMG9o9cNXmc3ZxGL9qVZ1ESR94zbKK+ ztnDVeYWO10uw== From: Chuck Lever To: Subject: [PATCH v1 5/9] tlshd: Match session tags only after the client certificate verifies Date: Tue, 1 Dec 2026 16:42:44 -0500 Message-ID: <20261201214249.296675-6-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_tls13_server_x509_handshake() calls tlshd_tags_match_session() after every handshake. The server only requests a client certificate, so a client may complete the handshake without one. Every filter then fails to match, because there is no certificate to examine, and a tag whose filters are all negated, or that has no filters at all, is marked as matched. tls-session-tags(7) describes tags as the server's recognition of a peer whose certificate is trusted, but an anonymous client receives them. Match tags only when the handshake succeeded and the verify function recorded a peer ID, which it does only for a verified certificate. Fixes: f11519ab4a45 ("tlshd: Match ingress certificates with defined TLS session tags") Signed-off-by: Chuck Lever --- src/tlshd/server.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tlshd/server.c b/src/tlshd/server.c index ab6d7b3b93c2..206fb9a45401 100644 --- a/src/tlshd/server.c +++ b/src/tlshd/server.c @@ -487,7 +487,9 @@ static void tlshd_tls13_server_x509_handshake(struct tlshd_handshake_parms *parm } } - tlshd_tags_match_session(session); + /* Assign tags only to a peer whose certificate was verified */ + if (!parms->session_status && parms->remote_peerids->len) + tlshd_tags_match_session(session); out_deinit_session: gnutls_deinit(session); -- 2.56.0