Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U03Sz-00085L-C5 for pgsql-jdbc@arkaria.postgresql.org; Tue, 29 Jan 2013 05:10:41 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1U03Sy-0001Ka-NP for pgsql-jdbc@arkaria.postgresql.org; Tue, 29 Jan 2013 05:10:40 +0000 Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U03Sx-0001JI-0U for pgsql-jdbc@postgresql.org; Tue, 29 Jan 2013 05:10:39 +0000 Received: from szxga02-in.huawei.com ([119.145.14.65]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U03Su-0001W5-50 for pgsql-jdbc@postgresql.org; Tue, 29 Jan 2013 05:10:38 +0000 Received: from 172.24.2.119 (EHLO szxeml213-edg.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.4-GA FastPath queued) with ESMTP id AWI51144; Tue, 29 Jan 2013 13:10:21 +0800 (CST) Received: from SZXEML420-HUB.china.huawei.com (10.82.67.159) by szxeml213-edg.china.huawei.com (172.24.2.30) with Microsoft SMTP Server (TLS) id 14.1.323.7; Tue, 29 Jan 2013 13:09:49 +0800 Received: from blrprnc07ns (10.18.96.96) by szxeml420-hub.china.huawei.com (10.82.67.159) with Microsoft SMTP Server id 14.1.323.7; Tue, 29 Jan 2013 13:09:47 +0800 From: Hari Babu To: "'Dave Cramer'" CC: "'List'" References: <51068542.845c2b0a.7fd0.68b2SMTPIN_ADDED_BROKEN@mx.google.com> In-Reply-To: Subject: Re: JDBC connection test with SSL on PG 9.2.1 server Date: Tue, 29 Jan 2013 10:39:45 +0530 Message-ID: <00a401cdfdde$db9737e0$92c5a7a0$@kommi@huawei.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_00A5_01CDFE0C.F54F73E0" X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: Ac39d4sV3K8wDtMER2iahLytsKqiAgAZA1NQ Content-Language: en-us X-Originating-IP: [10.18.96.96] X-CFilter-Loop: Reflected X-Pg-Spam-Score: -1.4 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org ------=_NextPart_000_00A5_01CDFE0C.F54F73E0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Monday, January 28, 2013 10:20 PM, Dave Cramer wrote: >>On Mon, Jan 28, 2013 at 9:03 AM, Hari Babu < = haribabu.kommi@huawei.com> wrote: >>While testing PostgreSQL JDBC java client to connect to the PG 9.2.1 >>database server using SSL. >>we got the following behavior. >> >>The test steps as below=EF=BC=9A >> >>url =3D "jdbc:postgresql://" + "10.145.98.227" + ':' >> + "8707" + '/' >> + "POSTGRES"; >> Properties props =3D new Properties(); >> props.setProperty("user", "CLIENT"); >> props.setProperty("password", "1234@QWER"); >> props.setProperty("ssl", "true"); >> >> System.setProperty("javax.net.ssl.trustStore", "193store"); >> System.setProperty("javax.net.ssl.keyStore", "193client.jks"); >> System.setProperty("javax.net.ssl.trustStorePassword", = "qwerty"); >> System.setProperty("javax.net.ssl.keyStorePassword", "qwerty"); >> >> /*Begin the first ssl connection*/ >> conn1 =3D DriverManager.getConnection(url, props); >> System.out.println("Connection1 successful!"); >> >> >> System.setProperty("javax.net.ssl.trustStore", "193store"); >> System.setProperty("javax.net.ssl.keyStore", "193client.jks"); >> System.setProperty("javax.net.ssl.trustStorePassword", = "qwerty"); >> System.setProperty("javax.net.ssl.keyStorePassword", = "wrongpassword"); >> >> /*Begin the second ssl connection*/ >> conn2 =3D DriverManager.getConnection(url, props); >> System.out.println("Connection2 successful!"); >> >>Before first connection we set >>"System.setProperty("javax.net.ssl.keyStorePassword", "qwerty");" = qwerty is >>the right password >>and before second SSL connection we set >>"System.setProperty("javax.net.ssl.keyStorePassword", = "wrongpassword");" >>wrongpassword is the wrong password. >> >>we expect the first SSL connection will be successful and second = failed >>because of wrong password, but actually we get two successful SSL >>connections. >>We found that if the first SSL connections password set right, all = the >>following SSL connections are fine ,even set wrong keystroke password. >> >>1. Is this a defect about JDBC? >>2. Is it SSL behavior to authenticate only once? >>3. Is it system property behavior can be set only once. >>4. Is it because of any other problems? >> >>please give your suggestions? >JDBC uses java's SSL infrastructure, as such I don't think it's a = defect in JDBC. It could be because your truststore >does not require a = password. =20 I removed the trustStorePassword setting from the test, still the second = connection is getting success with the wrong=20 keyStorePassword. =20 Regards, Hari babu. ------=_NextPart_000_00A5_01CDFE0C.F54F73E0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

On Monday, = January 28, 2013 10:20 PM, Dave Cramer wrote:

>>On Mon, Jan 28, 2013 at 9:03 AM, Hari Babu = <haribabu.kommi@huawei.com= > wrote:

>>While = testing PostgreSQL JDBC java client to connect to the PG = 9.2.1
>>database server using SSL.
>>we got the = following behavior.
>>
>>The test steps as below=EF=BC=9A
>>=
>>url =3D "jdbc:postgresql://" + = "10.145.98.227" + ':'
>>        =     + "8707" + '/'
>>      =       + "POSTGRES";
>>    = Properties props =3D new Properties();
>>    = props.setProperty("user", = "CLIENT");
>>    = props.setProperty("password", = "1234@QWER");
>>    = props.setProperty("ssl", = "true");
>>
>>      = System.setProperty("javax.net.ssl.trustStore", = "193store");
>>      = System.setProperty("javax.net.ssl.keyStore", = "193client.jks");
>>      = System.setProperty("javax.net.ssl.trustStorePassword", = "qwerty");
>>    = System.setProperty("javax.net.ssl.keyStorePassword", = "qwerty");
>>
>>    /*Begin the = first ssl connection*/
>>    conn1 =3D = DriverManager.getConnection(url, props);
>>    = System.out.println("Connection1 = successful!");
>>
>>
>>    =   System.setProperty("javax.net.ssl.trustStore", = "193store");
>>      = System.setProperty("javax.net.ssl.keyStore", = "193client.jks");
>>      = System.setProperty("javax.net.ssl.trustStorePassword", = "qwerty");
>>    = System.setProperty("javax.net.ssl.keyStorePassword", = "wrongpassword");
>>
>>    /*Begin = the second ssl connection*/
>>    conn2 =3D = DriverManager.getConnection(url, props);
>>    = System.out.println("Connection2 = successful!");
>>
>>Before first connection we = set
>>"System.setProperty("javax.net.ssl.keyStorePassw= ord", "qwerty");" qwerty is
>>the right = password
>>and before second SSL connection we = set
>>"System.setProperty("javax.net.ssl.keyStorePassw= ord", "wrongpassword");"
>>wrongpassword is = the wrong password.
>>
>>we expect  the first SSL = connection will be successful and second failed
>>because of = wrong password, but actually we get two successful = SSL
>>connections.
>>We found that  if the first = SSL connections password set right, all the
>>following SSL = connections are fine ,even set wrong keystroke = password.
>>
>>1. Is this a defect about = JDBC?
>>2. Is it SSL behavior to authenticate only = once?
>>3. Is it system property behavior can be set only = once.
>>4. Is it because of any other = problems?
>>
>>please give your = suggestions?

>JDBC = uses java's SSL infrastructure, as such I don't think it's a defect in = JDBC. It could be because your truststore >does not require a = password.

 

I removed the trustStorePassword setting from the test, still the second = connection is getting success with the wrong

keyStorePassword.

 

Regards,

Hari = babu.

------=_NextPart_000_00A5_01CDFE0C.F54F73E0--