Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cyLsT-0001Y7-RR for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Apr 2017 17:16:22 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cyLsT-0006JY-6i for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Apr 2017 17:16:21 +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 1cyLqw-0000uE-6B for pgsql-hackers@postgresql.org; Wed, 12 Apr 2017 17:14:46 +0000 Received: from mail-wr0-x233.google.com ([2a00:1450:400c:c0c::233]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1cyLqt-00069X-9E for pgsql-hackers@postgresql.org; Wed, 12 Apr 2017 17:14:45 +0000 Received: by mail-wr0-x233.google.com with SMTP id c55so21661903wrc.3 for ; Wed, 12 Apr 2017 10:14:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=8kdata-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=1LkA/3Q1nP9BPoKPKcW6s9IimTkM4eJ1wIm4+awfhzg=; b=sI1gZAOOKh8bsnJ1CdYJ3gzDzXEzzttprzJvwOkQ0WwgCF39FhyAcYMfO+XWBt4gte W7+BSr7E+2pDSkIBydtpykTmia1FF4Qgb7dHiKKzsYbPPNH3OpFRQpCHpDjwUmTBqhnq tJQmvbS+1NAblHuYj2FLZ64PobCxMUvzRByAHxmJaM2UJCCpEMFH4REqfO5UAdpydJYz SqkJBOQ+RM8QTmjKncVuZ+3+6vhoEJgVxHVGAck23Oebzpp4UcVTeQUzuu95vFf+qpTQ UIaWKhcKm64ltXvj/QnHPDPA+yca+ETu6WdphjlmNu7qCqcmIBhtWprStmOEmzVQ81hp qnVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=1LkA/3Q1nP9BPoKPKcW6s9IimTkM4eJ1wIm4+awfhzg=; b=mcgT2zPswE8YkIS7UxkRiFEki6xc/ANPssUSviXyC9QRuhSOqU0foq5qwRW+GgEI48 nVisMR5JCGABNooce9fxAz5NlqXYnAmvgpCdA9imVxDGBxse4rjkRC7Vbih+UnkCt1v6 542sNWYjd0ndHOz2Zp2v/9EnII3OOKDXOzWSrV/NmNs9WKYhU+ewjLhYChXpvXZ+vTxY mmNqbRFQx5+EmwTlxc+HQRjfJ1uDLSz7qmoir0s9tGMdZPMoviJN4ZoNFodkTF5sH0rT JKTI08TnF1BIeSPMAQwsBspUBMjiGcWtqhSfdskr4b+y2rdq3w8AZIhpR7aLnLNyotjK AoDw== X-Gm-Message-State: AN3rC/4whvC6OVJMMcs1lD/CC/1OAcDKvJwIFmpHC+48Y7BaotN6JgtGllp51+MBSF9L/w== X-Received: by 10.223.163.18 with SMTP id c18mr4307164wrb.70.1492017281968; Wed, 12 Apr 2017 10:14:41 -0700 (PDT) Received: from [192.168.43.230] ([31.4.243.9]) by smtp.gmail.com with ESMTPSA id l132sm7346106wmd.10.2017.04.12.10.14.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Apr 2017 10:14:41 -0700 (PDT) Subject: Re: Some thoughts about SCRAM implementation To: Tom Lane , Heikki Linnakangas References: <729b548a-f434-f31c-15e7-59f44aaecc8d@8kdata.com> <20170410183230.oxagjpfgj6xxmcwx@alap3.anarazel.de> <20170412004118.GC20340@momjian.us> <20170412005830.GU9812@tamriel.snowman.net> <20170412012532.GF20340@momjian.us> <20170412152629.GI20340@momjian.us> <20a91441-fa4c-ec2c-d813-c549066b8055@iki.fi> <8328.1492013344@sss.pgh.pa.us> Cc: Bruce Momjian , Magnus Hagander , Stephen Frost , Andres Freund , pgsql-hackers From: =?UTF-8?Q?=c3=81lvaro_Hern=c3=a1ndez_Tortosa?= Message-ID: <96912a79-a7a8-14bb-bd88-9044f1af637c@8kdata.com> Date: Wed, 12 Apr 2017 19:14:39 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <8328.1492013344@sss.pgh.pa.us> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: -1.1 (-) 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 12/04/17 18:09, Tom Lane wrote: > Heikki Linnakangas writes: >> On 04/12/2017 06:26 PM, Bruce Momjian wrote: >>> How does it do that? >> Good question, crypto magic? I don't know the details, but the basic >> idea is that you extract a blob of data that uniquely identifies the TLS >> connection. Using some OpenSSL functions, in this case. I think it's a >> hash of some of the TLS handshake messages that were used when the TLS >> connection was established (that's what "tls-unique" means). That data >> is then incorporated in the hash calculations of the SCRAM >> authentication. If the client and the server are not speaking over the >> same TLS connection, they will use different values for the TLS data, >> and the SCRAM computations will not match, and you get an authentication >> failure. I believe the above is not correct. Channel binding data is *not* used for any hash computations. It is simply a byte array that is received as an extra user parameter, and the server then gets it by its own way (its own TLS data) and do a byte comparison. That's what the RFCs say about it. > ... which the user can't tell apart from having fat-fingered the password, > I suppose? Doesn't sound terribly friendly. A report of a certificate > mismatch is far more likely to lead people to realize there's a MITM. So given what I said before, that won't happen. Indeed, SCRAM RFC contains a specific error code for this: "channel-bindings-dont-match". Á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