pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stefan Verkoyen <stefan.verkoyen@quesd.com>
To: pgsql-jdbc@postgresql.org
Subject: Re: do XA connections support SSL?
Date: Thu, 06 Apr 2006 10:04:17 +0200
Message-ID: <4434CB81.8000909@quesd.com> (raw)
In-Reply-To: <Pine.BSO.4.63.0604051306260.18112@leary2.csoft.net>
References: <4433D6EB.8000702@quesd.com>
	<Pine.BSO.4.63.0604051306260.18112@leary2.csoft.net>

Kris,

thanks for your comments. I decided to try to patch the XA datasource 
code. Luckily the datasource relies heavily on the pgjdbc driver which 
already supports SSL. I'm no pgjdbc expert so I might have done 
something wrong. In any case, the patch below works for me.  I post it 
here for anyone looking for XA with SSL support.

In the XA datasource descriptor you'll have to add:
<xa-datasource-property name="Ssl">true</xa-datasource-property>

Best regards,
Stefan

inline patch 1: BaseDataSource.patched.java Thu Apr 06 09:51:39 2006 (+16/-0 lines) download inline-1.patch--- BaseDataSource.java Thu Apr 06 09:54:43 2006 +++ BaseDataSource.patched.java Thu Apr 06 09:51:39 2006 @@ -47,6 +47,7 @@ private String databaseName; private String user; private String password; + private boolean ssl = false; private int portNumber; private int prepareThreshold; private int loginTimeout; // in seconds @@ -262,13 +263,28 @@ } /** + * Is SSL enabled? + */ + public String isSsl() { + return ""+ssl; + } + + /** + * Enable or disable SSL. + * @param ssl enable or disable SSL. + */ + public void setSsl(String ssl) { + this.ssl = Boolean.valueOf(ssl).booleanValue(); + } + + /** * Generates a DriverManager URL from the other properties supplied. */ private String getUrl() { return "jdbc:postgresql://" + serverName + (portNumber == 0 ? "" :
":" + portNumber) + "/" + databaseName + - "?loginTimeout=" + loginTimeout + "&prepareThreshold=" + prepareThreshold; + "?loginTimeout=" + loginTimeout + "&prepareThreshold=" + prepareThreshold + (ssl?"&ssl=true":""); } /** @@ -301,6 +317,7 @@ ref.add(new StringRefAddr("prepareThreshold", Integer.toString(prepareThreshold))); ref.add(new StringRefAddr("loginTimeout", Integer.toString(loginTimeout))); + ref.add(new StringRefAddr("ssl", Boolean.toString(ssl))); return ref; } @@ -313,6 +330,7 @@ out.writeInt(portNumber); out.writeInt(prepareThreshold); out.writeInt(loginTimeout); + out.writeBoolean(ssl); } protected void readBaseObject(ObjectInputStream in) throws IOException, ClassNotFoundException @@ -324,6 +342,7 @@ portNumber = in.readInt(); prepareThreshold = in.readInt(); loginTimeout = in.readInt(); + ssl = in.readBoolean(); } }

view thread (3+ messages)

Message-ID: <4434CB81.8000909@quesd.com>
Permalink:  ../4434CB81.8000909@quesd.com/
Also on:    postgresql.org/message-id/4434CB81.8000909@quesd.com

 ·  · 

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: stefan.verkoyen@quesd.com
  Subject: Re: do XA connections support SSL?
  In-Reply-To: <4434CB81.8000909@quesd.com>
  References: <4433D6EB.8000702@quesd.com> <Pine.BSO.4.63.0604051306260.18112@leary2.csoft.net> <4434CB81.8000909@quesd.com>

* 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