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 1obKkx-0004Mh-Po for pgsql-hackers@arkaria.postgresql.org; Thu, 22 Sep 2022 11:52:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1obKkv-0001Cs-HH for pgsql-hackers@arkaria.postgresql.org; Thu, 22 Sep 2022 11:52:37 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1obKkv-0001Cj-5v for pgsql-hackers@lists.postgresql.org; Thu, 22 Sep 2022 11:52:37 +0000 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1obKkm-0004k2-Ad for pgsql-hackers@postgresql.org; Thu, 22 Sep 2022 11:52:35 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id E1978320089C; Thu, 22 Sep 2022 07:52:25 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 22 Sep 2022 07:52:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1663847545; x= 1663933945; bh=cCRRexUPiEuLEq089M5eBYXdRNbLbFU+CjQNZjT61e4=; b=K iavV4ioVx7E4hgNxbTl19dirbAietm3UA1CjamlHyA8KheJz80zU5zrZxoQ4s3qR QDu56WtPnBy3KbSO+HIeEwmL7qNSCItq+cYORHkwuBJBQeFYR6m/WZrT2hPXFoOO 2zmPNcCdz6o6Qz5PXWy3RilRiulz4lz6Ej0ig1aJ4Q5BfoJrxlDaJrmoYYN3SU1e nHMqeu87/+YTUwS4ELW3zxZ9oZZj/3AuQfLKGIJMl3xlmptj06DT5FU3IOFCDJb+ E6o+zMhkESqXbPkqvRywvm535bsvQsn8d47X1WwABjLu3wXkTXUVJJt2U5HozAfE 4k0Xelo2Ys38me7g7Ld6w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeeffedggedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpefrvght vghrucfgihhsvghnthhrrghuthcuoehpvghtvghrrdgvihhsvghnthhrrghuthesvghnth gvrhhprhhishgvuggsrdgtohhmqeenucggtffrrghtthgvrhhnpeehleffgeegudejteei hfelteduvdeifffhffdvjedvffegjeekudeludehudeifeenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpvghtvghrrdgvihhsvghnthhrrghu thesvghnthgvrhhprhhishgvuggsrdgtohhm X-ME-Proxy: Feedback-ID: i131946ab:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 22 Sep 2022 07:52:24 -0400 (EDT) Message-ID: <949f1c20-771c-aef7-058f-2c10885db955@enterprisedb.com> Date: Thu, 22 Sep 2022 07:52:23 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PoC] Let libpq reject unexpected authentication requests Content-Language: en-US To: Jacob Champion Cc: "pgsql-hackers@postgresql.org" , Michael Paquier , "David G. Johnston" References: <9e5a8ccddb8355ea9fa4b75a1e3a9edc88a70cd3.camel@vmware.com> <77358b4c-6497-e5d3-c13c-57522654af25@enterprisedb.com> <914a0125-3dfb-920f-51b6-8d44a8edbdd2@enterprisedb.com> From: Peter Eisentraut 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 22.09.22 01:37, Jacob Champion wrote: > On Wed, Sep 21, 2022 at 3:36 PM Peter Eisentraut > wrote: >> So let's look at the two TODO comments you have: >> >> * TODO: how should !auth_required interact with an incomplete >> * SCRAM exchange? >> >> What specific combination of events are you thinking of here? > > Let's say the client is using `require_auth=!password`. If the server > starts a SCRAM exchange. but doesn't finish it, the connection will > still succeed with the current implementation (because it satisfies > the "none" case). This is also true for a client setting of > `require_auth=scram-sha-256,none`. I think this is potentially > dangerous, but it mirrors the current behavior of libpq and I'm not > sure that we should change it as part of this patch. It might be worth reviewing that behavior for other reasons, but I think semantics of your patch are correct. >> In any case, it seems to me that it would be safer to *not* >> make this assumption at first and then have someone more knowledgeable >> make the argument that it would be safe. > > I think I'm okay with that, regardless. Here's one of the wrinkles: > right now, both of the following connstrings work: > > require_auth=gss gssencmode=require > require_auth=gss gssencmode=prefer > > If we don't treat gssencmode as providing GSS auth, then the first > case will always fail, because there will be no GSS authentication > packet over an encrypted connection. Likewise, the second case will > almost always fail, unless the server doesn't support gssencmode at > all (so why are you using prefer?). > > If you're okay with those limitations, I will rip out the code. The > reason I'm not too worried about it is, I don't think it makes much > sense to be strict about your authentication requirements while at the > same time leaving the choice of transport encryption up to the server. The way I understand what you explained here is that it would be more sensible to leave that code in. I would be okay with that.