Problem with ssl and psql in Postgresql 13

Mikael Gustavsson <mikael.gustavsson@smhi.se>

From: Gustavsson Mikael <mikael.gustavsson@smhi.se>
To: "pgsql-general@postgresql.org" <pgsql-general@postgresql.org>
Cc: Svensson Peter <peter.svensson@smhi.se>
Date: 2020-12-17T07:21:08Z
Lists: pgsql-general
Hi,
We are starting our journey to migrate from Postgresql 11 to Postgresql 13 and have run into a problem.

The postgresql 13 version of psql don´t seem to work with ssl.
We use the community built rpms on redhat 8.3:

$ rpm -q postgresql11
postgresql11-11.10-1PGDG.rhel8.x86_64

$ rpm -q postgresql13
postgresql13-13.1-1PGDG.rhel8.x86_64

Is there some configuration we have missed that have changed between Postgresql 11 and 13?

Here is an example, sorry for the obfuscations.

It works as expected from psql 11:
$ psql -d postgres -Ukalle -hserver -W
Password:
psql (11.10, server 13.1)
WARNING: psql major version 11, server major version 13.
         Some psql features might not work.
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
Type "help" for help.

postgres=>

But not from psql 13:
$ /usr/pgsql-13/bin/psql -d postgres -Ukalle -hserver -W
Password:
psql: error: FATAL:  no pg_hba.conf entry for host "nnn.nn.n.nnn", user "kalle", database "postgres", SSL off
FATAL:  no pg_hba.conf entry for host "nnn.nn.n.nnn", user "kalle", database "postgres", SSL off


Our mean all-ssl test pg_hba.conf file:
# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     reject
# IPv4 local connections:
hostssl all             all             0.0.0.0/0                pam
# IPv6 local connections:
#host   all             all              ::1/128                 reject
# Allow replication connections from localhost, by a user with the
# replication privilege.
#host    replication          postgres                               reject


Kind Regards
Mikael Gustavsson, SMHI - Swedish Meteorological and Hydrological Institute

Commits

  1. Fix up usage of krb_server_keyfile GUC parameter.

  2. Improve log messages related to pg_hba.conf not matching a connection.

  3. Fix assorted issues in backend's GSSAPI encryption support.

  4. Fix bugs in libpq's GSSAPI encryption support.