Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rz8v7-0024so-UH for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Apr 2024 05:42:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rz8v6-006bXM-8m for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Apr 2024 05:42:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rz8v5-006bXE-VU for pgsql-hackers@lists.postgresql.org; Tue, 23 Apr 2024 05:42:19 +0000 Received: from fout6-smtp.messagingengine.com ([103.168.172.149]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rz8v3-002T7E-PP for pgsql-hackers@lists.postgresql.org; Tue, 23 Apr 2024 05:42:19 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailfout.nyi.internal (Postfix) with ESMTP id 7208C13800D8; Tue, 23 Apr 2024 01:42:16 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 23 Apr 2024 01:42:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1713850936; x=1713937336; bh=T6VIFZJGZo yjPfqbfKHa3O37YQsXkFX8wl/LPJF6NTs=; b=PvSpP+zVmJq6jQcAtetNEwG3/i 7DkZpOKoqTHuhVTauriYc6pys5RjzlhZmXLVyTC4kTte413OATmXUTNzFhEtUpq6 wg40w8uN019EiVILyogOfPpXr5LUi/12R/ob8u7KjhfzqziKE56QwVs2t8SYSIIN 6EZccNNZjudPT7mtQACB8KiFAqH5gEVB5WraReRzhO5i4/d0tDxaa6K9nFGToqC9 k/+Qp//ldW6Fzxd72EnwsjOkMfvU+I+blt+OJaIV36anN1WohxF+db+54L1LwoCF +Fz8xY7MIW6bkD/PT7z5SOScYkC/sqxl1uI7fah3DUi6CgYkjDT5dQpJlJWA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1713850936; x=1713937336; bh=T6VIFZJGZoyjPfqbfKHa3O37YQsX kFX8wl/LPJF6NTs=; b=NqmdSd6rJ7fzV8ii7yA2Yonl8G0gwTgtsGtNCXgyQy3j UpD/7dMy1a+ob1LU/0siqCm42oxRDwi9oO5Jw6mKqYgoKYH1Nqg3h7rg0oNjAqr6 WeEkb1Bp6sv4Isa9NnbGM9PyWpX8fOkSQA9gl0udvywSwc7gYA3f/W/sGy82WZsK 5wKqFblMZY073vufu4CEbW9Va09xQ7QOdQt+XRXMY3rOs2U3TY9McKYzJn0bRDtf ihXuUuZJMN/Btb/zlYQ54ZiROJacWKrycuW7aFTnlmNN94zQxI0Hb4MIvY2z4mEY Ss3pqidZktycWC8QJKQ/p/QWp7I/BciA/2KofIxWSw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudeltddguddtudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enfghrlhcuvffnffculdejtddmnecujfgurhepfffhvfevuffkfhggtggujgesghdtreer tddtvdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlse hprghquhhivghrrdighiiiqeenucggtffrrghtthgvrhhnpeetleeifedufffhhfdtteel geeggeffhfekueevteeigfduudevudetgfegiedvjeenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdig hiii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 23 Apr 2024 01:42:14 -0400 (EDT) Date: Tue, 23 Apr 2024 14:42:08 +0900 From: Michael Paquier To: Heikki Linnakangas Cc: Jacob Champion , Postgres hackers Subject: Re: Direct SSL connection with ALPN and HBA rules Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="jpqMtVWBerLYrPiC" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --jpqMtVWBerLYrPiC Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Apr 22, 2024 at 10:47:51AM +0300, Heikki Linnakangas wrote: > On 22/04/2024 10:19, Michael Paquier wrote: >> As a whole, I can get behind a unique GUC that forces the use of >> direct. Or, we could extend the existing "ssl" GUC with a new >> "direct" value to accept only direct connections and restrict the >> original protocol (and a new "postgres" for the pre-16 protocol, >> rejecting direct?), while "on" is able to accept both. >=20 > I'd be OK with that, although I still don't really see the point of forci= ng > this from the server side. We could also add this later. I'd be OK with doing something only in v18, if need be. Jacob, what do you think? >> Hmm. Splitting the logic checking HBA entries (around check_hba) so >> as we'd check for a portion of its contents depending on what the >> server has received or not from the client would not be that >> complicated. I'd question whether it makes sense to mix this >> information within the same configuration files as the ones holding >> the current HBA rules. If the same rules are used for the >> pre-startup-packet phase and the post-startup-packet phase, we'd want >> new keywords for these HBA rules, something different than the >> existing sslmode and no sslmode? >=20 > Sounds complicated, and I don't really see the use case for controlling t= he > direct SSL support in such a fine-grained fashion. >=20 > It would be nice if we could reject non-SSL connections before the client > sends the startup packet, but that's not possible because in a plaintext > connection, that's the first packet that the client sends. The reverse wo= uld > be possible: reject SSLRequest or direct SSL connection immediately, if H= BA > doesn't allow non-SSL connections from that IP address. But that's not ve= ry > interesting. I'm not completely sure, actually. We have the APIs to do that in simple ways with existing keywords and new options. And there is some merit being able to have more complex connection policies. If both of you object to that, I won't insist. > HBA-based control would certainly be v18 material. Surely. -- Michael --jpqMtVWBerLYrPiC Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmYnSjAACgkQnvQgOdby QH08FA//XIQ3qisF7xUMlEz1o1K+B0QPUpJb5cnGwcjElHH1BBUW0rt2Err/ZsM7 TZmDCzUgLmxVqKcPvzA4sFk6D6QAh+fN87HS4dReDDkmDl8qyi4g3dWNN4dJGNmK Nj5Z8RWdzjiNABT38dP0EhXh+ewiq71xCvo9qlg7dBB7ILBW2XVp8Uw5FOJoEzmw CkxdEsyzcFcPOayUXclH4FweOsfPhc30luJxkBSFXbvOhZ3WjVDLPxRvt89SmNaB 6St2in6os3GZISneezCBVZknR+8INDWU1h9HgqZ5JEqOc8Sjfwpo+1BC0ZNlSjml bC7re2pz3s1oMInvpME7uDSvH8A7ouoTtDJ56k8QN3gVd0+nl8C5vEkeIXDQLfpo T1FlehU8fq0jkHhF1AvGxTD6q9/8r49w9IiS9vGVmPYe6H4tAbbunsFkV3JbEjsp eHO0grzPhnpC3IbUA5UF96OxC4IAYDwg+KnmhiaDtUrSBeX/DAC+14rD1HcBTpcF 7emD0GfUVwzSnYv5mD0PjJMAXgBswxhplVhBwdIJOeclcexy9JcMfGb80Xl2EkRs GblYNwHX2hMWb4zDMiO/kspeCrWs8nczvQsGmHg9Sd76lVK7Fv63yzAWPaNytK/9 GMW56t+KiWKlVwvVVH+4YDfLotkfZdfQ0KD+DvTF01r1DS0+edI= =S866 -----END PGP SIGNATURE----- --jpqMtVWBerLYrPiC--