pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedClient Certificate Authentication
5+ messages / 5 participants
[nested] [flat]
* Client Certificate Authentication
@ 2013-03-15 17:21 "Gabriel E. Sánchez Martínez" <gabrielesanchez@gmail.com>
0 siblings, 2 replies; 5+ messages in thread
From: "Gabriel E. Sánchez Martínez" @ 2013-03-15 17:21 UTC (permalink / raw)
To: pgsql-jdbc
I have a PostgreSQL database on a server. For security reasons, all
client access from outside the server is restricted to certificate mode,
i.e. the client sends SSL certificates rather than a password.
Connecting with pgAdmin works well. Is there a way of creating a Java
application that connects to this database with certificates? Any
how-to guides, examples, or pointers on how to achieve this?
Thanks in advance.
-Gabriel
--
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Client Certificate Authentication
@ 2013-03-15 18:32 Dave Cramer <pg@fastcrypt.com>
parent: "Gabriel E. Sánchez Martínez" <gabrielesanchez@gmail.com>
1 sibling, 2 replies; 5+ messages in thread
From: Dave Cramer @ 2013-03-15 18:32 UTC (permalink / raw)
To: Gabriel E. Sánchez Martínez <gabrielesanchez@gmail.com>; +Cc: pgsql-jdbc
To my knowledge this has not been implemented.
Dave Cramer
dave.cramer(at)credativ(dot)ca
http://www.credativ.ca
On Fri, Mar 15, 2013 at 1:21 PM, "Gabriel E. Sánchez Martínez" <
gabrielesanchez@gmail.com> wrote:
> I have a PostgreSQL database on a server. For security reasons, all
> client access from outside the server is restricted to certificate mode,
> i.e. the client sends SSL certificates rather than a password. Connecting
> with pgAdmin works well. Is there a way of creating a Java application
> that connects to this database with certificates? Any how-to guides,
> examples, or pointers on how to achieve this?
>
> Thanks in advance.
>
> -Gabriel
>
>
> --
> Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/**mailpref/pgsql-jdbc<http://www.postgresql.org/mailpref/pgsql-jdbc;
>
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Client Certificate Authentication
@ 2013-03-15 18:48 Heikki Linnakangas <hlinnakangas@vmware.com>
parent: Dave Cramer <pg@fastcrypt.com>
1 sibling, 0 replies; 5+ messages in thread
From: Heikki Linnakangas @ 2013-03-15 18:48 UTC (permalink / raw)
To: Dave Cramer <pg@fastcrypt.com>; +Cc: "Gabriel E. Sánchez Martínez" <gabrielesanchez@gmail.com>; pgsql-jdbc
On 15.03.2013 20:32, Dave Cramer wrote:
> To my knowledge this has not been implemented.
I haven't tried it myself, but I think it should work if you get all the
t's crossed and i's dotted. See
http://www.postgresql.org/message-id/4C0712E6.1050002@postnewspapers.com.au,
for example.
- Heikki
--
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Client Certificate Authentication
@ 2013-03-15 22:45 Ian Pilcher <arequipeno@gmail.com>
parent: Dave Cramer <pg@fastcrypt.com>
1 sibling, 0 replies; 5+ messages in thread
From: Ian Pilcher @ 2013-03-15 22:45 UTC (permalink / raw)
To: pgsql-jdbc
On 03/15/2013 01:32 PM, Dave Cramer wrote:
> To my knowledge this has not been implemented.
It should be possible with a custom SSLSocketFactory. See
http://jdbc.postgresql.org/documentation/head/ssl-factory.html.
(You'll need to load your client into a KeyStore, pass that KeyStore to
SSLContext.init(), and use that context to create your factories.)
HTH
--
========================================================================
Ian Pilcher arequipeno@gmail.com
Sometimes there's nothing left to do but crash and burn...or die trying.
========================================================================
--
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Client Certificate Authentication
@ 2013-03-19 11:46 Craig Ringer <craig@2ndquadrant.com>
parent: "Gabriel E. Sánchez Martínez" <gabrielesanchez@gmail.com>
1 sibling, 0 replies; 5+ messages in thread
From: Craig Ringer @ 2013-03-19 11:46 UTC (permalink / raw)
To: "Gabriel E. Sánchez Martínez" <gabrielesanchez@gmail.com>; +Cc: pgsql-jdbc
On 03/16/2013 01:21 AM, "Gabriel E. Sánchez Martínez" wrote:
> I have a PostgreSQL database on a server. For security reasons, all
> client access from outside the server is restricted to certificate
> mode, i.e. the client sends SSL certificates rather than a password.
> Connecting with pgAdmin works well. Is there a way of creating a Java
> application that connects to this database with certificates? Any
> how-to guides, examples, or pointers on how to achieve this?
In most cases you can set the JSEE keystore and truststore properties to
get Java to use an existing keystore and truststore with your private
key and the server's public certificate installed. In particular, see:
http://docs.oracle.com/javase/6/docs/technotes/guides/security/jsse/JSSERefGuide.html#CustomizingSto...
The keystore must be in JECKS format. You can create it with keytool.
Import the user's client certificate into it; you'll most likely have a
pkcs#12 format cert (.p12 file) but you might instead have separate PEM
format key and certs.
The truststore is optional and may be in JKS format if provided. If you
don't provide a truststore the system wide SSL root certificate trust
store for Java is used. That's fine unless your server is using a
self-signed cert for the server, in which case you'll want to either add
your private CA cert to the system truststore or specify your own
truststore as a jvm system property.
If you cannot use the system properties for whatever reason then you
need to provide your own SSLSocketFactory that uses the JSSE APIs to
load a keystore and truststore.
--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2013-03-19 11:46 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-03-15 17:21 Client Certificate Authentication "Gabriel E. Sánchez Martínez" <gabrielesanchez@gmail.com>
2013-03-15 18:32 ` Dave Cramer <pg@fastcrypt.com>
2013-03-15 18:48 ` Heikki Linnakangas <hlinnakangas@vmware.com>
2013-03-15 22:45 ` Ian Pilcher <arequipeno@gmail.com>
2013-03-19 11:46 ` Craig Ringer <craig@2ndquadrant.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