pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feedpgsql: Send ALPN in TLS handshake, require it in direct SSL connections
3+ messages / 3 participants
[nested] [flat]
Commits from this thread:
2024-04-08 3e60e956b0 Fix check for 'outlen' return from SSL_select_next_proto()
* pgsql: Send ALPN in TLS handshake, require it in direct SSL connections
@ 2024-04-08 01:25 Heikki Linnakangas <heikki.linnakangas@iki.fi>
2024-04-08 01:50 ` Re: pgsql: Send ALPN in TLS handshake, require it in direct SSL connections Andres Freund <andres@anarazel.de>
0 siblings, 1 reply; 3+ messages in thread
From: Heikki Linnakangas @ 2024-04-08 01:25 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
Send ALPN in TLS handshake, require it in direct SSL connections
libpq now always tries to send ALPN. With the traditional negotiated
SSL connections, the server accepts the ALPN, and refuses the
connection if it's not what we expect, but connecting without ALPN is
still OK. With the new direct SSL connections, ALPN is mandatory.
NOTE: This uses "TBD-pgsql" as the protocol ID. We must register a
proper one with IANA before the release!
Author: Greg Stark, Heikki Linnakangas
Reviewed-by: Matthias van de Meent, Jacob Champion
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/91044ae4baeac2e501e34164a69bd5d9c4976d21
Modified Files
--------------
doc/src/sgml/libpq.sgml | 12 +++++
src/backend/libpq/be-secure-openssl.c | 77 ++++++++++++++++++++++++++++++++
src/backend/tcop/backend_startup.c | 8 ++++
src/bin/psql/command.c | 7 ++-
src/include/libpq/libpq-be.h | 1 +
src/include/libpq/pqcomm.h | 19 ++++++++
src/interfaces/libpq/fe-secure-openssl.c | 35 +++++++++++++++
7 files changed, 157 insertions(+), 2 deletions(-)
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: pgsql: Send ALPN in TLS handshake, require it in direct SSL connections
2024-04-08 01:25 pgsql: Send ALPN in TLS handshake, require it in direct SSL connections Heikki Linnakangas <heikki.linnakangas@iki.fi>
@ 2024-04-08 01:50 ` Andres Freund <andres@anarazel.de>
2024-04-08 02:06 ` Re: pgsql: Send ALPN in TLS handshake, require it in direct SSL connections Heikki Linnakangas <hlinnaka@iki.fi>
0 siblings, 1 reply; 3+ messages in thread
From: Andres Freund @ 2024-04-08 01:50 UTC (permalink / raw)
To: Heikki Linnakangas <heikki.linnakangas@iki.fi>; +Cc: pgsql-committers@lists.postgresql.org
Hi,
On 2024-04-08 01:25:40 +0000, Heikki Linnakangas wrote:
> Send ALPN in TLS handshake, require it in direct SSL connections
>
> libpq now always tries to send ALPN. With the traditional negotiated
> SSL connections, the server accepts the ALPN, and refuses the
> connection if it's not what we expect, but connecting without ALPN is
> still OK. With the new direct SSL connections, ALPN is mandatory.
>
> NOTE: This uses "TBD-pgsql" as the protocol ID. We must register a
> proper one with IANA before the release!
>
> Author: Greg Stark, Heikki Linnakangas
> Reviewed-by: Matthias van de Meent, Jacob Champion
My compiler complains:
[396/992 42 39%] Compiling C object src/backend/postgres_lib.a.p/libpq_be-secure-openssl.c.o
../../../../../home/andres/src/postgresql/src/backend/libpq/be-secure-openssl.c: In function 'alpn_cb':
../../../../../home/andres/src/postgresql/src/backend/libpq/be-secure-openssl.c:1327:69: warning: ordered comparison of pointer with integer zero [-Wextra]
1327 | if (*out == NULL || *outlen > sizeof(alpn_protos) || outlen <= 0)
| ^~
[991/992 1 99%] Linking target src/bin/pg_dump/pg_dump
And I think it may show why the warning is a good idea - I assume
"*outlen <= 0" was intended?
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: pgsql: Send ALPN in TLS handshake, require it in direct SSL connections
2024-04-08 01:25 pgsql: Send ALPN in TLS handshake, require it in direct SSL connections Heikki Linnakangas <heikki.linnakangas@iki.fi>
2024-04-08 01:50 ` Re: pgsql: Send ALPN in TLS handshake, require it in direct SSL connections Andres Freund <andres@anarazel.de>
@ 2024-04-08 02:06 ` Heikki Linnakangas <hlinnaka@iki.fi>
0 siblings, 0 replies; 3+ messages in thread
From: Heikki Linnakangas @ 2024-04-08 02:06 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; Heikki Linnakangas <heikki.linnakangas@iki.fi>; +Cc: pgsql-committers@lists.postgresql.org
On 08/04/2024 04:50, Andres Freund wrote:
> On 2024-04-08 01:25:40 +0000, Heikki Linnakangas wrote:
>> Send ALPN in TLS handshake, require it in direct SSL connections
>>
>> libpq now always tries to send ALPN. With the traditional negotiated
>> SSL connections, the server accepts the ALPN, and refuses the
>> connection if it's not what we expect, but connecting without ALPN is
>> still OK. With the new direct SSL connections, ALPN is mandatory.
>>
>> NOTE: This uses "TBD-pgsql" as the protocol ID. We must register a
>> proper one with IANA before the release!
>>
>> Author: Greg Stark, Heikki Linnakangas
>> Reviewed-by: Matthias van de Meent, Jacob Champion
>
> My compiler complains:
>
> [396/992 42 39%] Compiling C object src/backend/postgres_lib.a.p/libpq_be-secure-openssl.c.o
> ../../../../../home/andres/src/postgresql/src/backend/libpq/be-secure-openssl.c: In function 'alpn_cb':
> ../../../../../home/andres/src/postgresql/src/backend/libpq/be-secure-openssl.c:1327:69: warning: ordered comparison of pointer with integer zero [-Wextra]
> 1327 | if (*out == NULL || *outlen > sizeof(alpn_protos) || outlen <= 0)
> | ^~
> [991/992 1 99%] Linking target src/bin/pg_dump/pg_dump
>
> And I think it may show why the warning is a good idea - I assume
> "*outlen <= 0" was intended?
Yes. Fixed, thanks!
--
Heikki Linnakangas
Neon (https://neon.tech)
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2024-04-08 02:06 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-04-08 01:25 pgsql: Send ALPN in TLS handshake, require it in direct SSL connections Heikki Linnakangas <heikki.linnakangas@iki.fi>
2024-04-08 01:50 ` Andres Freund <andres@anarazel.de>
2024-04-08 02:06 ` Heikki Linnakangas <hlinnaka@iki.fi>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox