diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2024-04-08 04:24:51 +0300 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2024-04-08 04:24:51 +0300 |
commit | 91044ae4baeac2e501e34164a69bd5d9c4976d21 (patch) | |
tree | 030ae118927d18f14ecb8840ec6719932b79773c /src/backend/tcop/backend_startup.c | |
parent | d39a49c1e459804831302807c724fa6512e90cf0 (diff) | |
download | postgresql-91044ae4baeac2e501e34164a69bd5d9c4976d21.tar.gz postgresql-91044ae4baeac2e501e34164a69bd5d9c4976d21.zip |
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
Diffstat (limited to 'src/backend/tcop/backend_startup.c')
-rw-r--r-- | src/backend/tcop/backend_startup.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/backend/tcop/backend_startup.c b/src/backend/tcop/backend_startup.c index b59df3f6603..ee73d01e16c 100644 --- a/src/backend/tcop/backend_startup.c +++ b/src/backend/tcop/backend_startup.c @@ -407,6 +407,14 @@ ProcessSSLStartup(Port *port) } Assert(port->ssl_in_use); + if (!port->alpn_used) + { + ereport(COMMERROR, + (errcode(ERRCODE_PROTOCOL_VIOLATION), + errmsg("received direct SSL connection request without ALPN protocol negotiation extension"))); + goto reject; + } + if (Trace_connection_negotiation) ereport(LOG, (errmsg("direct SSL connection accepted"))); |