I'm trying to setup kerberos auth between my lab RHEL PSQL 13 and my AD with some success unless I try to configure user maps in pg_ident.conf as documented.
My psql user is user and my AD user is [email protected]. The later is used to connect by the users and the former is how users are defined in the DB. I need to strip the domain to match correctly with psql users.
The AD user has the machine SPN configured and the keytab has been set in psql configuration.
pg_hba.conf file:
# TYPE DATABASE USER ADDRESS METHOD
host all all 0.0.0.0/0 gss include_realm=1 krb_realm=DOMAIN.COM map=ad
pg_ident.conf file:
# MAPNAME SYSTEM-USERNAME PG-USERNAME
ad /^(.*)@DOMAIN\.COM$ \1
ad /^(.*)@domain\.com$ \1
Now when I try to connect using kerberos auth with [email protected], in pgAdmin4 for example, it fails with the following in the psql logs:
LOG: no match in usermap "ad" for user "[email protected]" authenticated as "[email protected]"
FATAL: GSSAPI authentication failed for user "[email protected]"
DETAIL: Connection matched pg_hba.conf line 99: "host all all 0.0.0.0/0 gss include_realm=1 krb_realm=DOMAIN.COM map=ad"
If I set configure the pg_hba.conf as below instead and connect using user without the domain, I can connect just fine.
pg_hba.conf file:
# TYPE DATABASE USER ADDRESS METHOD
host all all 0.0.0.0/0 gss include_realm=0 krb_realm=DOMAIN.COM
What am I doing wrong here? Why aren't users mapping? I'm on RHEL8 running PSQL 13.