Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dGTDN-0006DR-1L for pgsql-jdbc@arkaria.postgresql.org; Thu, 01 Jun 2017 16:44:49 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dGTDM-0007os-KV for pgsql-jdbc@arkaria.postgresql.org; Thu, 01 Jun 2017 16:44:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dGTDM-0007mw-4P for pgsql-jdbc@postgresql.org; Thu, 01 Jun 2017 16:44:48 +0000 Received: from mail-wm0-x22e.google.com ([2a00:1450:400c:c09::22e]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1dGTDJ-0007UH-5i for pgsql-jdbc@postgresql.org; Thu, 01 Jun 2017 16:44:47 +0000 Received: by mail-wm0-x22e.google.com with SMTP id 7so164850370wmo.1 for ; Thu, 01 Jun 2017 09:44:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=8kdata-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=n0A8MzzODDfTLQTMdUq8Hy5vcZNwE+eY1HyC1+L4BLk=; b=ToWj1Pr4eoK/B3P/afmc0HNMT8CartIOyavuKoAP9X4rvQy9ZXyTfmb1R61MpI53Kr FQ+yLa7QaTQVqsWX2McUwLgXZXwy9dThbZn1/kIRR6ZTzt2q17Txsw4qK3BJ2U402pex z9yB+lz37/jsWFr6w3W3rB3//gWXLHs7F6gkjVc3S05VwtcFpUAePIIzfyPCyQbvhXy1 IYrpxpbUDKoPaVhFWkljpB+kBgG0IKHUTxiwv424vGTFa71zzKGaPy0Ittrt92nATX3s yD2vDWZrU3lXb49bEYMTOgEBwsDnJ5uXqAd3kJ+LfadkbpnVvxQbHlOSmGzDnYNL1c7j iL2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=n0A8MzzODDfTLQTMdUq8Hy5vcZNwE+eY1HyC1+L4BLk=; b=EwtwDk9qkAtum6xZwgWkNLkay/dKUoIOdmvCkgh5qJYoUr87A7xITms2i6o/vRF94f k2U8VPtejYicTfq5bO95wqzcBfHC3qVKKfCOv8XPziz9CQLhO5ZlncIDXBPgGbQczZDX ScCsf6ljm49oht4A9JkNZYV4Kx8iJkHkc9GCRo965EOazT44rgYNX1N4yDknYdVlvhHe ckqV/FWorF5gGAV9wLSkjknKhcKkHEkk2g+ejDjc0tmMFs/YrItOpHtEqAwz9yzNsxKs 10nRKLYNQK6Pk/oB3f7etxZsP3UA/VgS3HUQACP/IqK6cVpXhMnIRq+qJf4TwL1v1Fav U11w== X-Gm-Message-State: AODbwcAhqDE+sQZltVJCCeWCo2COu438cWSFcE8CjR1ixFfqs4PbcXMO jgEtVhAdJlmdqOof9C4MwQ== X-Received: by 10.28.103.214 with SMTP id b205mr46675wmc.125.1496335483823; Thu, 01 Jun 2017 09:44:43 -0700 (PDT) Received: from [10.0.10.100] (254.red-79-155-7.dynamicip.rima-tde.net. [79.155.7.254]) by smtp.gmail.com with ESMTPSA id a9sm36600602wrc.22.2017.06.01.09.44.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Jun 2017 09:44:43 -0700 (PDT) Subject: Re: [HACKERS] Channel binding support for SCRAM-SHA-256 To: Bruce Momjian , Robert Haas Cc: Stephen Frost , Michael Paquier , Tom Lane , "pgsql-hackers@postgresql.org" , PostgreSQL JDBC List References: <4e65d7cc-63bd-9515-83d6-85b03dbb4f21@8kdata.com> <13406.1496155822@sss.pgh.pa.us> <20170530151432.GW3151@tamriel.snowman.net> <20170530170036.GZ3151@tamriel.snowman.net> <20170531034941.GH3151@tamriel.snowman.net> <20170601161113.GG8270@momjian.us> From: =?UTF-8?Q?=c3=81lvaro_Hern=c3=a1ndez_Tortosa?= Message-ID: <76303036-b0cb-dbda-077f-3e759e6fe920@8kdata.com> Date: Thu, 1 Jun 2017 18:44:42 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <20170601161113.GG8270@momjian.us> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Pg-Spam-Score: -1.8 (-) 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 01/06/17 18:11, Bruce Momjian wrote: > On Wed, May 31, 2017 at 09:37:02AM -0400, Robert Haas wrote: >> On Tue, May 30, 2017 at 11:49 PM, Stephen Frost wrote: >>> ... and I don't believe that we should be asking the >>> implementors of channel binding to also implement support for multiple >>> TLS libraries in PostgreSQL in order to test that their RFC-following >>> (at least, as far as they can tell) implementation actually works. >> You're of course free to believe what you wish, but that sounds >> short-sighted to me. If we implement channel binding and it turns out >> not to be interoperable with other SSL implementations, then what? We >> can't change it later without breaking compatibility with our own >> prior implementation. Note that Álvaro Hernández Tortosa said about >> two hours before you sent this email that it doesn't seem possible to >> implement something comparable in Java's standard SSL stack. If >> that's the case, adopting this implementation is dooming everyone who >> connects to the database server using JDBC to be unable to use channel >> binding. And that's a large percentage of our user base. > Just to step back, exactly how does channel binding work? Is each side > of the SSL connection hashing the password hash with the shared SSL > session secret in some way that each side knows the other end knows > the password hash, but not disclosing the secret or password hash? Is > there some other way JDBC can get that information? > In short, channel binding augments SCRAM (could be also other authentication methods, I guess) by adding to the mix of data to be exchanged, data that comes off-band. Normal SCRAM exchange involves user, a unique token, a salt and some other information. If you add into the mix off-band information, that is uniquely known by only client and server, you can avoid MITM attacks. It's not as simple as "hashing" the password, though. SCRAM involves 4 steps (2 messages each way) with somehow complex hashing of data in the last 2 steps. There are basically 2 channel binding options, that is, 2 possible data pieces that could be taken off-band of the SCRAM authentication and throw them into this mix: - tls-unique. It's like a unique identifier for each client-server SSL connection. It should be get from the SSL channel and there doesn't seem to be a super consistent way of getting it from the channel (in OpenSSL is an undocumented API, it's not available in normal Java stack, etc). - tls-server-end-point. Channel binding data is just a hash of a SSL certificate, as is. As such, seems to be easier to be supported across multiple OSs/SSL stacks. However, SCRAM RFC states that if channel binding is implemented, at least tls-unique must be implemented, with others being optional (there is as of today a third one, but only applies to telnet). So in my opinion, I'd implement both of the above, for maximum flexibility, and add a field to the required scram authentication febe message with a list (aka CSV) of the channel binding mechanisms supported by this server. In this way, I believe covers support for several channel binding mechanisms and could be extended in the future should other mechanisms appear. Álvaro -- Álvaro Hernández Tortosa ----------- <8K>data -- Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc