Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iUZ77-00042y-TW for pgsql-bugs@arkaria.postgresql.org; Tue, 12 Nov 2019 16:33:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iUZ75-0003Av-CP for pgsql-bugs@arkaria.postgresql.org; Tue, 12 Nov 2019 16:33:55 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iUZ75-0003Al-1G for pgsql-bugs@lists.postgresql.org; Tue, 12 Nov 2019 16:33:55 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iUZ6y-00069e-3w for pgsql-bugs@lists.postgresql.org; Tue, 12 Nov 2019 16:33:53 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id xACGXkIS007943; Tue, 12 Nov 2019 11:33:46 -0500 From: Tom Lane To: Marcos David cc: "pgsql-bugs@lists.postgresql.org" Subject: Re: BUG #16106: Patch - Radius secrets always gets lowercased In-reply-to: References: <16106-7d319e4295d08e70@postgresql.org> <19993.1573503787@sss.pgh.pa.us> Comments: In-reply-to Marcos David message dated "Tue, 12 Nov 2019 15:57:57 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <7941.1573576426.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 12 Nov 2019 11:33:46 -0500 Message-ID: <7942.1573576426@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Marcos David writes: > On 11/11/2019, 20:24, "Tom Lane" wrote: >> I'm hesitant to back-patch a change like this, because in theory >> it could change a working configuration into a non-working one. >> But it'd be sensible to do in HEAD. > We only noticed this because we were upgrading from 9.6 and it seems th= is bug was introduced in 10 in this commit: > https://github.com/postgres/postgres/commit/6b76f1bb58f53aec25cfec763912= 70ea36ad1170 Oh! Hm, if it can be painted as a regression, that changes the calculus a bit. In that case I'd be inclined to go ahead and back-patch. > I don't think patch would break anything in current configs since the se= cret would currently need to be lowercased anyway for the radius auth to w= ork. The case I was imagining was where the secret was entered in the PG configuration with some uppercase letters, but the server actually expects lowercase, so the forced lowercasing makes it work. I admit that's a bit of a stretch, but if it had always worked like that then it's at least possible someone was relying on the behavior. But if we changed the behavior from correct to less correct, that's another story. BTW, it looks to me like it should work to double-quote the secret, although doing so is really tedious because there is an additional layer of double-quoting required by the pg_hba syntax: host ... radiussecrets=3D"""ServerSecret"",""OtherServersSecret""" However, while you can defeat the downcasing that way, you can't bypass the truncation to NAMEDATALEN. So it's arguably broken even if this point had been documented, which it was not, at least not in any adequate way (the reference to quoting in the docs is mighty unclear to my eyes, and for sure it doesn't give a working example). Unfortunately, we've missed the window to get it into this week's releases, but I'll see about getting this committed after the release cycle finishes. regards, tom lane