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=1796495266; b=iuM07Ycld0Yj26B31LphAkINBK9NuNISsZpU0lAENmobP2HvR8eHf8dPCchk+4tJDhdw n8ydRIpB6DwPyyXTuNUKpU5AxDs34dkCv3xacMaKIuJjY9mxnglERvK8NzzS2Xiep0Qf9 MzTtI55p4dbxwKf7+HUdoDIXDkH3InqUUvJYY2spCOSTHIuu6eIYwNCX6X37MwutKaQQp z9H07/lIApQ80KVKMBbuaOV6n1lfj/A7UtTQW5X4wZ4X0CBvkOROEgvqgB3d4Tj7IIha8 ySGfNMGOCoq1BxLzr82rE0Fisy5pljHo6QdOU1fyr6Z0yjmaNvpaky3vZmmvsh0nmZw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796495266; h=Received:DKIM-Signature:From:To:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=EyKm/RKJDKX0Ps/mdmunCxUlto485Te8ZbLvX9anpyg=; b=w5XaVRuLtMWij4lZikPoWIsvOKI9kDPivbQ8u5eJAJxKQDYSDDU8aPvNAGH53GZkmPvZ O50NU4RQS+jg89buB/DCYVp2Wf8bRX8lMOdQ5B8yynJuZT3FeHocXtApxQs22YKQ1/+ux xnnrs2/DhbaMWWJ6rCCO6RGbRrlLldRf+Zt/P35uq6CHA3aZTQJi9okMbXpwqJJZBcUNF ppc/H0KX02i1oeC/4YgolQz2uPJeQxTRv29HFgOgswtxVDyFFdD0CVf5ri8RmnZC8zbo3 74cj455yiYdhADLl+OYVaevkxfVYNTHEv0B1pavSP816+pkXv2zSMVderZr3n2ffDQg== 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=FDVKvxcg; 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 C623E606A32F for ; Sat, 5 Dec 2026 18:27:46 +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=FDVKvxcg Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6323A1F0092B for ; Sat, 5 Dec 2026 18:27:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796495266; bh=EyKm/RKJDKX0Ps/mdmunCxUlto485Te8ZbLvX9anpyg=; h=From:To:Subject:Date:In-Reply-To:References; b=FDVKvxcg6wkoTV9TsiKGwXXdE3UGNmGguLvmlqGNqVLiZqSsgUVz3JHdSkyHGu9M5 b0JldQkS64fnfTA6Qwdnz8yguPbV5QdxcKP3UOjBhnSPTGBo5LeOQ6XdyuZG8EbhUm ZsGfWtmq6FUYGXYBLdfz/Tml2NOoPN57qgH0Q//HFjEpcLSqrGFky0Oliycj/CbCZF +A3rfXgLWxkykhyZE59t/BzgKvMN8tNXJMWSqgotgfTQ66nEoKLy9PId9IQj9XWF5D zVwjBbHUyKV3tPy5JxY/ToMAcJxo/Zl7Eu/6IOZdIoEcR1it8XO1IEm36fMEleKAzo OoXxH70hmjVWw== From: Chuck Lever To: Subject: [PATCH 3/8] tlshd: Escape the client certificate description before logging it Date: Sat, 5 Dec 2026 13:27:38 -0500 Message-ID: <20261205182743.79220-4-cel@kernel.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261205182743.79220-1-cel@kernel.org> References: <20261205182743.79220-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 When the debug loglevel is nonzero, tlshd_tls13_server_x509_handshake() logs the one-line description of each certificate the client presented, including certificates that failed verification. The subject and issuer names in that description are chosen by whoever created the certificate, and any network client can present a self-signed one. A newline or terminal escape sequence in a name reaches the LOG_AUTH facility unmodified, where it can look like a separate authentication record. Pass the description through g_strescape() before logging it. As a side effect, non-ASCII characters in a name appear as octal escapes, and the backslashes of RFC 4514 escaping appear doubled. Fixes: 2f68c313c9a9 ("tlshd: Show ingress certificate on successful handshake") Signed-off-by: Chuck Lever --- src/tlshd/server.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/tlshd/server.c b/src/tlshd/server.c index 34965b0b036b..19266054999c 100644 --- a/src/tlshd/server.c +++ b/src/tlshd/server.c @@ -480,7 +480,12 @@ static void tlshd_tls13_server_x509_handshake(struct tlshd_handshake_parms *parm GNUTLS_X509_FMT_DER); if (gnutls_x509_crt_print(cert, GNUTLS_CRT_PRINT_ONELINE, &cinfo) == 0) { - tlshd_log_debug("Peer certificate: %s", cinfo.data); + gchar *desc; + + desc = g_strescape((const gchar *)cinfo.data, + NULL); + tlshd_log_debug("Peer certificate: %s", desc); + g_free(desc); gnutls_free(cinfo.data); } gnutls_x509_crt_deinit(cert); -- 2.56.0