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 1kucxz-0005mj-Do for pgsql-general@arkaria.postgresql.org; Wed, 30 Dec 2020 15:00:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kucxy-0001ni-Ch for pgsql-general@arkaria.postgresql.org; Wed, 30 Dec 2020 15:00:46 +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 1kucxy-0001na-4x for pgsql-general@lists.postgresql.org; Wed, 30 Dec 2020 15:00:46 +0000 Received: from tamriel.snowman.net ([2001:470:e38f::11]) by magus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kucxw-0004yh-5d for pgsql-general@postgresql.org; Wed, 30 Dec 2020 15:00:45 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 2D1275F799; Wed, 30 Dec 2020 10:00:40 -0500 (EST) Date: Wed, 30 Dec 2020 10:00:40 -0500 From: Stephen Frost To: Tom Lane Cc: Gustavsson Mikael , Magnus Hagander , Kyotaro Horiguchi , "pgsql-general@postgresql.org" , Svensson Peter Subject: Re: Problem with ssl and psql in Postgresql 13 Message-ID: <20201230150039.GZ27507@tamriel.snowman.net> References: <737386.1608757126@sss.pgh.pa.us> <20201223211448.GR27507@tamriel.snowman.net> <738715.1608758847@sss.pgh.pa.us> <20201223214534.GS27507@tamriel.snowman.net> <740093.1608760567@sss.pgh.pa.us> <742641.1608762845@sss.pgh.pa.us> <1308863.1609016410@sss.pgh.pa.us> <1333636.1609020377@sss.pgh.pa.us> <1528843.1609108374@sss.pgh.pa.us> <2187460.1609263156@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="6TME3aayZmn2Ikqb" Content-Disposition: inline In-Reply-To: <2187460.1609263156@sss.pgh.pa.us> User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --6TME3aayZmn2Ikqb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Greetings, First, thanks a lot for working on all of this and improving things! * Tom Lane (tgl@sss.pgh.pa.us) wrote: > I've got one last complaint about the backend GSS code: we are doing > things randomly differently in the two places that install > krb_server_keyfile as the active KRB5_KTNAME value. secure_open_gssapi() > sets KRB5_KTNAME unconditionally (and doesn't bother to check for error, > either, not a good thing in a security-critical operation). But the older > code in pg_GSS_recvauth() is written to not override KRB5_KTNAME if it's > already set. This of-course-totally-undocumented behavior seems like a > fairly bad idea to me: as things stand, the client-side choice of whether > to initiate GSS encryption or not could result in two different server > keytabs being used. I agree that we should be consistent and that always setting the environment variable if krb_server_keyfile has been set is the right approach. > I think we'd be best off to always override KRB5_KTNAME if we have a > nonempty krb_server_keyfile setting, so the attached proposed patch > makes both functions do it the same way. (I did not make an effort > to remove the dependency on setenv, given the nearby thread to > standardize on that.) +1. > I'm not sure whether there's any documentation change that needs to > be made. The docs don't suggest that you're allowed to set > krb_server_keyfile to an empty string in the first place, so maybe > we needn't explain what happens if you do. Perhaps saying something about 'system default' or 'taken from the environment' might make sense. That said, the system default almost always ends up not being usable since it'll be owned by root and we won't run as root. Perhaps there are some who prefer to set it via the environment variable, though I don't think I've ever seen that myself. I didn't look too closely at the patch itself but on a once-over it seemed fine to me. Thanks, Stephen --6TME3aayZmn2Ikqb Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJf7JYXAAoJEO1sijiDR2RVay8P/2mY5yImna4qFVPk5qkXlAf3 BToDGOD+CTn6Ozcpzma/rPgL4JA/0ufqj3t+rwbZg7EoPd5WLB1QO6VYo5ggRpxL L+mW0FwTOd9BdjS7u3Ghrlk0D47qByt4OPJWHhKwaHvTTPfwBdOAwTVAWXqaL481 Vape6ysglzN8B5UR1Dr7RMXgnjA++3FUILUQSd1iWSLkXjC8JHqOtr5W6dpLn9dQ AFPeNL6QqgAFLp4Tr+RmoEm22GbCdj4Y+y63PeBRcZmXq/sn0HOK9q9oJm5ta8kJ hyPlU8lxodK2qVuKg2ef5nAr0JardHdfasXVwItLZMmYm/gvvMSgid0LzI4V1FbW XHJiaBnI2A21WthLFd92FU1iyT0XIxzMvx7SSP50s4FzSJ81HERTAWBlVIiiUoNc hLPuPFWB3hbkQ6LvnaF6fovlCGsiGgFe851rkn2teiCXN7EPESq+OAO+TDEZhvqb r2BGNixigA4bN+O65yWVXyU+pjrcZgLPY76z6PgHK2nDbgfMuPTFHCgG0au37Ayp AoPUtf8RW2eVB6A1esw/WNVpcrPd2N4VyGrD4vbWZvIBmueC+5Wb7dp2kLhw+A6Y PRQA+yUn4D4zfO1kVR0p6oY4mk72A2FxAdWJQsz2IrDjuS/jSm8PPGFpelMM7J4V EVp3sJtjyDqX/vrMEeUX =BzsO -----END PGP SIGNATURE----- --6TME3aayZmn2Ikqb--