This is a Postgres environment, there are GSSAPI credentials present (i.e., in a credentials cache) for this user and there are also valid SSL certs for this user so both connections would work but the customer wants SSL for this particular user for security reasons.
GSS connection is accepted and SSL is ignored even though the SSL Line in the pg_hba.conf is above GSS and SSL is enabled on the connecting host.
pg_hba.conf is parsed from the top down and the first record with a matching connection type, client address, requested database, and user name is used to perform authentication. There is no “fall-through” or “backup”: if one record is chosen and the authentication fails, subsequent records are not considered. If no record matches, access is denied.
In this case, the first valid line is SSL-enabled
- hostssl all user1 0.0.0.0/0 cert map=user1_cert
- host all all 0.0.0.0/0 gss krb_realm=GPDB.KRB
If the client connects from an SSL-enabled host the first line of the pg_hba.conf should be used and the client should be granted access with SSL but in this case, this does not occur, please see the example connection string and resulting connection method.
/opt/vmware/postgres/14/bin/psql "host=xxx dbname=postgres port=xxx sslcert=/xx/user1.crt sslkey=/xx/user1.key sslmode=require"
psql (14.9 (VMware Postgres 14.9.0))
GSSAPI-encrypted connection. <------------GSS connection not SSL as expected.
Type "help" for help.
There is nothing in the logs to show that there was a problem with SSL, the GSS connection just seems to be preferred.