pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Pospisek <tpo2@sourcepole.ch>
To: Erik Wienhold <ewie@ewie.name>
To: pgsql-general@postgresql.org
Subject: Re: can't get psql authentication against Active Directory working
Date: Sat, 18 Feb 2023 17:32:23 +0100
Message-ID: <72f20dd9-2c0d-ebbe-0b33-49d3525d659a@sourcepole.ch> (raw)
In-Reply-To: <1036920458.361352.1676736972050@office.mailbox.org>
References: <08b836a7-272a-2309-da45-ac691fccacb8@sourcepole.ch>
	<1036920458.361352.1676736972050@office.mailbox.org>

On 18.02.23 17:16, Erik Wienhold wrote:
>> On 18/02/2023 15:02 CET Tomas Pospisek <tpo2@sourcepole.ch> wrote:
>>
>> so I'm trying to authenticate psql (on Windows) -> postgres (on Linux)
>> via Active Directory.
>>
>> psql (Linux) -> postgres (Linux) with authentication against Active
>> Directory does work.
>>
>> However the same with psql.exe on Windows does not. I get:
>>
>>       D:\>C:\OSGeo4W\bin\psql.exe service=the_db
>>       psql: error: connection to server at "dbserver.example.lan
>>       (192.168.4.104), port 5432 failed: could not initiate GSSAPI
>>       security context: No credentials were supplied, or the credentials
>>       were unavailable or inaccessible: Internal credentials cache error
>>
>> psql.exe from the OSGeo4W QGIS Installer *does* include GSS support. (I
>> have tried with a different psql.exe without GSS support and it would
>> tell me that it does not support GSS).
>>
>> The .pg_service.conf file in the users $HOME directory looks like this:
>>
>>       [the_db]
>>       host=dbserver.example.lan
>>       port=5432
>>       user=user@EXAMPLE.LAN
>>       gssencmode=require
>>
>> This same pg_service.conf does work for psql (Linux).
> 
> On Windows the service file is not read from $home/.pg_service.conf but
> $env:appdata/postgresql/.pg_service.conf (or %appdata%/postgresql/.pg_service.conf
> when using cmd.exe.)

Thank you Erik,

the location of the .pg_service.conf file is not the problem, as I am 
seeing that psql.exe is reacting to its contents, that is authenticating 
differently depending on whether gssencmode is set or not (maybe I noted 
its location wrongly, since i've written the post from my notes, as I do 
not have access to the machines in question all the time).

Do you have authentication from psql.exe against Active Directory working?
*t





view thread (10+ messages)  latest in thread

Message-ID: <72f20dd9-2c0d-ebbe-0b33-49d3525d659a@sourcepole.ch>
Permalink:  ../72f20dd9-2c0d-ebbe-0b33-49d3525d659a@sourcepole.ch/
Also on:    postgresql.org/message-id/72f20dd9-2c0d-ebbe-0b33-49d3525d659a@sourcepole.ch

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tpo2@sourcepole.ch, ewie@ewie.name
  Subject: Re: can't get psql authentication against Active Directory working
  In-Reply-To: <72f20dd9-2c0d-ebbe-0b33-49d3525d659a@sourcepole.ch>
  References: <08b836a7-272a-2309-da45-ac691fccacb8@sourcepole.ch> <1036920458.361352.1676736972050@office.mailbox.org> <72f20dd9-2c0d-ebbe-0b33-49d3525d659a@sourcepole.ch>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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