pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephen Frost <sfrost@snowman.net>
To: Michael Paquier <michael@paquier.xyz>
Cc: Magnus Hagander <magnus@hagander.net>
Cc: pgsql-committers <pgsql-committers@lists.postgresql.org>
Subject: Re: pgsql: Prevent running pg_basebackup as root
Date: Fri, 7 Feb 2020 14:22:09 -0500
Message-ID: <20200207192208.GL3195@tamriel.snowman.net> (raw)
In-Reply-To: <20200207015530.GP23913@paquier.xyz>
References: <E1ixp9U-0005XS-59@gemulon.postgresql.org>
	<20200205172259.GW3195@tamriel.snowman.net>
	<20200206070417.GJ23913@paquier.xyz>
	<CABUevEyjDjGFkQdTWQNPJFxe8zHH2b53DNtW-vKrxyuMRA0MuQ@mail.gmail.com>
	<20200206144407.GF3195@tamriel.snowman.net>
	<20200207015530.GP23913@paquier.xyz>

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.
> 
> Hmm.  I don't think that you are completely correct here either as it
> depends on if the OS user "postgres" exists or not.  

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...
> > 
> > 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.
> 
> OK, done that part as of dcddc3f.

Great, thanks!

Stephen

Attachments:

  signature.asc (application/pgp-signature, 818B) download

view thread (9+ messages)

Message-ID: <20200207192208.GL3195@tamriel.snowman.net>
Permalink:  ../20200207192208.GL3195@tamriel.snowman.net/
Also on:    postgresql.org/message-id/20200207192208.GL3195@tamriel.snowman.net

 · 

reply

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, magnus@hagander.net
  Subject: Re: pgsql: Prevent running pg_basebackup as root
  In-Reply-To: <20200207192208.GL3195@tamriel.snowman.net>
  References: <E1ixp9U-0005XS-59@gemulon.postgresql.org> <20200205172259.GW3195@tamriel.snowman.net> <20200206070417.GJ23913@paquier.xyz> <CABUevEyjDjGFkQdTWQNPJFxe8zHH2b53DNtW-vKrxyuMRA0MuQ@mail.gmail.com> <20200206144407.GF3195@tamriel.snowman.net> <20200207015530.GP23913@paquier.xyz> <20200207192208.GL3195@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