diff options
author | Heikki Linnakangas | 2024-04-08 01:24:51 +0000 |
---|---|---|
committer | Heikki Linnakangas | 2024-04-08 01:24:51 +0000 |
commit | 91044ae4baeac2e501e34164a69bd5d9c4976d21 (patch) | |
tree | 030ae118927d18f14ecb8840ec6719932b79773c /src/bin/psql/command.c | |
parent | d39a49c1e459804831302807c724fa6512e90cf0 (diff) |
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/bin/psql/command.c')
-rw-r--r-- | src/bin/psql/command.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index 479f9f2be59..288c1a8c935 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -3882,6 +3882,7 @@ printSSLInfo(void) const char *protocol; const char *cipher; const char *compression; + const char *alpn; if (!PQsslInUse(pset.db)) return; /* no SSL */ @@ -3889,11 +3890,13 @@ printSSLInfo(void) protocol = PQsslAttribute(pset.db, "protocol"); cipher = PQsslAttribute(pset.db, "cipher"); compression = PQsslAttribute(pset.db, "compression"); + alpn = PQsslAttribute(pset.db, "alpn"); - printf(_("SSL connection (protocol: %s, cipher: %s, compression: %s)\n"), + printf(_("SSL connection (protocol: %s, cipher: %s, compression: %s, ALPN: %s)\n"), protocol ? protocol : _("unknown"), cipher ? cipher : _("unknown"), - (compression && strcmp(compression, "off") != 0) ? _("on") : _("off")); + (compression && strcmp(compression, "off") != 0) ? _("on") : _("off"), + alpn ? alpn : _("none")); } /* |