Re: Experiments with Postgres and SSL - Mailing list pgsql-hackers
From | Matthias van de Meent |
---|---|
Subject | Re: Experiments with Postgres and SSL |
Date | |
Msg-id | CAEze2WhoBZiv4eSoQkrr_fV-8NQzXrUr1GE5mS1BTEDihi7DxA@mail.gmail.com Whole thread Raw |
In response to | Re: Experiments with Postgres and SSL (Heikki Linnakangas <hlinnaka@iki.fi>) |
Responses |
Re: Experiments with Postgres and SSL
|
List | pgsql-hackers |
On Thu, 22 Feb 2024 at 18:02, Heikki Linnakangas <hlinnaka@iki.fi> wrote: > > On 22/02/2024 01:43, Matthias van de Meent wrote: >> On Wed, 10 Jan 2024 at 09:31, Heikki Linnakangas <hlinnaka@iki.fi> wrote: >>> 4. The number of combinations of sslmode, gssencmode and sslnegotiation >>> settings is scary. And we have very few tests for them. >> >> Yeah, it's not great. We could easily automate this better though. I >> mean, can't we run the tests using a "cube" configuration, i.e. test >> every combination of parameters? We would use a mapping function of >> (psql connection parameter values -> expectations), which would be >> along the lines of the attached pl testfile. I feel it's a bit more >> approachable than the lists of manual option configurations, and makes >> it a bit easier to program the logic of which connection security >> option we should have used to connect. >> The attached file would be a drop-in replacement; it's tested to work >> with SSL only - without GSS - because I've been having issues getting >> GSS working on my machine. > > +1 testing all combinations. I don't think the 'mapper' function > approach in your version is much better than the original though. Maybe > it would be better with just one 'mapper' function that contains all the > rules, along the lines of: (This isn't valid perl, just pseudo-code) > > sub expected_outcome > { [...] > } > > Or maybe a table that lists all the combinations and the expected > outcome. Something lieke this: [...] > > The problem is that there are more than two dimensions. So maybe an > exhaustive list like this: > > user sslmode gssmode outcome > > nossluser require disable fail > ... > I'm just throwing around ideas here, can you experiment with different > approaches and see what looks best? One issue with exhaustive tables is that they would require a product of all options to be listed, and that'd require at least 216 rows to manage: server_ssl 2 * server_gss 2 * users 3 * client_ssl 4 * client_gss 3 * client_ssldirect 3 = 216 different states. I think the expected_autcome version is easier in that regard. Attached an updated version using a single unified connection type validator using an approach similar to yours. Note that it does fail 8 tests, all of which are attributed to the current handling of `sslmode=require gssencmode=prefer`: right now, we allow GSS in that case, even though the user require-d sslmode. An alternative check that does pass tests with the code of the patch is commented out, at lines 209-216. >>> ALPN >> >> Does the TLS ALPN spec allow protocol versions in the protocol tag? It >> would be very useful to detect clients with new capabilities at the >> first connection, rather than having to wait for one round trip, and >> would allow one avenue for changing the protocol version. > > Looking at the list of registered ALPN tags [0], I can see "http/0.9"; > "http/1.0" and "http/1.1". Ah, nice. > I think we'd want to changing the major > protocol version in a way that would introduce a new roundtrip, though. I don't think I understand what you meant here, could you correct the sentence or expand why we want to do that? Note that with ALPN you could negotiate postgres/3.0 or postgres/4.0 during the handshake, which could save round-trips. Kind regards, Matthias van de Meent Neon (https://neon.tech)
Attachment
pgsql-hackers by date: