Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YLyvu-0006MN-Jg for pgsql-jdbc@arkaria.postgresql.org; Thu, 12 Feb 2015 18:56:14 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YLyvt-0007Bw-Uq for pgsql-jdbc@arkaria.postgresql.org; Thu, 12 Feb 2015 18:56:13 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YLyvs-0007Bm-Mq for pgsql-jdbc@postgresql.org; Thu, 12 Feb 2015 18:56:12 +0000 Received: from smtp-outbound-2.vmware.com ([208.91.2.13]) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1YLyvj-0006cK-N6 for pgsql-jdbc@postgresql.org; Thu, 12 Feb 2015 18:56:09 +0000 Received: from sc9-mailhost1.vmware.com (sc9-mailhost1.vmware.com [10.113.161.71]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id 5CC5B289C9; Thu, 12 Feb 2015 10:56:00 -0800 (PST) Received: from EX13-CAS-001.vmware.com (EX13-CAS-001.vmware.com [10.113.191.51]) by sc9-mailhost1.vmware.com (Postfix) with ESMTP id 5288E18730; Thu, 12 Feb 2015 10:56:00 -0800 (PST) Received: from [192.168.1.90] (10.113.160.246) by EX13-MBX-024.vmware.com (10.113.191.44) with Microsoft SMTP Server (TLS) id 15.0.913.22; Thu, 12 Feb 2015 10:55:59 -0800 Message-ID: <54DCF736.2060207@vmware.com> Date: Thu, 12 Feb 2015 20:55:50 +0200 From: Heikki Linnakangas Organization: VMware User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.3.0 MIME-Version: 1.0 To: Albe Laurenz , "pgsql-jdbc@postgresql.org" Subject: Re: SSL renegotiation is broken References: In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.113.160.246] X-ClientProxiedBy: EX13-CAS-013.vmware.com (10.113.191.65) To EX13-MBX-024.vmware.com (10.113.191.44) X-Pg-Spam-Score: -6.9 (------) 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 On 02/11/2015 05:02 PM, Albe Laurenz wrote: > It seems that SSL renegotiation between the JDBC driver and > the PostgreSQL server is broken and has been forever, or at least > for a while. Hah, we're just discussing similar issues over at pgsql-hackers :-). > I can reproduce this with the following software versions: > Client side: > Windows, JDBC driver postgresql-9.1-901.jdbc4, java full version "1.7.0_71-b14" > Linux, JDBC driver postgresql-9.4-1200.jdbc41, java full version "1.7.0_75-mockbuild_2015_01_08_20_32-b00" > Server side: > Windows: PostgreSQL 9.4.0 with OpenSSL 1.0.1j > Linux: PostgreSQL 9.3.6, 9.4.1, git HEAD with OpenSSL 1.0.1e > > All of these Java and OpenSSL versions are recent enough to adhere to RFC 5746. > > There must be a software bug somewhere. I could reproduce this too, thanks for the test case. It looks like an OpenSSL bug to me. > I am trying to debug this, but don't know a lot aboult TLS, so > if somebody can shed light on this, I'd be grateful. I've been reading on the subject in the last few days, and I think I'm enough up to speed now to understand this. I launched the test program in a debugger to see what messages are exchanged during the renegotiation. Renegotiation at the protocol level is always initiated by the Client. When the server wants to initiate it, it just sends a message to the client that means "hey, could you begin renegotiation, please?". The actual handshake goes something like this: C: ClientHello S: ServerHello (or a bunch of other messages?) S: ServerHelloDone C: ClientKeyExchange C: ChangeCipherSpec C: Finished S: ChangeCipherSpec S: Finished Now, what happens in this test case is that the client also sends ApplicationData messages between the ClientHello and Finished steps, interleaved with the above handshake messages. According to the TLS spec, that is allowed, but OpenSSL get confused by it. I can't come up with any way to work around that, unfortunately :-(. - Heikki -- Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc