Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eRysk-0002AE-J6 for pgsql-general@arkaria.postgresql.org; Thu, 21 Dec 2017 11:19:22 +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 1eRysk-0008Ha-6n for pgsql-general@arkaria.postgresql.org; Thu, 21 Dec 2017 11:19:22 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eRysj-0008HR-Vh for pgsql-general@lists.postgresql.org; Thu, 21 Dec 2017 11:19:22 +0000 Received: from tamriel.snowman.net ([96.255.250.162]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1eRysc-0004b0-LD for pgsql-general@lists.postgresql.org; Thu, 21 Dec 2017 11:19:21 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 64CA45F795; Thu, 21 Dec 2017 06:19:13 -0500 (EST) Date: Thu, 21 Dec 2017 06:19:13 -0500 From: Stephen Frost To: Magnus Hagander Cc: Mike Feld , pgsql-general@lists.postgresql.org Subject: Re: psycopg2 and java gssapi questions Message-ID: <20171221111913.GY4628@tamriel.snowman.net> References: <160757340e8-171c-3009@webjas-vae222.srv.aolmail.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ov42WxB/g1ORyBXY" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --ov42WxB/g1ORyBXY Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Magnus, Mike, * Magnus Hagander (magnus@hagander.net) wrote: > On Wed, Dec 20, 2017 at 8:42 PM, Mike Feld wrote: >=20 > > Is it possible to authenticate with Postgres from a standalone applicat= ion > > using gssapi? In other words, I am able to authenticate with Postgres w= hen > > 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 rea= lize > > 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 authentication > > since Postgres does not support secure ldap (ldaps)? >=20 > Sure it is. Yup. > libpq won't generate the initial ticket, though. The way to do it is to > have your django or whatever application run "kinit" for the user before = it > starts. 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) You would actually want to use a keytab and then kstart/k5start to make sure that you've always got a valid ticket. Just doing a kinit would mean that the TGT will eventually expire and cause connections to fail. Thanks! Stephen --ov42WxB/g1ORyBXY Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJaO5iwAAoJEO1sijiDR2RVrckP/RVOVZIS9csjqXuTHtl0gJJH 2HsT9kAquY9QFb6MS/vIfop6+z2CfW8ev2OMK+z+PUpTxJPQTTlRzVIxrVN5lbpR okwZPvLmXLnuep73OireWK1uAejUFrsYNJ3J0fI1wI36QxMG9qHa6NbwKg4955lO +w96p1HIycXIJlqajrOW0/WX6yywXC/TFkSehi8ZWNAkKHAfcwtRDTsJEjcR1fLo B2QkIsaL9EOLu+vjQmPm49gdvkHfMLL4NJusaceRAMB0tOSxNVtb6FbeP7HlH3Bc UId6kcOvtEAEnNNCnIID9yz0StJOW6i2FbU8IZJd6DEOgGj0PceccHjLn25pYf+/ 6Z4el2D3m3a5JDRUVconEk+OIQ3B6SCeEefkwV6TKqGGtpiQW4WWTMlIGntvDe+4 i3KUMuVlia9vhdJt9yX8POpBOTzCLz69vCpK2bBz/GsYEpYeGKpjZBH/+4m4E8Sf WF4Yjx/a79COhy3yqy0eEpsL7iFjaT0lR9OsqAs/Z4Rdb+gSuCo9gg6EmzrfWNdA n5yBkSdjZ7CnceURCpk0JgAMUKRhySzP+2HJAyKxUTf0dSGCI++kcdEwobUURW7X hW5VMHnq4lsOEfWFnLVcuBKjm/HZJ5lC/GDRRByAlCl/aS31V5ebhaba11V5A6UM DWL2OK6ebvEK6s+w3Pza =Z7BV -----END PGP SIGNATURE----- --ov42WxB/g1ORyBXY--