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 1j09Cd-0007Vl-GE for pgsql-committers@arkaria.postgresql.org; Fri, 07 Feb 2020 19:22:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j09Cc-0003lQ-26 for pgsql-committers@arkaria.postgresql.org; Fri, 07 Feb 2020 19:22:10 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j09Cb-0003l3-Nk for pgsql-committers@lists.postgresql.org; Fri, 07 Feb 2020 19:22:09 +0000 Received: from tamriel.snowman.net ([2001:470:e38f::11]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1j09CZ-0008Gr-39 for pgsql-committers@lists.postgresql.org; Fri, 07 Feb 2020 19:22:08 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 1DE9A5F799; Fri, 7 Feb 2020 14:22:09 -0500 (EST) Date: Fri, 7 Feb 2020 14:22:09 -0500 From: Stephen Frost To: Michael Paquier Cc: Magnus Hagander , pgsql-committers Subject: Re: pgsql: Prevent running pg_basebackup as root Message-ID: <20200207192208.GL3195@tamriel.snowman.net> References: <20200205172259.GW3195@tamriel.snowman.net> <20200206070417.GJ23913@paquier.xyz> <20200206144407.GF3195@tamriel.snowman.net> <20200207015530.GP23913@paquier.xyz> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="p3CrQT/P+9bm4D8i" Content-Disposition: inline In-Reply-To: <20200207015530.GP23913@paquier.xyz> User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --p3CrQT/P+9bm4D8i Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Greetings, * Michael Paquier (michael@paquier.xyz) wrote: > On Thu, Feb 06, 2020 at 09:44:07AM -0500, Stephen Frost wrote: > > Erm- no, with -Ft + untar-as-root they get owned by "postgres", NOT the > > original user. That's what I was pointing out up-thread (since it seems > > to be confusing- and clearly not always well understood..) and it's an > > issue imv, but it's independent of this, so probably deserves its own > > thread if someone wants to do something about that. >=20 > Hmm. I don't think that you are completely correct here either as it > depends on if the OS user "postgres" exists or not. =20 Yes, I do know what happens if the named user doesn't exist, but in the general case, where the 'postgres' user does exist, they'll get owned by 'postgres'. > As mentioned in > https://www.gnu.org/software/tar/manual/tar.html#SEC138, if the user > name cannot be found in /etc/passwd, then tar switches to the user ID > (if one does not have any user or group named "postgres", then the > files are untar'ed with the same user and group as the one running the > cluster and that's to the UID and GID set by tarCreateHeader, as you > say). I think that it is a problem to not have more documentation on > the matter (now there is just a small mention in the base backup > restore about being sure to have the proper permissions). And it may > be interesting to add into pg_basebackup options to enforce the user > and/or group similarly to what tar does with --owner and --group? Yes, I agree with improving the documentation and with adding such options. > >> I agree with Stephen that this seems to be misguided, and my vote is > >> to revert. I would've also objected had you given more than 2 days > >> warning before committing, and it happened to be during FOSDEM. I saw > >> the original email which clearly said it'd be in the March commitfest, > >> so I figured I'd have time... > >=20 > > Yeah, I also agree with reverting this change. Even if we can come to > > something we all agree on, I'm pretty confident it's not going to be > > exactly this patch, so let's back it out for now and discuss it further > > on the -hackers thread. >=20 > OK, done that part as of dcddc3f. Great, thanks! Stephen --p3CrQT/P+9bm4D8i Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJePbjgAAoJEO1sijiDR2RV+3gP/jr0GWeap+BrKNcY4k93WINt F+5nID1RCwEEPEGyT6leXN0sj1EesGcmJj1eSe28oQaTn90L75ZST2aDElofosNr r9lsrJWCKXuNZGqJrDM1ap7i54wKMytdMkeWyBSDprxWS0DQjarPlyQqNQmsmlGz DLAaX73PrctmI88dwmYUffDYuVW6hV0kgUd88lmEvFdVs9PkQbH3InwK70VwiFXT cDnm9Y1nt7NJXJdCci120P7pmE0uW+THt5IEw5CJvBBf/XX7ts2SgwkMDt0MjtMj 89ir1+2qyfRKP3HGsLjltL9m3hUjT8q+I0f/yK8AyIm+i7UTMhlpuuU6b/kpqV0T qnrcyIIKfwFJbkBNMAOuqUAr1HTv+Gr3pHhJPadglUzpW47qZ/OgehGpsgIHIE0K Lkj57+whorNYzVvsY6zH3Aoo74cRvnbrEz1/a11RZLZ7PL4Lu+bUc8obidj6DDp7 9GPRZYmRZFE1RwomGXII7mTRmOw2QP8B38LcjGP3bq56COJvuRlDggfSNibah29E r1Kal4GuTkRAXbg4lyvpjA12aH7uXkRI5HK0X+Z1XNM/GUNZ7PgD4nwEDwFfrfH1 gWDZXsTv65wlh9k5i+lry76gQDYpwEal1TWz7T36aK5GQTBVgBNmg8BaTqoZ2d/q gJryWRoz0aPhmf8aYubZ =nvXC -----END PGP SIGNATURE----- --p3CrQT/P+9bm4D8i--