Prevent pg_basebackup running as root

From: Ian Barwick <ian(dot)barwick(at)2ndquadrant(dot)com>
To: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Prevent pg_basebackup running as root
Date: 2020-01-30 05:29:06
Message-ID: CABvVfJVqOdD2neLkYdygdOHvbWz_5K_iWiqY+psMfA=FeAa3qQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

We encountered an unfortunate case of $SUBJECT the other day where it
would have been preferable to catch the error before rather than after
pg_basebackup ran.

I can't think of any practical reason why pg_basebackup would ever need to
be run as root; we disallow that for initdb, pg_ctl and pg_upgrade, so it
seems reasonable to do the same for pg_basebackup. Trivial patch attached,
which as with the other cases will allow only the --help/--version options
to be executed as root, otherwise nothing else.

The patch doesn't update the pg_basebackup documentation page; we don't
mention it in the pg_ctl and pg_upgrade pages either and it doesn't seem
particularly important to mention it explicitly.

I'll add this to the March CF.

Regards

Ian Barwick

--
Ian Barwick https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachment Content-Type Size
pg_basebackup-no-root.v1.patch text/x-patch 780 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2020-01-30 05:57:35 Re: Prevent pg_basebackup running as root
Previous Message Michael Paquier 2020-01-30 05:27:51 Re: BufFileRead() error signalling