Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nyCzt-0004eF-Eb for pgsql-general@arkaria.postgresql.org; Mon, 06 Jun 2022 13:42:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nyCzs-0004ZI-7x for pgsql-general@arkaria.postgresql.org; Mon, 06 Jun 2022 13:42:20 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nyCzr-0004Z7-PX for pgsql-general@lists.postgresql.org; Mon, 06 Jun 2022 13:42:19 +0000 Received: from mail-ot1-x32a.google.com ([2607:f8b0:4864:20::32a]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nyCzp-0007Ea-Aw for pgsql-general@lists.postgresql.org; Mon, 06 Jun 2022 13:42:18 +0000 Received: by mail-ot1-x32a.google.com with SMTP id e11-20020a9d6e0b000000b0060afcbafa80so10771971otr.3 for ; Mon, 06 Jun 2022 06:42:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uxkFCXxDnLhc22pAg0V+jRaZTm9sY7CgjJER8mDDZmg=; b=oF7SqmnH+L+rtvtL1oPhyPBMttDeZAkOYvTl4H3mXl4T/XSakioybA5HShzUJgYxDt S9SuCOxBSgWMy4V/byOK+ae1jAXIYbLDMQHkPDblCBjSEeiu+GqZveXjnhWerFmMS5dT Fdym0uBG31HBLhUmCzuLIf30SuBGp01EPoi99hZqWamlw+IEQs4fwFqcPdrk5ypt0Dc2 ICapUgL5Wro25TSp3WSJACxAjKNQdeAMDb54Q6fyXdRvWXt9RGcXChxyduesWObzgdFW OYwDJ+CG9TRaoSdh1w+ukcIw8EmEf4t37RtXzU1NgvX6zRUZoAOrN8X1kfDiNnnpJsuT yqcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uxkFCXxDnLhc22pAg0V+jRaZTm9sY7CgjJER8mDDZmg=; b=c4Gj++oSkDp4hOQRvo0vS4EWqU95399LADkry669XHkO41Oi/MTMmCKT4x6D9ae0iB 97g5x6x/Fuxe5UyZ+zn8MiYABNfQPU6t28+3LUKqH4NnP1+Dc9R38B7pC6Ui2+ByZG3K YdfpoNXEGOZssFqTOp+zHsgKLu0zRXBMf3O48KZi4Sc2nxHHwyA1ynOVu75pezXvMMTV 0rdD9EbsgdtiH50BenQAF5Un20y7GatOpC9LFTHaAYCTUh9p+w59qXxuquCsTrKzN5Wp TbY7fMSpBwsKJh5ZP9dmJlDbPKcDGUVDcFRLzbM76Y8D+ZipsvEXbWWz0rBzLNZxx3ZL VDHw== X-Gm-Message-State: AOAM532xo589zygZMoJRcJCjdh3BJj61QJtsTkQuxLf6v49pEK95/giL MMZNwx8DcZ8DbLIp6k9T05cbpEg34wZ0jVipM2cWtXmB X-Google-Smtp-Source: ABdhPJwyV5iuJzLSASXTmwEbkjqwLeaF3okNkl9vqQEs+8DrW2O3FxuFOJbmFTgmEWAU/ra0NBySF1N3cL82wf4yyHA= X-Received: by 2002:a9d:5e91:0:b0:605:df49:462 with SMTP id f17-20020a9d5e91000000b00605df490462mr10467879otl.228.1654522936832; Mon, 06 Jun 2022 06:42:16 -0700 (PDT) MIME-Version: 1.0 References: <9f1254f4ffc24460a3c0ba34f062f33e@dst.dk> <02f8b9de128f49078c4eb2af1e5438c2@dst.dk> In-Reply-To: From: Michael van der Kolff Date: Mon, 6 Jun 2022 23:42:06 +1000 Message-ID: Subject: Re: GSSAPI authentication To: Niels Jespersen Cc: pgsql-general list Content-Type: multipart/alternative; boundary="000000000000ec3a8005e0c7a309" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000ec3a8005e0c7a309 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 requir= e > 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 accou= nt > 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 wrote: > >> *Fra:* Michael van der Kolff >> *Sendt:* 6. juni 2022 14:26 >> *Til:* Niels Jespersen >> *Cc:* pgsql-general list >> *Emne:* Re: GSSAPI authentication >> >> >> >> >This sounds like your PG service was unable to authenticate itself to A= D. >> >> > >> >> >There's probably a trick to that somewhere - AD doesn't really want to >> be a Kerberos server, it just happens to use it =F0=9F=98=89 >> >> >> >> But it works fine when the same AD-user connects from Windows to the sam= e >> postgres (Linux) server. Auth fails when the user initiates login from a >> Linux box (that otherwise uses Kerberized ressources just fine). >> >> >> >> Niels >> > --000000000000ec3a8005e0c7a309 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
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 Ker= berized services require a service account.

The SPN (service princip= al name) is the name that is used in Kerberos contexts for that service acc= ount. PostgreSQL uses postgres/${hostname}@${realm} by default - see=C2=A0<= a href=3D"https://www.postgresql.org/docs/14/gssapi-auth.html" target=3D"_b= lank">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 ac= count in AD. It might (I don't know) have to match what AD believes abo= ut 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

=C2=A0

>This sounds like your PG se= rvice was unable to authenticate itself to AD.

>=C2=A0=

>There's probably a tric= k to that somewhere - AD doesn't really want to be a Kerberos server, i= t just happens to use it = =F0=9F=98=89

=C2=A0

But it works fine when the same AD-user connects fro= m Windows to the same postgres (Linux) server. Auth fails when the user ini= tiates login from a Linux box (that otherwise uses Kerberized ressources just fine).

=C2=A0

Niels

--000000000000ec3a8005e0c7a309--