public inbox for [email protected]  
help / color / mirror / Atom feed
From: Heikki Linnakangas <[email protected]>
To: Jacob Champion <[email protected]>
To: Daniel Gustafsson <[email protected]>
Cc: Robert Haas <[email protected]>
Cc: Michael Paquier <[email protected]>
Cc: Postgres hackers <[email protected]>
Subject: Re: Direct SSL connection with ALPN and HBA rules
Date: Mon, 29 Apr 2024 22:06:27 +0300
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAOYmi+k2kJcJLMj=K4Vb3S_J6tN6989Wfi5+amqf15VkHcej3Q@mail.gmail.com>
References: <[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<CAOYmi+n57x+8DVi9J+dGmFQo+2Eb+bg_+geH=jqfh3E=NWHfOA@mail.gmail.com>
	<CA+TgmoaLpDVY2ywqQUfxvKEQZ+nwkabcw_f=i4Zyivt9CLjcmA@mail.gmail.com>
	<CAOYmi+=sj+1uydS0NR4nYzw-LRWp3Q-s5speBug5UCLSPMbvGA@mail.gmail.com>
	<[email protected]>
	<CAOYmi+kfsRfopQRTuJwpsO50Urq=-gwYDJ1fWNkDr3oYM1wdjA@mail.gmail.com>
	<CA+TgmoZspODpL6AYbANpffhbF+Q12xo1pHXrR9ZSkYfEQWpP3w@mail.gmail.com>
	<CAOYmi+k3x-aKiVzyLfzdxFdmcBmVD8UvcwfB075BkNqyA1aa9w@mail.gmail.com>
	<CA+TgmobR1R8q-rT06oWdLw_Kp_i67Uey9b+rWVrrpCJVSDNBFQ@mail.gmail.com>
	<CAOYmi+=TB8=yfXoBk=p0k0GPaCD79F8xXcypZFkjKmPKuT0hjQ@mail.gmail.com>
	<[email protected]>
	<CAOYmi+nWKJNihuMpT+ZVTC5-d+pQdACTK7xKhhwAB075EHrOMg@mail.gmail.com>
	<[email protected]>
	<CAOYmi+k2kJcJLMj=K4Vb3S_J6tN6989Wfi5+amqf15VkHcej3Q@mail.gmail.com>

On 29/04/2024 21:43, Jacob Champion wrote:
> On Mon, Apr 29, 2024 at 1:38 AM Heikki Linnakangas <[email protected]> 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)







view thread (30+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Direct SSL connection with ALPN and HBA rules
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox