Add default roles for file/program access
authorStephen Frost <sfrost@snowman.net>
Fri, 6 Apr 2018 18:47:10 +0000 (14:47 -0400)
committerStephen Frost <sfrost@snowman.net>
Fri, 6 Apr 2018 18:47:10 +0000 (14:47 -0400)
commit0fdc8495bff02684142a44ab3bc5b18a8ca1863a
treea7918b3868e8e1720e3117307e6abc4c5a463565
parente79350fef2917522571add750e3e21af293b50fe
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
contrib/file_fdw/file_fdw.c
contrib/file_fdw/output/file_fdw.source
doc/src/sgml/file-fdw.sgml
doc/src/sgml/func.sgml
doc/src/sgml/ref/copy.sgml
doc/src/sgml/user-manag.sgml
src/backend/commands/copy.c
src/backend/utils/adt/genfile.c
src/include/catalog/pg_authid.h