Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o6qhy-0003Xs-Qd for pgsql-hackers@arkaria.postgresql.org; Thu, 30 Jun 2022 09:43:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o6qhx-0004iI-Nn for pgsql-hackers@arkaria.postgresql.org; Thu, 30 Jun 2022 09:43:33 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o6qhx-0004i1-E2 for pgsql-hackers@lists.postgresql.org; Thu, 30 Jun 2022 09:43:33 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o6qht-0008G4-UC for pgsql-hackers@postgresql.org; Thu, 30 Jun 2022 09:43:33 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id E08C0320097E; Thu, 30 Jun 2022 05:43:25 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Thu, 30 Jun 2022 05:43:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1656582205; x=1656668605; bh=F k1LD3bzBzGc0JjBG2loEl/rSm5oAtCtWxdtWKKsBJQ=; b=aklXcj2BjMTGPFYdf hochwcWiPmjsrRFdA2GWA3qMz0w02bkdp3h1q/eCMqvSin2QesX3+/8mi231sEi4 VnUWBFiIMJUOLSsdiNsey7u6yES9pDXI6+glBNjLqgWUZU2cSnxYfXr8vysxAxpU /jfDOoILYgQFKdCMDEH0GrdJfHAhsIOoMM6eBg6d/AtEDzZGUqlhhMZvDpJFmqqe L5FirsirMX/YsPk8263/U6wQSjNz73ILvaBBX6O6NAOCQqWiMuOPAe1TBYOc6ofo O9ygWSnaYhtI+q6huerkm5U7jzl95/qZIuL2sHQ2ouvvl27BYLnxNiLw3mhDgk7I tyrtg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrudehuddgudeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfhffuvfhfjggtgfesthejredttdefjeenucfhrhhomheprfgvthgv rhcugfhishgvnhhtrhgruhhtuceophgvthgvrhdrvghishgvnhhtrhgruhhtsegvnhhtvg hrphhrihhsvggusgdrtghomheqnecuggftrfgrthhtvghrnhephfelgfdvfefgleeivdet ieelteelgfeggeduffeghefgfeeffedtffdtjeffkeeinecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomhepphgvthgvrhdrvghishgvnhhtrhgruhht segvnhhtvghrphhrihhsvggusgdrtghomh X-ME-Proxy: Feedback-ID: i131946ab:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 30 Jun 2022 05:43:24 -0400 (EDT) Message-ID: Date: Thu, 30 Jun 2022 10:43:21 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 From: Peter Eisentraut Subject: Re: [PATCH] Log details for client certificate failures To: "pgsql-hackers@postgresql.org" , Jacob Champion References: <290871e5-f1d9-54a8-5df4-dbd9e604c08d@enterprisedb.com> <7c0468dcadbc0d0c987daf9ca08c8d111948eae6.camel@vmware.com> <9b8338210b865d79239ec35ca523792ce331c0a3.camel@vmware.com> Content-Language: en-US In-Reply-To: <9b8338210b865d79239ec35ca523792ce331c0a3.camel@vmware.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 13.05.22 00:36, Jacob Champion wrote: > On Thu, 2022-05-05 at 15:12 +0000, Jacob Champion wrote: >> On Wed, 2022-05-04 at 15:53 +0200, Peter Eisentraut wrote: >>> In terms of aligning what is printed, I meant that pg_stat_ssl uses the >>> issuer plus serial number to identify the certificate unambiguously. >> >> Oh, that's a great idea. I'll do that too. > > v2 limits the maximum subject length and adds the serial number to the > logs. I wrote that pg_stat_ssl uses the *issuer* plus serial number to identify a certificate. What your patch shows is the subject and the serial number, which isn't the same thing. Let's get that sorted out one way or the other. Another point, your patch produces LOG: connection received: host=localhost port=44120 LOG: client certificate verification failed at depth 1: ... DETAIL: failed certificate had subject ... LOG: could not accept SSL connection: certificate verify failed I guess what we really would like is LOG: connection received: host=localhost port=44120 LOG: could not accept SSL connection: certificate verify failed DETAIL: client certificate verification failed at depth 1: ... failed certificate had subject ... But I suppose that would be very cumbersome to produce with the callback structure provided by OpenSSL? I'm not saying the proposed way is unacceptable, but maybe it's worth being explicit about this tradeoff.