Bug #19453
closedkatello-backup does not apply postgres group owner to the whole backup path
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1432013
Description of problem:
katello-backup does not apply postgres group owner to the whole backup path
Version-Release number of selected component (if applicable):
katello-common-3.0.0-17.el7sat.noarch
How reproducible:
everytime
1. make backup top level directory belonging to root group
- ls
la /backup. 2 root root 6 Mar 14 10:17 .
total 4
drwxrwx--
2. run o# katello-backup --skip-pulp-content --online-backup /backup/db-backup-2017-03-13/
Starting backup: 2017-03-14 10:17:58 +0000
Creating backup folder /backup/db-backup-2017-03-13/katello-backup-2017-03-14T10:17:58+00:00
Redirecting to /bin/systemctl stop foreman-tasks.service
Redirecting to /bin/systemctl stop httpd.service
Redirecting to /bin/systemctl stop pulp_workers.service
Redirecting to /bin/systemctl stop foreman-proxy.service
Redirecting to /bin/systemctl stop pulp_streamer.service
Redirecting to /bin/systemctl stop pulp_resource_manager.service
Redirecting to /bin/systemctl stop pulp_celerybeat.service
Redirecting to /bin/systemctl stop smart_proxy_dynflow_core.service
Redirecting to /bin/systemctl stop tomcat.service
Redirecting to /bin/systemctl stop squid.service
Redirecting to /bin/systemctl stop qdrouterd.service
Redirecting to /bin/systemctl stop qpidd.service
Redirecting to /bin/systemctl stop postgresql.service
Redirecting to /bin/systemctl stop mongod.service
Backing up config files...
tar: Removing leading `/' from member names
Done.
Backing up postgres db...
-bash: /backup/db-backup-2017-03-13/katello-backup-2017-03-14T10:17:58+00:00/foreman.dump: Permission denied
-bash: /backup/db-backup-2017-03-13/katello-backup-2017-03-14T10:17:58+00:00/candlepin.dump: Permission denied
Done.
Backing up mongo db...
couldn't connect to [localhost] couldn't connect to server localhost:27017 (127.0.0.1), connection attempt failed
Done.- BACKUP Complete, contents can be found in: /backup/db-backup-2017-03-13/katello-backup-2017-03-14T10:17:58+00:00 **
nline backup
- BACKUP Complete, contents can be found in: /backup/db-backup-2017-03-13/katello-backup-2017-03-14T10:17:58+00:00 **
Top level and intermediate directory belongs to root so postgres user can't dump database
- ls
lRa /backup. 3 root root 33 Mar 14 10:17 .
/backup:
total 4
drwxrwx--
dr-xr-xr-x. 18 root root 4096 Mar 13 13:30 ..
drwxr-xr-x. 3 root root 53 Mar 14 10:17 db-backup-2017-03-13
/backup/db-backup-2017-03-13:
total 0
drwxr-xr-x. 3 root root 53 Mar 14 10:17 .
drwxrwx---. 3 root root 33 Mar 14 10:17 ..
drwxrwx---. 2 root postgres 51 Mar 14 10:17 katello-backup-2017-03-14T10:17:58+00:00
Expected results:
postgres group should be propagated from top to bottom if we wish to write postgres dumps:
`runuser - postgres -c "pg_dump -Fc foreman > #{@dir}/foreman.dump"`
`runuser - postgres -c "pg_dump -Fc candlepin > #{@dir}/candlepin.dump"
..or - write dumps to temporary directory and then copy
Additional info: