pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephen Frost <sfrost@snowman.net>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add default roles for file/program access
Date: Fri, 06 Apr 2018 18:47:38 +0000
Message-ID: <E1f4WOg-0007jI-Gx@gemulon.postgresql.org> (raw)

Add default roles for file/program access

This patch adds new default roles named 'pg_read_server_files',
'pg_write_server_files', 'pg_execute_server_program' which
allow an administrator to GRANT to a non-superuser role the ability to
access server-side files or run programs through PostgreSQL (as the user
the database is running as).  Having one of these roles allows a
non-superuser to use server-side COPY to read, write, or with a program,
and to use file_fdw (if installed by a superuser and GRANT'd USAGE on
it) to read from files or run a program.

The existing misc file functions are also changed to allow a user with
the 'pg_read_server_files' default role to read any files on the
filesystem, matching the privileges given to that role through COPY and
file_fdw from above.

Reviewed-By: Michael Paquier
Discussion: https://postgr.es/m/20171231191939.GR2416%40tamriel.snowman.net

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/0fdc8495bff02684142a44ab3bc5b18a8ca1863a

Modified Files
--------------
contrib/file_fdw/file_fdw.c             | 51 +++++++++++++++++++++------------
contrib/file_fdw/output/file_fdw.source |  2 +-
doc/src/sgml/file-fdw.sgml              |  8 ++++--
doc/src/sgml/func.sgml                  | 27 +++++++++++------
doc/src/sgml/ref/copy.sgml              |  8 ++++--
doc/src/sgml/user-manag.sgml            | 28 +++++++++++++++++-
src/backend/commands/copy.c             | 46 ++++++++++++++++++++---------
src/backend/utils/adt/genfile.c         | 16 +++++++++++
src/include/catalog/pg_authid.h         |  6 ++++
9 files changed, 145 insertions(+), 47 deletions(-)



Message-ID: <E1f4WOg-0007jI-Gx@gemulon.postgresql.org>
Permalink:  ../E1f4WOg-0007jI-Gx@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1f4WOg-0007jI-Gx@gemulon.postgresql.org

 · 

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
  Subject: Re: pgsql: Add default roles for file/program access
  In-Reply-To: <E1f4WOg-0007jI-Gx@gemulon.postgresql.org>
  References: <E1f4WOg-0007jI-Gx@gemulon.postgresql.org>

* 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