From: Michael Paquier <michael@paquier.xyz>
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: Hugh Ranalli <hugh@whtc.ca>
Cc: Bruce Momjian <bruce@momjian.us>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Channel binding not supported using scram-sha-256 passwords
Date: Thu, 21 Feb 2019 13:47:58 +0900
Message-ID: <20190221044758.GK15532@paquier.xyz> (raw)
In-Reply-To: <56d28a96-6a18-8eb0-3c23-2a980a29a01f@2ndquadrant.com>
References: <CAAhbUMO89SqUk-5mMY+OapgWf-twF2NA5sCucbHEzMfGbvcepA@mail.gmail.com>
<20190215211417.GC14824@momjian.us>
<CAAhbUMPGQ6bNAJ22tQrA2RN245T+7Vb8g3VD3wvczDHqBTDevQ@mail.gmail.com>
<20190218010614.GE1864@paquier.xyz>
<56d28a96-6a18-8eb0-3c23-2a980a29a01f@2ndquadrant.com>
On Wed, Feb 20, 2019 at 04:53:32PM +0100, Peter Eisentraut wrote:
> I think there is a bug in the frontend code. If the server offers
> SCRAM-SHA-256-PLUS, the client will choose it if SSL is in use, but it
> will later fail with this error message if not
> HAVE_PGTLS_GET_PEER_CERTIFICATE_HASH.
Good catch! Indeed that's not a good idea. What do you think about
the attached to fix the issue?
--
Michael
Attachments:scram-libpq-fix-v1.patch (text/x-diff, 1.2K) downloaddiff --git a/src/interfaces/libpq/fe-auth.c b/src/interfaces/libpq/fe-auth.cindex 08a5a9c1f3..4bb529ba3b 100644--- a/src/interfaces/libpq/fe-auth.c+++ b/src/interfaces/libpq/fe-auth.c@@ -526,14 +526,24 @@ pg_SASL_init(PGconn *conn, int payloadlen)
/*
* Select the mechanism to use. Pick SCRAM-SHA-256-PLUS over anything
- * else if a channel binding type is set. Pick SCRAM-SHA-256 if- * nothing else has already been picked. If we add more mechanisms, a- * more refined priority mechanism might become necessary.+ * else if a channel binding type is set and if the client supports it.+ * Pick SCRAM-SHA-256 if nothing else has already been picked. If we+ * add more mechanisms, a more refined priority mechanism might become+ * necessary.
*/
if (strcmp(mechanism_buf.data, SCRAM_SHA_256_PLUS_NAME) == 0)
{
if (conn->ssl_in_use)
+ {+ /*+ * The server has offered SCRAM-SHA-256-PLUS, which is only+ * supported by the client if a hash of the peer certificate+ * can be created.+ */+#ifdef HAVE_PGTLS_GET_PEER_CERTIFICATE_HASH
selected_mechanism = SCRAM_SHA_256_PLUS_NAME;
+#endif+ }
else
{
/*
signature.asc (application/pgp-signature, 832B) download
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-general@postgresql.org
Cc: michael@paquier.xyz, peter.eisentraut@2ndquadrant.com, hugh@whtc.ca, bruce@momjian.us
Subject: Re: Channel binding not supported using scram-sha-256 passwords
In-Reply-To: <20190221044758.GK15532@paquier.xyz>
References: <CAAhbUMO89SqUk-5mMY+OapgWf-twF2NA5sCucbHEzMfGbvcepA@mail.gmail.com> <20190215211417.GC14824@momjian.us> <CAAhbUMPGQ6bNAJ22tQrA2RN245T+7Vb8g3VD3wvczDHqBTDevQ@mail.gmail.com> <20190218010614.GE1864@paquier.xyz> <56d28a96-6a18-8eb0-3c23-2a980a29a01f@2ndquadrant.com> <20190221044758.GK15532@paquier.xyz>
* 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