pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Craig Ringer <craig@postnewspapers.com.au>
To: Eric Jain <eric.jain@gmail.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: How to ensure that SSL is enabled?
Date: Tue, 20 Oct 2009 11:45:32 +0800
Message-ID: <1256010332.6437.74.camel@wallace.localnet> (raw)
In-Reply-To: <e48479d40910191731y37028537kd239b310a142fd22@mail.gmail.com>
References: <e48479d40910191731y37028537kd239b310a142fd22@mail.gmail.com>

On Mon, 2009-10-19 at 17:31 -0700, Eric Jain wrote:

> I've appended ?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory
> to the connection URL, but (looking at the network traffic) no
> encryption appears to be done. Shouldn't the connection fail if no SSL
> connection can be established? It's possible that the server isn't set
> up properly; is there a simple way to test that (e.g. verify that the
> server was compiled with SSL support etc)?
> 


It looks like on the JDBC side is mostly handled via custom SSLFactory
classes. There's been discussion of making the "ssl" param take a string
value, allowing more control over behaviour:

http://archives.free.net.ph/message/20070706.205109.cdd3ca05.en.html

... but I don't know if much ever came of it.

Personally, I handle this on the server side in pg_hba.conf . For
Internet users (0.0.0.0/0 IP/mask), I use "hostssl" entries rather than
simple "host" entries, so the pg_hba.conf entry only matches for SSL
connections. If they're not using SSL, the server won't let them try
password auth because there's no pg_hba.conf entry that'd permit them to
do so.

eg:

    hostssl    somedatabase    all    0.0.0.0/0    md5

--
Craig Ringer

view thread (5+ messages)  latest in thread

Message-ID: <1256010332.6437.74.camel@wallace.localnet>
Permalink:  ../1256010332.6437.74.camel@wallace.localnet/
Also on:    postgresql.org/message-id/1256010332.6437.74.camel@wallace.localnet

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: craig@postnewspapers.com.au, eric.jain@gmail.com
  Subject: Re: How to ensure that SSL is enabled?
  In-Reply-To: <1256010332.6437.74.camel@wallace.localnet>
  References: <e48479d40910191731y37028537kd239b310a142fd22@mail.gmail.com> <1256010332.6437.74.camel@wallace.localnet>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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