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 1s1WLk-00Csym-BS for pgsql-hackers@arkaria.postgresql.org; Mon, 29 Apr 2024 19:07:40 +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 1s1WKj-001Y1l-37 for pgsql-hackers@arkaria.postgresql.org; Mon, 29 Apr 2024 19:06:37 +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 1s1WKi-001Y1c-Jf for pgsql-hackers@lists.postgresql.org; Mon, 29 Apr 2024 19:06:37 +0000 Received: from lahtoruutu.iki.fi ([2a0b:5c81:1c1::37]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s1WKc-000ifK-4F for pgsql-hackers@lists.postgresql.org; Mon, 29 Apr 2024 19:06:36 +0000 Received: from [192.168.1.115] (dsl-hkibng22-54f8db-125.dhcp.inet.fi [84.248.219.125]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hlinnaka) by lahtoruutu.iki.fi (Postfix) with ESMTPSA id 4VSt8z44RWz49PwQ; Mon, 29 Apr 2024 22:06:27 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1714417588; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yC79P+1xcVClx40JBMbvYzSfFWP64RR0cQOkRMCFlEU=; b=E9EFIzswJ42lt32JbeCei586uNekgMnusw+p6T9IGumjKrzaM0Gti55Wfhq+6EY7gDe3eX xYVqln0MImuD7p+p0ZQhsXxmLJ81IO60rIWIZ783c0Ff5kK6X5ht/TRbeEYgG4AWgS531C jHSVJwKPaZpt++b2b5CGI2XZa5L6pSUXDbdNZwE455d9Nv4YK2O07RTS75QcJrFIwGHZUQ UWAxgriXwSWfFQ4yiAX3ZgQJsOVB8j3mePTuEDD9gpFkh0V0o1MTwG7GFPQImP86LSwLsJ +JJ1zm5e49WHsN9GaMJAhBarPwTfGEpj/4wVmEa2gPxJ7SRwfSKaK+Xb+cxG6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1714417588; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yC79P+1xcVClx40JBMbvYzSfFWP64RR0cQOkRMCFlEU=; b=GfPEAQ4eDp3PwSWJzckna+YeOxGdcJwWJ/5K+4xftOkWx3SAUb0mtjYPN1tuGS3T4G8Yqn 8yqjI1Agltf8tanyXOlabLeW3Ms+7Xzg8Mv4q9WeDC0xNRNBlaC/czsulOCTeTB95D3lkb XOvYX8z2OrXxI7IEmZz01/ZJbcfRo6gvZ2VPBBtW/UyDdExkv8mH1cMXzL+oY5WGocyWf/ /KnMuhiiaK2HvAXx365rvrxPEZFDNIt2nIGXtRxC6J4EI8lZ9X1jfSeyThNZmfNXAqPo1z jUAruiHymUavFDQ4jFgrouYC/pT3UXElwsggIbHYIGOz6jb23r8K5QZgH72Qag== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=hlinnaka smtp.mailfrom=hlinnaka@iki.fi ARC-Seal: i=1; s=lahtoruutu; d=iki.fi; t=1714417588; a=rsa-sha256; cv=none; b=tVLuJcGfObYclPY3JOwICcpwlPxkbmN9bqlE8wHA40MGXHnRZe3RhtTliRwgaqIu9UDhDl dYdE/9vJaiyAaHJkMn8hL5iOj/Ui1K9m3/IqU3TapG9QUuI3L+hVm8CSseIQL37bftFdAg xiOOl0BlSk22OWx7Ug4FUiQba4K9qP576g53/hCK6Jmk8uI8Uf5H56cyho8Sr+lySHYxFL EyMZZWuHKG9KA3QbI6bCFiCn/VhoyFqUP1n21DXwwIN46c+Rpc4qBzF4NwYXGO4vsCJx/H 39FDagQ34RVgP5AOX0TKc6GONQ5Vpq0vA6MN+NRQLoql/ikmI90z1vumRLge5Q== Message-ID: <1a717f65-7390-4111-8efd-c6e9b213805e@iki.fi> Date: Mon, 29 Apr 2024 22:06:27 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Direct SSL connection with ALPN and HBA rules To: Jacob Champion , Daniel Gustafsson Cc: Robert Haas , Michael Paquier , Postgres hackers References: <5a79ed71-b365-4b20-80bc-9c2bf97bf84b@iki.fi> <3a6f126c-e1aa-4dcc-9252-9868308f6cf0@iki.fi> Content-Language: en-US From: Heikki Linnakangas In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 29/04/2024 21:43, Jacob Champion wrote: > On Mon, Apr 29, 2024 at 1:38 AM Heikki Linnakangas wrote: >> If you only >> have v17 servers in your environment, so you know all servers support >> direct negotiation if they support SSL at all, but a mix of servers with >> and without SSL, sslnegotiation=directonly would reduce roundtrips with >> sslmode=prefer. > > But if you're in that situation, what does the use of directonly give > you over `sslnegotiation=direct`? You already know that servers > support direct, so there's no additional performance penalty from the > less strict mode. Well, by that argument we don't need requiredirect/directonly at all. This goes back to whether it's a security feature or a performance feature. There is a small benefit with sslmode=prefer if you connect to a server that doesn't support SSL, though. With sslnegotiation=direct, if the server rejects the direct SSL connection, the client will reconnect and try SSL with SSLRequest. The server will respond with 'N', and the client will proceed without encryption. sslnegotiation=directonly removes that SSLRequest attempt, eliminating one roundtrip. >> Making requiredirect to imply sslmode=require, or error out unless you >> also set sslmode=require, feels like a cavalier way of forcing SSL. We >> should have a serious discussion on making sslmode=require the default >> instead. That would be a more direct way of nudging people to use SSL. >> It would cause a lot of breakage, but it would also be a big improvement >> to security. >> >> Consider how sslnegotiation=requiredirect/directonly would feel, if we >> made sslmode=require the default. If you explicitly set "sslmode=prefer" >> or "sslmode=disable", it would be annoying if you would also need to >> remove "sslnegotiation=requiredirect" from your connection string. > > That's similar to how sslrootcert=system already works. To me, it > feels great, because I don't have to worry about nonsensical > combinations (with the exception of GSS, which we've touched on > above). libpq complains loudly if I try to shoot myself in the foot, > and if I'm using sslrootcert=system then it's a pretty clear signal > that I care more about security than the temporary inconvenience of > editing my connection string for one weird server that doesn't use SSL > for some reason. Oh I was not aware sslrootcert=system works like that. That's a bit surprising, none of the other ssl-related settings imply or require that SSL is actually used. Did we intend to set a precedence for new settings with that? (adding Daniel in case he has an opinion) -- Heikki Linnakangas Neon (https://neon.tech)