Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pQHD9-0002Ri-OY for pgsql-bugs@arkaria.postgresql.org; Fri, 10 Feb 2023 00:24:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pQHD8-0007tF-IA for pgsql-bugs@arkaria.postgresql.org; Fri, 10 Feb 2023 00:24:18 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pQHD8-0007t6-5q for pgsql-bugs@lists.postgresql.org; Fri, 10 Feb 2023 00:24:18 +0000 Received: from meesny.iki.fi ([195.140.195.201]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pQHD5-0002KB-Hr for pgsql-bugs@lists.postgresql.org; Fri, 10 Feb 2023 00:24:17 +0000 Received: from [192.168.1.113] (dsl-hkibng22-54f8db-125.dhcp.inet.fi [84.248.219.125]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hlinnaka) by meesny.iki.fi (Postfix) with ESMTPSA id BA961201F9; Fri, 10 Feb 2023 02:24:12 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1675988653; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CK6cKzqf76F7Dpkk3BHM7dOmKcONLnPdVIPYy7a1RtU=; b=twkD2ozI/5cbKD88OKnBbNW2SJEyE+xfq7JA3hGL2vv2Bqav2024Il20IOwTTmk7xteTCa H5sP/IwkxrgXT0HlXKzHNK+xefreclIKV0Q8XSF7+6zwNs0uyz1EUyILVQwCfTc/SccPCs pbGEcxe7giXzRHwPRNT+1ED9tVJ0+0Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1675988653; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CK6cKzqf76F7Dpkk3BHM7dOmKcONLnPdVIPYy7a1RtU=; b=HAhHqo8twBujCLkfiNXjn4Df1ArfRByO/QSbTG0KO7waDCOkMHgh3oubRUPlmzyJDSy+j1 1kV/n+9IZ/pFPBvUp1F+xcU3x+F/5VqcdTaK2Gcuvin1CoLBqiezdzNzqjlB7qdFkObYMI S/eK/wzALk3RqaLiXbVqQ913RixZZI0= ARC-Seal: i=1; s=meesny; d=iki.fi; t=1675988653; a=rsa-sha256; cv=none; b=x6Adx33vxNOtDd8OndMpo5wtyp7M5KAeCIePFL2TN0zkMllrsrl+fQ3BSu7wpMKJ3wdQ+J QsvO67gAkqpDm+kiE/zMbl9z3rx3fujY9zxc/PiN8lid3LKHN+f4uza5Ye90Ueqae2k0Hh suEMwtW8qi9pHZkiL4vELiBRxEPTFHA= ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=hlinnaka smtp.mailfrom=hlinnaka@iki.fi Message-ID: <9f193dd6-e1c5-fb20-ea90-0e6d03760be8@iki.fi> Date: Fri, 10 Feb 2023 02:24:12 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: BUG #17760: SCRAM authentication fails with "modern" (rsassaPss signature) server certificate Content-Language: en-US To: Michael Paquier , Jacob Champion Cc: gunnar.bluth@pro-open.de, pgsql-bugs@lists.postgresql.org References: <17760-b6c61e752ec07060@postgresql.org> <584842ed-e476-6bac-bb36-2aec204e9eef@iki.fi> <07e810b5-ea15-87ac-1745-e765e426062e@iki.fi> From: Heikki Linnakangas In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 10/02/2023 00:45, Michael Paquier wrote: > On Thu, Feb 09, 2023 at 02:22:28PM -0800, Jacob Champion wrote: >> +1. I'm still coming up to speed on RSA-PSS and the conversation at >> >> https://github.com/openssl/openssl/issues/15477 >> >> but it makes me really uncomfortable to fail open rather than shut in >> this case, as part of a backport. > > I could get that some users would want to be able to use such certs, > though. At least we have one such user as of this thread. Note that the discussion in that thread is in a slightly different context. They are not talking about channel binding, but something else (https://github.com/openssl/openssl/issues/15477#issuecomment-852928702). The problem is similar: what hash algorithm to use if it's not well defined. But there's no guarantee that the rules they come up with will be the same as the rules for tls-server-end-point. So I'm not very comfortable relying on X509_digest_sig() to do the right thing for us in the future, even if it does today. >>>> So as much as I'd like to be aggressive and potentially enforce the >>>> use of SHA256 to compute the certificate hash, what you are doing is >>>> RFC-compliant. >>> >>> Yeah, it seems silly to use anything else than SHA-256, given that >>> SCRAM-SHA-256 is totally dependent on the security of SHA-256 anyway. >> >> How will this evolve when SCRAM-SHA-512 is implemented? Do you plan to >> upgrade the undef-hash in that case to SHA-512? Yes, that's what I had in mind. Or for SCRAM-SHA-512, we could go further and define it as "always use SHA-512", because we wouldn't need to worry about backwards compatibility anymore. >> Knee-jerk reaction: this departure feels unnecessary since Gunnar's >> certificate does in fact contain a hash algorithm... > > What do you mean by Gunnar here? Gunnar reported the bug, he's cc'd in this thread. Ok, let me refine my earlier idea to make this more concrete: > We could use a new "tls-server-end-point-sha-256" channel binding name > for that, instead of "tls-server-end-point", to make it clear when we're > violating the RFC. Let's define a new channel binding type: tls-server-end-point-sha-256. with "tls-server-end-point-sha-256", the SHA-256 hash of the certificate is used, regardless of what algorithm is in the certificate's signature. 1. When the client sees a "normal" server certificate that uses SHA-256, SHA-512, or something else that it recognizes and handles fine today, it does the same thing as it does today. It sends "tls-server-end-point" as the the cb-name, and calculates the hash using the certificate's hash algorithm. 2. When the client sees a certificate with RSA-PSS, ED25519, ED448, or any other signature method that it doesn't recognize, it selects the tls-server-end-point-sha-256 channel binding type. It sends "tls-server-end-point-sha-256" as the cb-name, and calculates the SHA-256 hash of the certificate. 3. The server follows the current rules, or uses SHA-256, depending on whether the client sent "tls-server-end-point" or "tls-server-end-point-sha-256" in the cb-name. These rules ensure that with certificates that work today, nothing changes. Rule 1 ensures that you can connect with a new client to an old server, and it still works. And rule 3. ensures that you can still connect to a new server with an old client. At the same time, we are using a new channel binding type to make it clear when we are deviating from the standard rules of "tls-server-end-point". If you have an RSA-PSS certificate, you need to upgrade the client and the server, or you get an error when you try to connect. (Unless you set channel_binding=disable). But after upgrading, it will work. - Heikki