Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g2v5D-0005BT-S7 for pgsql-jdbc@arkaria.postgresql.org; Thu, 20 Sep 2018 09:17:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g2v5B-00086Q-Qb for pgsql-jdbc@arkaria.postgresql.org; Thu, 20 Sep 2018 09:17:09 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g2tZH-0002af-83 for pgsql-jdbc@lists.postgresql.org; Thu, 20 Sep 2018 07:40:07 +0000 Received: from mail.sonicle.com ([62.173.161.2]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g2tZD-00007N-Dt for pgsql-jdbc@lists.postgresql.org; Thu, 20 Sep 2018 07:40:05 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.sonicle.com (Postfix) with ESMTP id C15F0635FCA; Thu, 20 Sep 2018 09:40:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=sonicle.com; h= content-type:content-type:mime-version:subject:subject :references:in-reply-to:message-id:reply-to:from:from:date:date :received:received; s=dkim; t=1537429200; x=1539243601; bh=mNbKl hwS12Y2mj3AmyV3duAPTeuZvGhpsEYJ6Ys21Y0=; b=VARuIMY+JbjyT/u+/zX2T QaWsciuB+mV71gVkz8dl5f3FyMWX5hIvq5ttGUkd1mzNJdNrfcRM8KQsMyXlw+q5 B6HNJrHUwtGVhRkLdktaJyOhIGOYZSh4oMAMsiIw4FXad/8o8e9zeLyBoamkTtwp 6JIZUF1AaoDSII5TBniVYc= Received: from www ([127.0.0.1]) by localhost (mail.sonicle.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id GNoqT_1HHeh9; Thu, 20 Sep 2018 09:40:00 +0200 (CEST) Received: from www (www [192.168.222.200]) by www with SMTP (SubEthaSMTP 3.1.7) id JMA9NFHV; Thu, 20 Sep 2018 09:40:00 +0200 (CEST) Date: Thu, 20 Sep 2018 09:40:00 +0200 (CEST) From: Gabriele Bulfon Reply-To: Gabriele Bulfon To: zloster , Dave Cramer Cc: =?UTF-8?Q?Alexander_Kj=C3=A4ll?= , pgsql-jdbc@lists.postgresql.org Message-ID: <2058261496.3175.1537429200690@www> In-Reply-To: <652173d1-71e1-68c1-54f5-958dc7a845e8@edno.moe> References: <652759681.5047.1536841425886@www> <491225265.1372.1537176204835@www> <90731313-9cd6-c020-9270-c9ef5d380390@gmail.com> <1954323705.1855.1537278167094@www> <441859077.1912.1537279378378@www> <742803153.2017.1537284186298@www> <652173d1-71e1-68c1-54f5-958dc7a845e8@edno.moe> Subject: Re: ssl connection issues MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_3173_1907513206.1537429200690" Forwarded-From: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------=_Part_3173_1907513206.1537429200690 Content-Type: multipart/alternative; boundary="----=_Part_3174_383473057.1537429200690" ------=_Part_3174_383473057.1537429200690 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Thanks, I tried enabling all the client debug infos, but didn't get much fr= om them. I will try to create certs from scratch, using the openssl tool instead of = easy-rsa, and see if something changes. =C2=A0 Gabriele -=3D Sent using Webtop 5 =3D- Gabriele Bulfon - Sonicle S.r.l. Tel +39 028246016 - Fax +39 028243880 Strada 6, Palazzo=C2=A0A13 - 20090 - Assago Milanofiori - MI http://www.sonicle.com Da: zloster A: Dave Cramer Gabriele Bulfon Cc: Alexander Kj=C3=A4ll pgsql-jdbc@lists.postgresql.org Data: 19 settembre 2018 9.21.03 CEST Oggetto: Re: ssl connection issues On 18.09.2018 18:27, Dave Cramer wrote: On Tue, 18 Sep 2018 at 11:23, Gabriele Bulfon gbulfon@sonicle.com wrote: The only server cert known to me that is needed to the client is the root.c= rt (the ca cert) of the server used to sign the client cert. These three files are all that is needed to the odbc driver, to the native = navicat dll connection, and to any other certs-based ssl connection such as= openvpn. Actually the jdbc code is not complaining about the certs (if I remove any = of them it will complain), something is going wrong during the ssl handshak= e that I cannot understand. =C2=A0 Is there any way to log more stuff on the server postgres.log about the ssl= handshake? =C2=A0 I'm sure there is but I don't know how. The server is not my domain. =C2=A0 Try connecting with psql. If you can connect with that then JDBC should be = able to connect.=C2=A0 =C2=A0 Dave Cramer davec@postgresintl.com www.postgresintl.com Hi to all, IMO it will be better to inspect the SSL/TLS handshake at the client - the = machine that is initiating the connection to the PostgreSQL server through = the JDBC driver. Here are some links with the basic stuff about debugging the SSL/TLS connec= tions with the JVM: https://blogs.oracle.com/java-platform-group/diagnosing-tls,-ssl,-and-https - this is an introduction document. It points to the following two pages. T= he first is describing what debug tools are available and the second shows = how to read the debug output: https://docs.oracle.com/javase/8/docs/technotes/guides/security/jsse/JSSERe= fGuide.html#Debug https://docs.oracle.com/javase/7/docs/technotes/guides/security/jsse/ReadDe= bug.html https://access.redhat.com/solutions/973783 - same as the above but in Q&A style I've used the debug output once - I've needed to investigate why communicat= ion with test HTTPS endpoint is working from a browser but not from a Java = 8 program. After nearly one day of looking at the connection logs the probl= em turned out to be in the certificate chain - the browser was happy with t= he intermediate certificates, but the JVM was not. Best regards, zloster ------=_Part_3174_383473057.1537429200690 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit
Thanks, I tried enabling all the client debug infos, but didn't get much from them.
I will try to create certs from scratch, using the openssl tool instead of easy-rsa, and see if something changes.
 
Gabriele


-= Sent using Webtop 5 =-

Gabriele Bulfon - Sonicle S.r.l.

Tel +39 028246016 - Fax +39 028243880
Strada 6, Palazzo A13 - 20090 - Assago Milanofiori - MI
http://www.sonicle.com




Da: zloster <more@edno.moe>
A: Dave Cramer <pg@fastcrypt.com>Gabriele Bulfon <gbulfon@sonicle.com>
Cc: Alexander Kjäll <alexander.kjall@gmail.com>pgsql-jdbc@lists.postgresql.org
Data: 19 settembre 2018 9.21.03 CEST
Oggetto: Re: ssl connection issues


On 18.09.2018 18:27, Dave Cramer wrote:

On Tue, 18 Sep 2018 at 11:23, Gabriele Bulfon <gbulfon@sonicle.com> wrote:
The only server cert known to me that is needed to the client is the root.crt (the ca cert) of the server used to sign the client cert.
These three files are all that is needed to the odbc driver, to the native navicat dll connection, and to any other certs-based ssl connection such as openvpn.
Actually the jdbc code is not complaining about the certs (if I remove any of them it will complain), something is going wrong during the ssl handshake that I cannot understand.
 
Is there any way to log more stuff on the server postgres.log about the ssl handshake?
 
I'm sure there is but I don't know how. The server is not my domain.
 
Try connecting with psql. If you can connect with that then JDBC should be able to connect. 
 
Hi to all,
IMO it will be better to inspect the SSL/TLS handshake at the client - the machine that is initiating the connection to the PostgreSQL server through the JDBC driver.

Here are some links with the basic stuff about debugging the SSL/TLS connections with the JVM:
  1. https://blogs.oracle.com/java-platform-group/diagnosing-tls,-ssl,-and-https - this is an introduction document. It points to the following two pages. The first is describing what debug tools are available and the second shows how to read the debug output:
  2. https://access.redhat.com/solutions/973783 - same as the above but in Q&A style
I've used the debug output once - I've needed to investigate why communication with test HTTPS endpoint is working from a browser but not from a Java 8 program. After nearly one day of looking at the connection logs the problem turned out to be in the certificate chain - the browser was happy with the intermediate certificates, but the JVM was not.

Best regards,
zloster
------=_Part_3174_383473057.1537429200690-- ------=_Part_3173_1907513206.1537429200690--