]> granicus.if.org Git - postgresql/commit
Allow group access on PGDATA
authorStephen Frost <sfrost@snowman.net>
Sat, 7 Apr 2018 21:45:39 +0000 (17:45 -0400)
committerStephen Frost <sfrost@snowman.net>
Sat, 7 Apr 2018 21:45:39 +0000 (17:45 -0400)
commitc37b3d08ca6873f9d4eaf24c72a90a550970cbb8
treea92cd4f79d20c4d002bd1f41af8bfe9507d92636
parentda9b580d89903fee871cf54845ffa2b26bda2e11
Allow group access on PGDATA

Allow the cluster to be optionally init'd with read access for the
group.

This means a relatively non-privileged user can perform a backup of the
cluster without requiring write privileges, which enhances security.

The mode of PGDATA is used to determine whether group permissions are
enabled for directory and file creates.  This method was chosen as it's
simple and works well for the various utilities that write into PGDATA.

Changing the mode of PGDATA manually will not automatically change the
mode of all the files contained therein.  If the user would like to
enable group access on an existing cluster then changing the mode of all
the existing files will be required.  Note that pg_upgrade will
automatically change the mode of all migrated files if the new cluster
is init'd with the -g option.

Tests are included for the backend and all the utilities which operate
on the PG data directory to ensure that the correct mode is set based on
the data directory permissions.

Author: David Steele <david@pgmasters.net>
Reviewed-By: Michael Paquier, with discussion amongst many others.
Discussion: https://postgr.es/m/ad346fe6-b23e-59f1-ecb7-0e08390ad629%40pgmasters.net
32 files changed:
doc/src/sgml/config.sgml
doc/src/sgml/ref/initdb.sgml
doc/src/sgml/ref/pg_basebackup.sgml
doc/src/sgml/ref/pg_receivewal.sgml
doc/src/sgml/ref/pg_recvlogical.sgml
doc/src/sgml/runtime.sgml
src/backend/bootstrap/bootstrap.c
src/backend/postmaster/postmaster.c
src/backend/tcop/postgres.c
src/backend/utils/init/globals.c
src/backend/utils/init/miscinit.c
src/backend/utils/misc/guc.c
src/bin/initdb/initdb.c
src/bin/initdb/t/001_initdb.pl
src/bin/pg_basebackup/pg_basebackup.c
src/bin/pg_basebackup/pg_receivewal.c
src/bin/pg_basebackup/pg_recvlogical.c
src/bin/pg_basebackup/streamutil.c
src/bin/pg_basebackup/t/010_pg_basebackup.pl
src/bin/pg_ctl/pg_ctl.c
src/bin/pg_ctl/t/001_start_stop.pl
src/bin/pg_resetwal/pg_resetwal.c
src/bin/pg_rewind/RewindTest.pm
src/bin/pg_rewind/pg_rewind.c
src/bin/pg_rewind/t/002_databases.pl
src/bin/pg_upgrade/pg_upgrade.c
src/bin/pg_upgrade/test.sh
src/common/file_perm.c
src/include/common/file_perm.h
src/include/miscadmin.h
src/test/perl/PostgresNode.pm
src/test/perl/TestLib.pm