pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
psycopg2 and java gssapi questions
8+ messages / 6 participants
[nested] [flat]

* psycopg2 and java gssapi questions
@ 2017-12-20 19:42 Mike Feld <m1f7@aol.com>
  2017-12-20 20:20 ` Re: psycopg2 and java gssapi questions basti <mailinglist@unix-solution.de>
  2017-12-21 06:51 ` Re: psycopg2 and java gssapi questions Achilleas Mantzios <achill@matrix.gatewaynet.com>
  2017-12-21 10:27 ` Re: psycopg2 and java gssapi questions Magnus Hagander <magnus@hagander.net>
  0 siblings, 3 replies; 8+ messages in thread

From: Mike Feld @ 2017-12-20 19:42 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org


Is it possible to authenticate with Postgres from astandalone application using 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 is it possible for say a Django site or Javaapplication running on some server somewhere to authenticate with Postgresusing gssapi? I realize that psycopg2 has a connection parameter for “krbsrvname”,but how does it generate a ticket? Is this the only alternative to secure authentication since Postgres does not support secure ldap (ldaps)?

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: psycopg2 and java gssapi questions
  2017-12-20 19:42 psycopg2 and java gssapi questions Mike Feld <m1f7@aol.com>
@ 2017-12-20 20:20 ` basti <mailinglist@unix-solution.de>
  2 siblings, 0 replies; 8+ messages in thread

From: basti @ 2017-12-20 20:20 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

Hello,
have a look at

https://www.postgresql.org/docs/current/static/auth-methods.html

There are details about LDAP and GSSAPI.

On 20.12.2017 20:42, Mike Feld wrote:
> Is it possible to authenticate with Postgres from a standalone
> application using gssapi? In other words, I am able to authenticate 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 “krbsrvname”, but how does it generate a ticket? Is this
> the only alternative to secure authentication since Postgres does not
> support secure ldap (ldaps)?




^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: psycopg2 and java gssapi questions
  2017-12-20 19:42 psycopg2 and java gssapi questions Mike Feld <m1f7@aol.com>
@ 2017-12-21 06:51 ` Achilleas Mantzios <achill@matrix.gatewaynet.com>
  2 siblings, 0 replies; 8+ messages in thread

From: Achilleas Mantzios @ 2017-12-21 06:51 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

On 20/12/2017 21:42, Mike Feld wrote:
> Is this the only alternative to secure authentication since Postgres does not support secure ldap (ldaps)?

Have you checked out : |ldaptls||| parameter ? https://www.postgresql.org/docs/10/static/auth-methods.html#AUTH-LDAP

-- 
Achilleas Mantzios
IT DEV Lead
IT DEPT
Dynacom Tankers Mgmt

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: psycopg2 and java gssapi questions
  2017-12-20 19:42 psycopg2 and java gssapi questions Mike Feld <m1f7@aol.com>
@ 2017-12-21 10:27 ` Magnus Hagander <magnus@hagander.net>
  2017-12-21 11:08   ` Re: psycopg2 and java gssapi questions Dave Cramer <pg@fastcrypt.com>
  2017-12-21 11:19   ` Re: psycopg2 and java gssapi questions Stephen Frost <sfrost@snowman.net>
  2 siblings, 2 replies; 8+ messages in thread

From: Magnus Hagander @ 2017-12-21 10:27 UTC (permalink / raw)
  To: Mike Feld <m1f7@aol.com>; +Cc: pgsql-general@lists.postgresql.org

On Wed, Dec 20, 2017 at 8:42 PM, Mike Feld <m1f7@aol.com> wrote:

> Is it possible to authenticate with Postgres from a standalone application
> using gssapi? In other words, I am able to authenticate 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 “krbsrvname”, but how does it
> generate a ticket? Is this the only alternative to secure authentication
> 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 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)

-- 
 Magnus Hagander
 Me: https://www.hagander.net/ <http://www.hagander.net/;
 Work: https://www.redpill-linpro.com/ <http://www.redpill-linpro.com/;

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: psycopg2 and java gssapi questions
  2017-12-20 19:42 psycopg2 and java gssapi questions Mike Feld <m1f7@aol.com>
  2017-12-21 10:27 ` Re: psycopg2 and java gssapi questions Magnus Hagander <magnus@hagander.net>
@ 2017-12-21 11:08   ` Dave Cramer <pg@fastcrypt.com>
  2017-12-27 15:23     ` Re: psycopg2 and java gssapi questions Mike Feld <m1f7@aol.com>
  1 sibling, 1 reply; 8+ messages in thread

From: Dave Cramer @ 2017-12-21 11:08 UTC (permalink / raw)
  To: Magnus Hagander <magnus@hagander.net>; +Cc: Mike Feld <m1f7@aol.com>; pgsql-general@lists.postgresql.org

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

>
>
> On Wed, Dec 20, 2017 at 8:42 PM, Mike Feld <m1f7@aol.com> wrote:
>
>> Is it possible to authenticate with Postgres from a standalone
>> application using gssapi? In other words, I am able to authenticate 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
>> “krbsrvname”, but how does it generate a ticket? Is this the only
>> alternative to secure authentication 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 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)
>
>
JDBC docs on GSSAPI can be found
https://jdbc.postgresql.org/documentation/head/connect.html


Dave Cramer

davec@postgresintl.com
www.postgresintl.com

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: psycopg2 and java gssapi questions
  2017-12-20 19:42 psycopg2 and java gssapi questions Mike Feld <m1f7@aol.com>
  2017-12-21 10:27 ` Re: psycopg2 and java gssapi questions Magnus Hagander <magnus@hagander.net>
  2017-12-21 11:08   ` Re: psycopg2 and java gssapi questions Dave Cramer <pg@fastcrypt.com>
@ 2017-12-27 15:23     ` Mike Feld <m1f7@aol.com>
  0 siblings, 0 replies; 8+ messages in thread

From: Mike Feld @ 2017-12-27 15:23 UTC (permalink / raw)
  To: pg@fastcrypt.com; magnus@hagander.net; +Cc: pgsql-general@lists.postgresql.org

What about when the ticket expires? Are there any libraries that manage this for the application? Is this 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.postgresql.org>
Sent: Thu, Dec 21, 2017 6:09 am
Subject: Re: psycopg2 and java gssapi questions




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





On Wed, Dec 20, 2017 at 8:42 PM, Mike Feld <m1f7@aol.com> wrote:

Is it possible to authenticate with Postgres from astandalone application using 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 is it possible for say a Django site or Javaapplication running on some server somewhere to authenticate with Postgresusing gssapi? I realize that psycopg2 has a connection parameter for “krbsrvname”,but how does it generate a ticket? Is this the only alternative to secure authentication 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 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)







JDBC docs on GSSAPI can be found https://jdbc.postgresql.org/documentation/head/connect.html





Dave Cramer

davec@postgresintl.com
www.postgresintl.com

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: psycopg2 and java gssapi questions
  2017-12-20 19:42 psycopg2 and java gssapi questions Mike Feld <m1f7@aol.com>
  2017-12-21 10:27 ` Re: psycopg2 and java gssapi questions Magnus Hagander <magnus@hagander.net>
@ 2017-12-21 11:19   ` Stephen Frost <sfrost@snowman.net>
  1 sibling, 0 replies; 8+ messages in thread

From: Stephen Frost @ 2017-12-21 11:19 UTC (permalink / raw)
  To: Magnus Hagander <magnus@hagander.net>; +Cc: Mike Feld <m1f7@aol.com>; pgsql-general@lists.postgresql.org

Magnus, Mike,

* Magnus Hagander (magnus@hagander.net) wrote:
> On Wed, Dec 20, 2017 at 8:42 PM, Mike Feld <m1f7@aol.com> wrote:
> 
> > Is it possible to authenticate with Postgres from a standalone application
> > using gssapi? In other words, I am able to authenticate 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 “krbsrvname”, but how does it
> > generate a ticket? Is this the only alternative to secure authentication
> > since Postgres does not support secure ldap (ldaps)?
> 
> 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

Attachments:

  signature.asc (application/pgp-signature, 818B) download

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: psycopg2 and java gssapi questions
@ 2017-12-20 21:16 Mike Feld <m1f7@aol.com>
  0 siblings, 0 replies; 8+ messages in thread

From: Mike Feld @ 2017-12-20 21:16 UTC (permalink / raw)
  To: mailinglist@unix-solution.de; +Cc: pgsql-general@lists.postgresql.org



This shows you how to setup GSSAPI authentication server side, which I have already done and have working. My question is from client side, without a human logged in to generate the ticket.
>>Hello,
>>have a look at

>>https://www.postgresql.org/docs/current/static/auth-methods.html

>>There are details about LDAP and GSSAPI.

>>On 20.12.2017 20:42, Mike F wrote:
>>> Is it possible to authenticate with Postgres from a standalone
>>> application using gssapi? In other words, I am able to authenticate 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 “krbsrvname”, but how does it generate a ticket? Is this
>>> the only alternative to secure authentication since Postgres does not
>>> support secure ldap (ldaps)?

^ permalink  raw  reply  [nested|flat] 8+ messages in thread


end of thread, other threads:[~2017-12-27 15:23 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-12-20 19:42 psycopg2 and java gssapi questions Mike Feld <m1f7@aol.com>
2017-12-20 20:20 ` basti <mailinglist@unix-solution.de>
2017-12-21 06:51 ` Achilleas Mantzios <achill@matrix.gatewaynet.com>
2017-12-21 10:27 ` Magnus Hagander <magnus@hagander.net>
2017-12-21 11:08   ` Dave Cramer <pg@fastcrypt.com>
2017-12-27 15:23     ` Mike Feld <m1f7@aol.com>
2017-12-21 11:19   ` Stephen Frost <sfrost@snowman.net>
2017-12-20 21:16 Re: psycopg2 and java gssapi questions Mike Feld <m1f7@aol.com>

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