Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 4DCE9632B6E for ; Fri, 10 Sep 2010 05:15:15 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 23412-09 for ; Fri, 10 Sep 2010 08:15:07 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by mail.postgresql.org (Postfix) with ESMTP id BDB5263270E for ; Fri, 10 Sep 2010 05:15:07 -0300 (ADT) Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OtylE-0007i8-6j for pgsql-admin@postgresql.org; Fri, 10 Sep 2010 10:15:04 +0200 Received: from 217.31.70.82 ([217.31.70.82]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 10 Sep 2010 10:15:04 +0200 Received: from chris by 217.31.70.82 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 10 Sep 2010 10:15:04 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-admin@postgresql.org From: Christian Ullrich Subject: GSS authentication fails on Windows (replay cache issue?) Date: Fri, 10 Sep 2010 10:13:54 +0200 Lines: 42 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 217.31.70.82 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.9) Gecko/20100825 Thunderbird/3.1.3 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.746 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_NUMERIC_HELO=1.164, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201009/71 X-Sequence-Number: 35615 Hello all, I'm having a problem using GSS authentication with PostgreSQL 8.4.4 on a Windows 2008 server. I need GSSAPI instead of SSPI for the JDBC driver. We are using SSPI with the ODBC driver at the moment, and it works fine. The problem is this: For three days in a row now, I have tried changing the configuration to use GSSAPI instead of SSPI. I created a keytab, set it in postgresql.conf, restarted the service. Immediately after that, I could authenticate successfully, using both drivers and any applications we have (including psql, of course). The next morning, users arrived and began connecting to the server. Within an hour, GSSAPI authentication started to fail for every logon. Switching back to SSPI fixed this immediately. I think I have traced the problem back to a file called "postgres" in the service account's TEMP directory. This appears to be the Kerberos replay cache. I noticed that this file stopped changing (based on the modification time) at the same time GSS authentication stopped working. Instead, a number of temporary files started appearing in this directory, one for each failed logon. Process Explorer shows that the backend first reads the "postgres" file, then writes a temporary file. It then tries to delete the "postgres" file and fails with a "sharing violation". In other words, some other process still has the file opened, so it cannot be deleted. It also shows that each backend that used GSSAPI authentication has an open handle to the file. I tried closing these handles, on the theory that they must have been leaked (why would the Kerberos library need the replay cache once authentication has completed?), and as soon as I did, GSSAPI authentication started working again. What can I do to fix this? As far as I can tell, PostgreSQL already ships with libraries from the latest Kerberos for Windows release (even though KfW 3.2.2 is three years old by now). Thanks in advance for any help. -- Christian