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 1kXo6A-0001kp-G8 for pgsql-hackers@arkaria.postgresql.org; Wed, 28 Oct 2020 16:14:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kXo69-0003Gh-C2 for pgsql-hackers@arkaria.postgresql.org; Wed, 28 Oct 2020 16:14:53 +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 1kXo69-0003Ga-5M for pgsql-hackers@lists.postgresql.org; Wed, 28 Oct 2020 16:14:53 +0000 Received: from tamriel.snowman.net ([70.109.60.50]) by magus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kXo66-000380-Oa for pgsql-hackers@lists.postgresql.org; Wed, 28 Oct 2020 16:14:52 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 91BF15F799; Wed, 28 Oct 2020 12:14:48 -0400 (EDT) Date: Wed, 28 Oct 2020 12:14:48 -0400 From: Stephen Frost To: vignesh C Cc: PostgreSQL Hackers Subject: Re: Log message for GSS connection is missing once connection authorization is successful. Message-ID: <20201028161448.GE16415@tamriel.snowman.net> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="JMMA/5w7oqUUivCa" 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 --JMMA/5w7oqUUivCa Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Greetings, * vignesh C (vignesh21@gmail.com) wrote: > Log message for GSS connection is missing once connection > authorization is successful. We have similar log messages for SSL > connections once the connection authorization is successful. This > message will help the user to identify the connection that was > selected from the logfile. I'm not sure if this log message was > intentionally left out due to some reason for GSS. > If the above analysis looks correct, then please find a patch that > adds log for gss connections. >=20 > Thoughts? I agree with logging the principal and if GSS encryption is being used or not as part of the connection authorized message. Not logging the principal isn't great and has been something I've wanted to fix for a while, so glad to see someone else is thinking about this. > From 95c906b9eaf1493ad10ac65d6cf7b27a7dd6acb9 Mon Sep 17 00:00:00 2001 > From: Vignesh C > Date: Wed, 28 Oct 2020 08:19:06 +0530 > Subject: [PATCH v1] Log message for GSS connection is missing once connec= tion > authorization is successful. >=20 > Log message for GSS connection is missing once connection authorization is > successful. We have similar log message for SSL connections once the conn= ection > authorization is successful. This message will help the user to identify = the > connection that was selected from the logfile. > --- > src/backend/utils/init/postinit.c | 29 +++++++++++++++++++++++++++++ > 1 file changed, 29 insertions(+) >=20 > diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/p= ostinit.c > index d4ab4c7..0fd38b7 100644 > --- a/src/backend/utils/init/postinit.c > +++ b/src/backend/utils/init/postinit.c > @@ -267,6 +267,21 @@ PerformAuthentication(Port *port) > be_tls_get_compression(port) ? _("on") : _("off")))); > else > #endif > +#ifdef ENABLE_GSS > + if (be_gssapi_get_enc(port)) This is checking if GSS *encryption* is being used. > + ereport(LOG, > + (port->application_name !=3D NULL > + ? errmsg("replication connection authorized: user=3D%s applicatio= n_name=3D%s GSS enabled (gssapi autorization=3D%s, principal=3D%s)", > + port->user_name, > + port->application_name, > + be_gssapi_get_auth(port) ? _("on") : _("off"), > + be_gssapi_get_princ(port)) > + : errmsg("replication connection authorized: user=3D%s GSS enable= d (gssapi autorization=3D%s, principal=3D%s)", > + port->user_name, > + be_gssapi_get_auth(port) ? _("on") : _("off"), > + be_gssapi_get_princ(port)))); This is checking if GSS *authentication* was used. You can certainly have GSS authentication used without encryption, and you can (though I'm not sure how useful it really is) have GSS encryption with 'trust' authentication, so we should really break this out into their own sets of checks, which would look something like: if (be_gssapi_get_auth(port) || be_gssapi_get_princ(port)) connection authorized: GSS %s (principal=3D%s) With the first %s being: (authentication || encrypted || authenticated and = encrypted)=20 Or something along those lines, I would think. I don't think 'enabled' is a good term to use here. Thanks, Stephen --JMMA/5w7oqUUivCa Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJfmZj4AAoJEO1sijiDR2RVt4IQAKYcavmBpS5kehfExOsA3s1N c93IQVWJsuV1kqs5/kMlbKNpVPSLmeBxsbS+7Sf7MbdRzlUO6HpABLE9xJ5SNMeI l6dWShoi8KaWdUEfMA3RBZM6vzlJ5zYQMcGVe7v1Nm/XobpHqx5sKHhPsFeVAAD1 oeWgPCSqHuAntQGT280Yn9UaI3DxHzvC35rEo/IvwX8GFFXqCaC9KCfjYKx0T9vP K2nGKjaYy6Wb7zFlYBX8bFZloZTE1Sf6mDOIzEib92/W+VSgf1s2v2FREo0PpYTW W/BHqwPZn/y74S2G0WEw9xmeHFBZf5TIHWTclT+QYij9QJQBi+GP0EmU1dMc8rQT 7l6C+k5Z9xEeAV8lX4oLptr1PCgYuENn5ZCeQ/BQ1IO+lSlwesHCEB6rQidkkpap LdvrwsRv0PdDUCFqagCVcreW79qvUYxMEHFQM13n9qZECiD7stXYo/XzFSHFTiF6 x1QXsGvifuclw5NsSpFBvL+YdHShivMR2tAl7VhpQ5rLBPI8Vr2+imLBY0+ahNUg tqRQal77OqRYjlqNOlW+Q6DvOA1RlEp0mEY7nqwmDqcpVCIohpj0jpPJMv11224k Tojm49HiUHPfGfSIgYMFJBIARJKi/pmvFwi0rOFR7mvSeVxmoJgDo5/FiU+5BDxo oG6u4+yCfkgAd5DzckUH =3gEz -----END PGP SIGNATURE----- --JMMA/5w7oqUUivCa--