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 1pTQ8Z-0003EE-EJ for pgsql-general@arkaria.postgresql.org; Sat, 18 Feb 2023 16:32:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pTQ8X-0000um-Hk for pgsql-general@arkaria.postgresql.org; Sat, 18 Feb 2023 16:32:33 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pTQ8X-0000tb-6f for pgsql-general@lists.postgresql.org; Sat, 18 Feb 2023 16:32:33 +0000 Received: from brisi.sourcepole.ch ([5.9.57.43]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pTQ8S-0004ah-Bq for pgsql-general@postgresql.org; Sat, 18 Feb 2023 16:32:32 +0000 Received: from [213.55.220.245] (helo=[192.168.43.81]) by vilan-mail with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1pTQ8Q-0003RQ-3B; Sat, 18 Feb 2023 17:32:27 +0100 Message-ID: <72f20dd9-2c0d-ebbe-0b33-49d3525d659a@sourcepole.ch> Date: Sat, 18 Feb 2023 17:32:23 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: can't get psql authentication against Active Directory working Content-Language: en-GB To: Erik Wienhold , pgsql-general@postgresql.org References: <08b836a7-272a-2309-da45-ac691fccacb8@sourcepole.ch> <1036920458.361352.1676736972050@office.mailbox.org> From: Tomas Pospisek In-Reply-To: <1036920458.361352.1676736972050@office.mailbox.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 18.02.23 17:16, Erik Wienhold wrote: >> On 18/02/2023 15:02 CET Tomas Pospisek 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