Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eUDYI-0003MR-Vq for pgsql-general@arkaria.postgresql.org; Wed, 27 Dec 2017 15:23:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eUDYI-0006xE-Is for pgsql-general@arkaria.postgresql.org; Wed, 27 Dec 2017 15:23:30 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eUDYH-0006x1-Vr for pgsql-general@lists.postgresql.org; Wed, 27 Dec 2017 15:23:30 +0000 Received: from omr-m011e.mx.aol.com ([204.29.186.11]) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eUDYE-0004Jt-A5 for pgsql-general@lists.postgresql.org; Wed, 27 Dec 2017 15:23:27 +0000 Received: from mtaomg-aac01.mx.aol.com (mtaomg-aac01.mx.aol.com [172.27.2.35]) by omr-m011e.mx.aol.com (Outbound Mail Relay) with ESMTP id B9F9E38000EE; Wed, 27 Dec 2017 10:23:24 -0500 (EST) Received: from core-mex10d.mail.aol.com (core-mex10.mail.aol.com [10.73.18.5]) by mtaomg-aac01.mx.aol.com (OMAG/Core Interface) with ESMTP id 0226238000082; Wed, 27 Dec 2017 10:23:23 -0500 (EST) Received: from 68.10.102.85 by webjas-vab044.srv.aolmail.net (10.96.18.47) with HTTP (WebMailUI); Wed, 27 Dec 2017 10:23:21 -0500 Date: Wed, 27 Dec 2017 10:23:21 -0500 From: Mike Feld To: pg@fastcrypt.com, magnus@hagander.net Cc: pgsql-general@lists.postgresql.org Message-Id: <16098921fbd-1719-e1b@webjas-vab044.srv.aolmail.net> In-Reply-To: Subject: Re: psycopg2 and java gssapi questions MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_4600_2128056096.1514388201405" X-MB-Message-Source: WebUI X-MB-Message-Type: User X-Mailer: JAS STD X-Originating-IP: [68.10.102.85] x-aol-global-disposition: G DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mx.aol.com; s=20150623; t=1514388204; bh=cfwUdhKiEAzENZEkBXAEstk6w6NNlPHq0yudpFN79OA=; h=From:To:Subject:Message-Id:Date:MIME-Version:Content-Type; b=2OX9ovFItH8v2D8QuUDp5uxrh64oRfrUVNSo3mAN+2ETSXUTWHaOWtNk6x+/EQYXm 4wVWY3dolc9Cu17triZZyJaNzAZDEWEOEk8TJBmSSDWQrzVM3R3BuzbO+Fexi4Gc5A O0GNs5+Xj0asyOWtyLe9lqL2I36JdNq9cFPQqxjA= x-aol-sid: 3039ac1b02235a43baeb3433 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------=_Part_4600_2128056096.1514388201405 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable What about when the ticket expires? Are there any libraries that manage thi= s for the application? Is this common practice by anyone? Mike -----Original Message----- From: Dave Cramer To: Magnus Hagander Cc: Mike Feld ; pgsql-general Sent: Thu, Dec 21, 2017 6:09 am Subject: Re: psycopg2 and java gssapi questions On 21 December 2017 at 05:27, Magnus Hagander wrote: On Wed, Dec 20, 2017 at 8:42 PM, Mike Feld wrote: Is it possible to authenticate with Postgres from astandalone application u= sing gssapi? In other words, I am able to authenticatewith Postgres when a = human has logged in to either Windows or Linux andgenerated a ticket, but i= s it possible for say a Django site or Javaapplication running on some serv= er somewhere to authenticate with Postgresusing gssapi? I realize that psyc= opg2 has a connection parameter for =E2=80=9Ckrbsrvname=E2=80=9D,but how do= es it generate a ticket? Is this the only alternative to secure authenticat= ion since Postgres does not support secure ldap (ldaps)? Sure it is.=20 libpq won't generate the initial ticket, though. The way to do it is to hav= e your django or whatever application run "kinit" for the user before it st= arts. This will request a TGT, and the ticket will be present in that users= environment, and will be used by the libpq client. (it might look slightly= different for a Java client, but the principle is the same) JDBC docs on GSSAPI can be found https://jdbc.postgresql.org/documentation/= head/connect.html Dave Cramer davec@postgresintl.com www.postgresintl.com ------=_Part_4600_2128056096.1514388201405 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable What about when the ticket = expires? Are there any libraries that manage this for the application? Is t= his common practice by anyone?

Mike


-----= Original Message-----
From: Dave Cramer <pg@fastcrypt.com>
To: Magnus Hagander <magnus@hagander.net>
Cc: Mike Feld <m1f7@aol.com>; pgsql-general <pgsql-general@lists.p= ostgresql.org>
Sent: Thu, Dec 21, 2017 6:09 am
Subject: Re: psycopg2 and java gssapi questions

On 21 December 2017 at 05:27, Magnus Hag= ander <magnus@hagander.net> wrote:


On Wed, Dec 20, 2017 at 8:42 PM, Mike Fe= ld <m1f7@aol.com> wrote:
Is it possible to authenticate with = Postgres from a standalone application using gssapi? In other words, I am able to authentic= ate with Postgres when a human has logged in to either Windows or Linux and generated a ticket, but is it possible for say a Django site or Java application running on some server somewhere to authenticate with Postgres using gssapi? I realize that psycopg2 has a connection parameter for =E2=80= =9Ckrbsrvname=E2=80=9D, but how does it generate a ticket? Is this the only alternative to secure a= uthentication since Postgres does not support secure ldap (ldaps)?

Sure it is. 

libpq won't generate the initial ticket,= though. The way to do it is to have your django or whatever application ru= n "kinit" for the user before it starts. This will request a TGT, and the t= icket will be present in that users environment, and will be used by the li= bpq client. (it might look slightly different for a Java client, but the pr= inciple is the same)





------=_Part_4600_2128056096.1514388201405--