Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dNOS3-0000th-Rg for pgsql-hackers@arkaria.postgresql.org; Tue, 20 Jun 2017 19:04:35 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dNOS3-0001Bf-EG for pgsql-hackers@arkaria.postgresql.org; Tue, 20 Jun 2017 19:04:35 +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.84_2) (envelope-from ) id 1dNOS2-00017G-7l for pgsql-hackers@postgresql.org; Tue, 20 Jun 2017 19:04:34 +0000 Received: from mail-wr0-x22a.google.com ([2a00:1450:400c:c0c::22a]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1dNORy-0002or-Ty for pgsql-hackers@postgresql.org; Tue, 20 Jun 2017 19:04:32 +0000 Received: by mail-wr0-x22a.google.com with SMTP id 77so103497967wrb.1 for ; Tue, 20 Jun 2017 12:04:30 -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=E88IyeYn7jB8mwG+vH635olTmpPT34lG01IPFmxcjUg=; b=ZzHliDcuEs/89140CtX8sUsZD/jLPYXgrMjvBq0MzD2a/Gs/Hl6nM5WjNAwPouusLk i95EtadCHBOHgem5Zl1eX++W1vvpAiMmJQzQ6r0vftgHAnoLdSbbmi8nxpCxBVLJVsge 5QRl7gSs6YtCShJsDX4pLbkFLm5m8vYwekTt9Iw2O3/ZeUWjgAJij94zvoCchz5nH9wo jcH6BkeqjwcTsEV4XXINh1yR2AfhVkeKJO0y7W8uEJgsBiY2jpR18WMPrAwMUgMB6pEw Zq2uxNAsWEcgUrjBYKTCgYEmL1JE3X253Q293/AAkFzObJiJqEbvy+v60jgL9U7tAejE 889g== 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=E88IyeYn7jB8mwG+vH635olTmpPT34lG01IPFmxcjUg=; b=UW8PNedcF6Obc03vhmqUuEsMeEaH8cPgI1TZWRtXRcSCcVPJ1SUs4X56iBx6MGFzl9 bkYWW3mRwNDhVSe5NeZx/xDGfvuLH/tdRXpYF892vtkLxvsHwzg0yXlyHrf2thkMoy26 Q3Lhudb9qxbpYHYnY9ycteggUhn0B3U1wKj7HipSTdVbRcfRVVk9ACJ7cZtRs6Gs+vY+ EZW1yYnApBeQmfRgNSupTQ0Y4Bu7knBEL0dOUkU5c6QkI6M5fUhsoLA3jsCOo5hd833w 9OhJtAUIDgUNPvd91uywRLU+mbZmbznWMwjt2OjKFRDRgzrkOwaNgvV0wqKUEwPsmjvF 2DYA== X-Gm-Message-State: AKS2vOz3DslIV193Ynl0WIYawiPXkDPmypi96aFwNXe6rzNomAaYCKXQ yVefKe6ISnWSWwBU X-Received: by 10.223.170.194 with SMTP id i2mr2812245wrc.143.1497985468417; Tue, 20 Jun 2017 12:04:28 -0700 (PDT) Received: from [192.168.43.230] ([31.4.243.6]) by smtp.gmail.com with ESMTPSA id 55sm12377047wrt.36.2017.06.20.12.04.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Jun 2017 12:04:27 -0700 (PDT) Subject: Re: [JDBC] Channel binding support for SCRAM-SHA-256 To: Michael Paquier , Stephen Frost Cc: Robert Haas , Tom Lane , "pgsql-hackers@postgresql.org" , PostgreSQL JDBC List References: <20170530151432.GW3151@tamriel.snowman.net> <20170530170036.GZ3151@tamriel.snowman.net> <20170531034941.GH3151@tamriel.snowman.net> <20170531235922.GR3151@tamriel.snowman.net> <20170601155042.GG3151@tamriel.snowman.net> <20170602010826.GP3151@tamriel.snowman.net> From: =?UTF-8?Q?=c3=81lvaro_Hern=c3=a1ndez_Tortosa?= Message-ID: Date: Tue, 20 Jun 2017 21:04:24 +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: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: es-ES List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 20/06/17 06:11, Michael Paquier wrote: > On Tue, Jun 6, 2017 at 3:40 PM, Michael Paquier > wrote: >> As far as I can see, there are a couple of things that I still need to >> work on to make people happy: >> - Rework the generic APIs for TLS finish and endpoint so as any >> implementation can use channel binding without inducing any extra code >> footprint to be-secure.c and fe-secure.c. >> - Implement endpoint, as Alvaro is saying for JDBC that would be nicer. >> - Have a couple of tests for channel binding to allow people to test >> the feature easily. Those will be in src/test/ssl/. It would be nice >> as well to be able to enforce the channel binding type on libpq-side, >> which is useful at least for testing. So we are going to need an >> environment variable for this purpose, and a connection parameter. > Okay, here we go. Attached is a set of four patches: > - 0001 is some refactoring for the SSL tests so as other test suite in > src/test/ssl can take advantage of the connection routines. There is > nothing fancy here. > - 0002 is the implementation of tls-unique as channel binding. This > has been largely reworked since last submission, I have found on the > way a couple of bugs and some correctness issues. > - 0003 is a patch to add as connection parameters saslname and > saslchannelbinding. With support of more SASL mechanisms (PG10 has > SCRAM-SHA-256, I am adding SCRAM-SHA-256-PLUS here), saslname can be > used to enforce on the client-side the value of the SASL mechanism > chosen. saslchannelbinding does the same for the channel binding name. > This is very useful for testing, and a set of tests are added in > src/test/ssl/ for tls-unique and the SASL mechanisms. The tests cover > many scenarios, like downgrade attacks for example. > - 0004 is the implementation of tls-server-end-point, as Alvaro has > asked. Per RFC 5929, the binding data needs to be a hash of the server > certificate. If the signature algorithm of the certificate is MD5 or > SHA-1, then SHA-256 is used. Other signature algos like SHA-384 or 512 > are used to hash the data. The hashed data is then encoded in base64 > and sent to the server for verification. Tests using saslchannelname > have been added as well. It took me a while to find out that > OBJ_find_sigid_algs(X509_get_signature_nid(X509*)) needs to be used to > find out the algorithm of a certificate with OpenSSL. > > With the tests directly in the patch, things are easy to run. WIth > PG10 stabilization work, of course I don't expect much feedback :) > But this set of patches looks like the direction we want to go so as > JDBC and libpq users can take advantage of channel binding with SCRAM. This is awesome, Michael. In the coming weeks, and once my PR for pgjdbc has been added, I will work towards another patch to implement channel binding. Should be reasonably easy now, thanks to this. Appreciated! Álvaro -- Álvaro Hernández Tortosa ----------- <8K>data -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers