pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedGSSAPI authentication
6+ messages / 2 participants
[nested] [flat]
* GSSAPI authentication
@ 2022-06-06 12:05 Niels Jespersen <NJN@dst.dk>
0 siblings, 1 reply; 6+ messages in thread
From: Niels Jespersen @ 2022-06-06 12:05 UTC (permalink / raw)
To: pgsql-general list <pgsql-general@lists.postgresql.org>
Hello all
We are running Postgres 14 on Ubuntu. Our Windows users connect passwordless using GSSAPI. This works great.
Now we want users on Linux client to also connect passwordless using GSSAPI. Users on Linux log on using their Active Directory credentials, as the Linux host (Ubuntu 22.04) is joined to the domain. Logon to Linux works fine, access to Windows cifs shares works fine authentication with Kerberos.
But psql won't connect using GSSAPI. It does hit the right pg_hba.conf line and the username is translated via pg_ident.conf, just fine. But psql says
psql: error: connection to server at "srvpostgres4.xxx.local" (172.30.33.30), port 1609 failed: could not initiate GSSAPI security context: Unspecified GSS failure. Minor code may provide more information: Server not found in Kerberos database connection to server at "srvpostgres4.xxx.local" (172.30.33.30), port 1609 failed: GSSAPI continuation error: Unspecified GSS failure. Minor code may provide more information: Server not found in Kerberos database
Server log is like this
2022-06-06 08:14:01.176 CEST,"yyy","db1",474094,"172.30.32.213:33556",627e83c9.73bee,2,"authentication",2022-06-06 08:14:01 CEST,2/14544,0,FATAL,28000,"GSSAPI authentication failed for user ""yyy""","Connection matched pg_hba.conf line 15: ""host all all 172.0.0.0/8 gss map=xxxlocal include_realm=0 krb_realm=""XXX.LOCAL""""",,,,,,,,"","client backend",,-3382135431624836920
We are a bit lost here. What are we missing?
Regards Niels Jespersen
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: GSSAPI authentication
@ 2022-06-06 12:26 Michael van der Kolff <mvanderkolff@gmail.com>
parent: Niels Jespersen <NJN@dst.dk>
0 siblings, 2 replies; 6+ messages in thread
From: Michael van der Kolff @ 2022-06-06 12:26 UTC (permalink / raw)
To: Niels Jespersen <NJN@dst.dk>; +Cc: pgsql-general list <pgsql-general@lists.postgresql.org>
This sounds like your PG service was unable to authenticate itself to AD.
There's probably a trick to that somewhere - AD doesn't really want to be a
Kerberos server, it just happens to use it 😉
On Mon, 6 June 2022, 10:05 pm Niels Jespersen, <NJN@dst.dk> wrote:
> Hello all
>
>
>
> We are running Postgres 14 on Ubuntu. Our Windows users connect
> passwordless using GSSAPI. This works great.
>
>
>
> Now we want users on Linux client to also connect passwordless using
> GSSAPI. Users on Linux log on using their Active Directory credentials, as
> the Linux host (Ubuntu 22.04) is joined to the domain. Logon to Linux works
> fine, access to Windows cifs shares works fine authentication with
> Kerberos.
>
>
>
> But psql won't connect using GSSAPI. It does hit the right pg_hba.conf
> line and the username is translated via pg_ident.conf, just fine. But psql
> says
>
>
>
> psql: error: connection to server at "srvpostgres4.xxx.local"
> (172.30.33.30), port 1609 failed: could not initiate GSSAPI security
> context: Unspecified GSS failure. Minor code may provide more information:
> Server not found in Kerberos database connection to server at
> "srvpostgres4.xxx.local" (172.30.33.30), port 1609 failed: GSSAPI
> continuation error: Unspecified GSS failure. Minor code may provide more
> information: Server not found in Kerberos database
>
>
>
> Server log is like this
>
>
>
> 2022-06-06 08:14:01.176 CEST,"yyy","db1",474094,"172.30.32.213:33556",627e83c9.73bee,2,"authentication",2022-06-06
> 08:14:01 CEST,2/14544,0,FATAL,28000,"GSSAPI authentication failed for user
> ""yyy""","Connection matched pg_hba.conf line 15: ""host all
> all 172.0.0.0/8 gss map=xxxlocal include_realm=0
> krb_realm=""XXX.LOCAL""""",,,,,,,,"","client backend",,-3382135431624836920
>
>
>
> We are a bit lost here. What are we missing?
>
>
>
> Regards Niels Jespersen
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: GSSAPI authentication
@ 2022-06-06 13:01 Michael van der Kolff <mvanderkolff@gmail.com>
parent: Michael van der Kolff <mvanderkolff@gmail.com>
1 sibling, 0 replies; 6+ messages in thread
From: Michael van der Kolff @ 2022-06-06 13:01 UTC (permalink / raw)
To: Niels Jespersen <NJN@dst.dk>; +Cc: pgsql-general list <pgsql-general@lists.postgresql.org>
Looking closely at a configuration guide for MSSQL with Kerberos
authentication, I see this part:
https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/register-a-service-principal-....
It looks like it might be adapted to your question.
--Michael
On Mon, Jun 6, 2022 at 10:26 PM Michael van der Kolff <
mvanderkolff@gmail.com> wrote:
> This sounds like your PG service was unable to authenticate itself to AD.
>
> There's probably a trick to that somewhere - AD doesn't really want to be
> a Kerberos server, it just happens to use it 😉
>
> On Mon, 6 June 2022, 10:05 pm Niels Jespersen, <NJN@dst.dk> wrote:
>
>> Hello all
>>
>>
>>
>> We are running Postgres 14 on Ubuntu. Our Windows users connect
>> passwordless using GSSAPI. This works great.
>>
>>
>>
>> Now we want users on Linux client to also connect passwordless using
>> GSSAPI. Users on Linux log on using their Active Directory credentials, as
>> the Linux host (Ubuntu 22.04) is joined to the domain. Logon to Linux works
>> fine, access to Windows cifs shares works fine authentication with
>> Kerberos.
>>
>>
>>
>> But psql won't connect using GSSAPI. It does hit the right pg_hba.conf
>> line and the username is translated via pg_ident.conf, just fine. But psql
>> says
>>
>>
>>
>> psql: error: connection to server at "srvpostgres4.xxx.local"
>> (172.30.33.30), port 1609 failed: could not initiate GSSAPI security
>> context: Unspecified GSS failure. Minor code may provide more information:
>> Server not found in Kerberos database connection to server at
>> "srvpostgres4.xxx.local" (172.30.33.30), port 1609 failed: GSSAPI
>> continuation error: Unspecified GSS failure. Minor code may provide more
>> information: Server not found in Kerberos database
>>
>>
>>
>> Server log is like this
>>
>>
>>
>> 2022-06-06 08:14:01.176 CEST,"yyy","db1",474094,"172.30.32.213:33556",627e83c9.73bee,2,"authentication",2022-06-06
>> 08:14:01 CEST,2/14544,0,FATAL,28000,"GSSAPI authentication failed for user
>> ""yyy""","Connection matched pg_hba.conf line 15: ""host all
>> all 172.0.0.0/8 gss map=xxxlocal include_realm=0
>> krb_realm=""XXX.LOCAL""""",,,,,,,,"","client backend",,-3382135431624836920
>>
>>
>>
>> We are a bit lost here. What are we missing?
>>
>>
>>
>> Regards Niels Jespersen
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: GSSAPI authentication
@ 2022-06-06 13:41 Michael van der Kolff <mvanderkolff@gmail.com>
parent: Michael van der Kolff <mvanderkolff@gmail.com>
1 sibling, 1 reply; 6+ messages in thread
From: Michael van der Kolff @ 2022-06-06 13:41 UTC (permalink / raw)
To: Niels Jespersen <NJN@dst.dk>; +Cc: pgsql-general list <pgsql-general@lists.postgresql.org>
The part that you're missing, I think, is that Kerberized services require
a service account.
The SPN (service principal name) is the name that is used in Kerberos
contexts for that service account. PostgreSQL uses
postgres/${hostname}@${realm}
by default - see https://www.postgresql.org/docs/14/gssapi-auth.html.
The important part to note here is that $hostname must match what is
registered in the SPN for the user that you're using as the service account
in AD. It might (I don't know) have to match what AD believes about the
host from its PTR records for that domain as well.
--Michael
On Mon, Jun 6, 2022 at 11:33 PM Niels Jespersen <NJN@dst.dk> wrote:
> *Fra:* Michael van der Kolff <mvanderkolff@gmail.com>
> *Sendt:* 6. juni 2022 14:26
> *Til:* Niels Jespersen <NJN@dst.dk>
> *Cc:* pgsql-general list <pgsql-general@lists.postgresql.org>
> *Emne:* Re: GSSAPI authentication
>
>
>
> >This sounds like your PG service was unable to authenticate itself to AD.
>
> >
>
> >There's probably a trick to that somewhere - AD doesn't really want to be
> a Kerberos server, it just happens to use it 😉
>
>
>
> But it works fine when the same AD-user connects from Windows to the same
> postgres (Linux) server. Auth fails when the user initiates login from a
> Linux box (that otherwise uses Kerberized ressources just fine).
>
>
>
> Niels
>
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: GSSAPI authentication
@ 2022-06-06 13:42 Michael van der Kolff <mvanderkolff@gmail.com>
parent: Michael van der Kolff <mvanderkolff@gmail.com>
0 siblings, 1 reply; 6+ messages in thread
From: Michael van der Kolff @ 2022-06-06 13:42 UTC (permalink / raw)
To: Niels Jespersen <NJN@dst.dk>; +Cc: pgsql-general list <pgsql-general@lists.postgresql.org>
Oh wait, I see.
On Mon, Jun 6, 2022 at 11:41 PM Michael van der Kolff <
mvanderkolff@gmail.com> wrote:
> The part that you're missing, I think, is that Kerberized services require
> a service account.
>
> The SPN (service principal name) is the name that is used in Kerberos
> contexts for that service account. PostgreSQL uses postgres/${hostname}@${realm}
> by default - see https://www.postgresql.org/docs/14/gssapi-auth.html.
>
> The important part to note here is that $hostname must match what is
> registered in the SPN for the user that you're using as the service account
> in AD. It might (I don't know) have to match what AD believes about the
> host from its PTR records for that domain as well.
>
> --Michael
>
> On Mon, Jun 6, 2022 at 11:33 PM Niels Jespersen <NJN@dst.dk> wrote:
>
>> *Fra:* Michael van der Kolff <mvanderkolff@gmail.com>
>> *Sendt:* 6. juni 2022 14:26
>> *Til:* Niels Jespersen <NJN@dst.dk>
>> *Cc:* pgsql-general list <pgsql-general@lists.postgresql.org>
>> *Emne:* Re: GSSAPI authentication
>>
>>
>>
>> >This sounds like your PG service was unable to authenticate itself to AD.
>>
>> >
>>
>> >There's probably a trick to that somewhere - AD doesn't really want to
>> be a Kerberos server, it just happens to use it 😉
>>
>>
>>
>> But it works fine when the same AD-user connects from Windows to the same
>> postgres (Linux) server. Auth fails when the user initiates login from a
>> Linux box (that otherwise uses Kerberized ressources just fine).
>>
>>
>>
>> Niels
>>
>
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: GSSAPI authentication
@ 2022-06-06 13:49 Michael van der Kolff <mvanderkolff@gmail.com>
parent: Michael van der Kolff <mvanderkolff@gmail.com>
0 siblings, 0 replies; 6+ messages in thread
From: Michael van der Kolff @ 2022-06-06 13:49 UTC (permalink / raw)
To: Niels Jespersen <NJN@dst.dk>; +Cc: pgsql-general list <pgsql-general@lists.postgresql.org>
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2022-06-06 13:49 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-06-06 12:05 GSSAPI authentication Niels Jespersen <NJN@dst.dk>
2022-06-06 12:26 ` Michael van der Kolff <mvanderkolff@gmail.com>
2022-06-06 13:01 ` Michael van der Kolff <mvanderkolff@gmail.com>
2022-06-06 13:41 ` Michael van der Kolff <mvanderkolff@gmail.com>
2022-06-06 13:42 ` Michael van der Kolff <mvanderkolff@gmail.com>
2022-06-06 13:49 ` Michael van der Kolff <mvanderkolff@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox