pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Álvaro Hernández Tortosa <aht@8kdata.com>
To: Bruce Momjian <bruce@momjian.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Stephen Frost <sfrost@snowman.net>
Cc: Michael Paquier <michael.paquier@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Cc: PostgreSQL JDBC List <pgsql-jdbc@postgresql.org>
Subject: Re: [HACKERS] Channel binding support for SCRAM-SHA-256
Date: Thu, 1 Jun 2017 18:44:42 +0200
Message-ID: <76303036-b0cb-dbda-077f-3e759e6fe920@8kdata.com> (raw)
In-Reply-To: <20170601161113.GG8270@momjian.us>
References: <CAB7nPqTZxVG9Lk0Ojg7wUR4mhGGd_W=Qa4+7wuhy6k75kE9keg@mail.gmail.com>
	<4e65d7cc-63bd-9515-83d6-85b03dbb4f21@8kdata.com>
	<CA+TgmoaFxzTJ0Rmya8PkW0ZLV8wF95Cj1Cvts7aFxoxKF1aO9g@mail.gmail.com>
	<13406.1496155822@sss.pgh.pa.us>
	<20170530151432.GW3151@tamriel.snowman.net>
	<CAB7nPqQx+A9gYeQz20XS1roje0BwY3MS=3gN0UbOQFiPi_Uzxw@mail.gmail.com>
	<20170530170036.GZ3151@tamriel.snowman.net>
	<CA+TgmoY66SofTi87W-X6OgK6DzfVO2RhQr91Ley5dzg-JgYfTw@mail.gmail.com>
	<20170531034941.GH3151@tamriel.snowman.net>
	<CA+TgmoZ_RVwKjLCJzCdv-_QpxrQZOSGipXBwT_iX5kpNHbT1_g@mail.gmail.com>
	<20170601161113.GG8270@momjian.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>



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 <sfrost@snowman.net> 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



view thread (75+ messages)  latest in thread

Message-ID: <76303036-b0cb-dbda-077f-3e759e6fe920@8kdata.com>
Permalink:  ../76303036-b0cb-dbda-077f-3e759e6fe920@8kdata.com/
Also on:    postgresql.org/message-id/76303036-b0cb-dbda-077f-3e759e6fe920@8kdata.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: aht@8kdata.com, bruce@momjian.us, robertmhaas@gmail.com, sfrost@snowman.net, michael.paquier@gmail.com, tgl@sss.pgh.pa.us, pgsql-hackers@postgresql.org
  Subject: Re: [HACKERS] Channel binding support for SCRAM-SHA-256
  In-Reply-To: <76303036-b0cb-dbda-077f-3e759e6fe920@8kdata.com>
  References: <CAB7nPqTZxVG9Lk0Ojg7wUR4mhGGd_W=Qa4+7wuhy6k75kE9keg@mail.gmail.com> <4e65d7cc-63bd-9515-83d6-85b03dbb4f21@8kdata.com> <CA+TgmoaFxzTJ0Rmya8PkW0ZLV8wF95Cj1Cvts7aFxoxKF1aO9g@mail.gmail.com> <13406.1496155822@sss.pgh.pa.us> <20170530151432.GW3151@tamriel.snowman.net> <CAB7nPqQx+A9gYeQz20XS1roje0BwY3MS=3gN0UbOQFiPi_Uzxw@mail.gmail.com> <20170530170036.GZ3151@tamriel.snowman.net> <CA+TgmoY66SofTi87W-X6OgK6DzfVO2RhQr91Ley5dzg-JgYfTw@mail.gmail.com> <20170531034941.GH3151@tamriel.snowman.net> <CA+TgmoZ_RVwKjLCJzCdv-_QpxrQZOSGipXBwT_iX5kpNHbT1_g@mail.gmail.com> <20170601161113.GG8270@momjian.us> <76303036-b0cb-dbda-077f-3e759e6fe920@8kdata.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