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 1ioZX8-0003CE-5w for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Jan 2020 21:03:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ioZX5-0005fB-G9 for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Jan 2020 21:03:27 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1ioZX5-0005f4-71 for pgsql-hackers@lists.postgresql.org; Mon, 06 Jan 2020 21:03:27 +0000 Received: from tamriel.snowman.net ([96.255.250.162]) by magus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ioZX1-0007d3-OM for pgsql-hackers@lists.postgresql.org; Mon, 06 Jan 2020 21:03:26 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 027CC5F799; Mon, 6 Jan 2020 16:03:22 -0500 (EST) Date: Mon, 6 Jan 2020 16:03:22 -0500 From: Stephen Frost To: Robbie Harwood Cc: Alvaro Herrera , Pg Hackers Subject: Re: weird libpq GSSAPI comment Message-ID: <20200106210322.GJ3195@tamriel.snowman.net> References: <20191227202332.GA20278@alvherre.pgsql> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="CVXpx251GNNJP8Zs" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --CVXpx251GNNJP8Zs Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Greetings, * Robbie Harwood (rharwood@redhat.com) wrote: > Alvaro Herrera writes: >=20 > > How about this? > > > > * If GSSAPI is enabled and we can reach a credential c= ache, > > * set up a handle for it; if it's operating, just send= a > > * GSS startup message, instead of the SSL negotiation = and > > * regular startup message below. >=20 > Due to the way postgres handled this historically, there are two ways > GSSAPI can be used: for connection encryption, and for authentication > only. We perform the same dance of sending a "request packet" for > GSSAPI encryption as we do for TLS encryption. So I'd like us to be > precise about which one we're talking about here (encryption). Alright, that's fair. > The GSSAPI idiom I should have used is "can acquire credentials" (i.e., > instead of "can reach a credential cache" in your proposal). Ok. > There's no such thing as a "GSS startup message". After negotiating > GSSAPI/TLS encryption (or failing to do so), we send the same things in > all cases, which includes negotiation of authentication mechanism if > any. (Negotiating GSSAPI for authentication after negotiating GSSAPI > for encryption will short-circuit rather than establishing a second > context, if I remember right.) Yes, you can see that around src/backend/libpq/auth.c:538 where we skip straight to pg_GSS_checkauth() if we already have encryption up and running, and if we don't then we go through pg_GSS_recvauth() (which will eventually call pg_GSS_checkauth() too). > I wonder if part of the confusion might be due to the synonyms we're > using here for "in use". Things seem to be "got running", "set up", > "operating", "negotiated", ... - maybe that's part of the barrier to > understanding? How about something like this? * If GSSAPI Encryption is enabled, then call pg_GSS_have_cred_cache() * which will return true if we can acquire credentials (and give us a * handle to use in conn->gcred), and then send a packet to the server * asking for GSSAPI Encryption (and skip past SSL negotiation and * regular startup below). Thanks, Stephen --CVXpx251GNNJP8Zs Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJeE6CaAAoJEO1sijiDR2RVXqsP/3evv/mB6PYferdjPPMmkC/Q Dpf6nqCFRi1/4ivRGGprMVTwPFtL1ioPT3/Lud+WJg3aal8QnWwt+XQAyl2D8HDv uhgKZqTvSrG663MElZtQeFU22+r3ymi1pqGwWQDC7Nmi02zyVMkbzu0w857/0a5v X3UovP6EnBmAcgM8jZzYa72YbUaZ9ot0tmpxSuVdUg9yDKgsvhIUG9He210q6QaW NHFEkXuaIPOC2oidP/9wtoLfBTWXGWZeutzxOEKm5cOIOLfII+FWOhQovxe/4it3 prhlNVN+oiecq0zmAsgVmFfmsW/AJnhu/l6zTO3M8anTqkKpCOGxqlccqAVIvHNL dDV2hJNLfeZnRjC0Rw5dQccvtksVxH7/Xxd25zvLP4bmdrNjKWnfKapF1n6RW9jq jxRmome2PtvbAb0gitAOtv5sl7bJmM/BXmaIv/KrXwLoCOfui4MoZBLGNren386O 6PvS5VceegIhZM3y/EKf/0rCPzex806HbgdWHCdA2ZvXjYKmc24BKianSs2asq5R pCQyPuBNtqO/UX3YaLKhvNF+HXykdHxr8OqwRVCRYl7gyjfW8Dgk/08fp0W3b2r0 9H5oeCUD1iOSxgBqTH267RkIBuRZ3wvjaZ/6kNKWpUz7R6u0NUsP3gboL8wVtXaU 9630l42JpZgPJ35HmvXw =boWm -----END PGP SIGNATURE----- --CVXpx251GNNJP8Zs--