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 1izOOF-0008WG-Gc for pgsql-committers@arkaria.postgresql.org; Wed, 05 Feb 2020 17:23:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1izOOE-0002Fv-79 for pgsql-committers@arkaria.postgresql.org; Wed, 05 Feb 2020 17:23:02 +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 1izOOD-0002Fo-Vj for pgsql-committers@lists.postgresql.org; Wed, 05 Feb 2020 17:23:02 +0000 Received: from tamriel.snowman.net ([96.255.250.162]) by magus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1izOOA-0000vC-6G for pgsql-committers@lists.postgresql.org; Wed, 05 Feb 2020 17:23:00 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 406605F7A7; Wed, 5 Feb 2020 12:22:59 -0500 (EST) Date: Wed, 5 Feb 2020 12:22:59 -0500 From: Stephen Frost To: Michael Paquier Cc: pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Prevent running pg_basebackup as root Message-ID: <20200205172259.GW3195@tamriel.snowman.net> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="hn0ewh8UgXHJ12ee" 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 --hn0ewh8UgXHJ12ee Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Greetings, * Michael Paquier (michael@paquier.xyz) wrote: > Prevent running pg_basebackup as root >=20 > Similarly to pg_upgrade, pg_ctl and initdb, a root user is able to use > --version and --help, but cannot execute the actual operation to avoid > the creation of files with permissions incompatible with the > postmaster. >=20 > This is a behavior change, so not back-patching is done. While it's maybe not ideal, surely there isn't an actual issue if pg_basebackup is run as root with -Ft, is there..? There's possibly something to be said about the fact that we hard-code the username/groupname in the tar file too (interestingly, we actually do pass through the uid/gid..)- perhaps we should actually be passing the username/groupname through, but if we did do something like that then having pg_basebackup running as root would be necessary if we want to preserve the file ownership. In any case, sorry for not responding on this sooner (was traveling for FOSDEM and such), but I'm not really convinced this is something we want and it certainly breaks at least somewhat reasonable use-cases when you think about using pg_basebackup with -Ft. In that vein, this change is kinda like saying "you can't run pg_dump as root".. Thanks, Stephen --hn0ewh8UgXHJ12ee Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJeOvnyAAoJEO1sijiDR2RV+YEQALNgOQ+5A5/aOSzKTQ8A2/2e lISY2dZLBwboEja+orX1e8kYDwOSIYESt3xDaUUmJIEYknl3r82g6hFpugCgFQB7 Qk1n7rxP4V4kdgIee4MSA59ohzHUnm3UJ4smLEODE+INZBfVR8Qy6WYiOu8zKCAS ruWUQKrb5ImFtTcaYOTFRUHuUxj6mHmrGJBwCqKHPbL/fcFc0glVFv07nGnvrouP QiVthswYrOwKvnV1szYHCjvZCzxVEqLPz8zJwssSS/sRQIBx9COIOyNgwqKyHnYw BlamlTw6JQAsB6XcErzPBqncXjUalxkqX0nt1cMPmI8SQeY7cYrcDlroJnSeVBaF mrZS7ZXucZS5sc6CVp52DpiWSMNjGVzbrGePhRnUF9ZXOTkYqTEIwuOwrCTLHm29 5P9x+xDYjnlL7+ncJI0sQjUgHsNDzcSfhules6ez2fze3r79exwCTlwUBRDKNXzB G1eZ+OU+/qkU6DT7zM1huZl/t0PlxAx6MWLi96wRquG15F3ZeGsknkB4j6mtGShi sp2GCH/DujDFCBiQnOzuPuJVYzppkbbTH/vNFm50JUGlcfMv/x9BC7vikEm6Udik Dnlyqwor+p7WtcJgp34fPuf0qbKXtSRvj6ZjXLqYKeu2A3IgGQA8HaG+yShgSmLn WL3FTvTjns0JuFcSDTxF =TnSU -----END PGP SIGNATURE----- --hn0ewh8UgXHJ12ee--