From: Stephen Frost <sfrost@snowman.net>
To: Michael Paquier <michael@paquier.xyz>
Cc: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Prevent running pg_basebackup as root
Date: Wed, 5 Feb 2020 12:22:59 -0500
Message-ID: <20200205172259.GW3195@tamriel.snowman.net> (raw)
In-Reply-To: <E1ixp9U-0005XS-59@gemulon.postgresql.org>
References: <E1ixp9U-0005XS-59@gemulon.postgresql.org>
Greetings,
* Michael Paquier (michael@paquier.xyz) wrote:
> Prevent running pg_basebackup as root
>
> 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.
>
> 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
Attachments:
signature.asc (application/pgp-signature, 818B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: sfrost@snowman.net, michael@paquier.xyz
Subject: Re: pgsql: Prevent running pg_basebackup as root
In-Reply-To: <20200205172259.GW3195@tamriel.snowman.net>
References: <E1ixp9U-0005XS-59@gemulon.postgresql.org> <20200205172259.GW3195@tamriel.snowman.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox