From: Peter Palfrader Date: Tue, 24 Sep 2019 09:10:39 +0000 (+0200) Subject: postgres-make-base-backups: resist running as root X-Git-Url: https://git.adam-barratt.org.uk/?a=commitdiff_plain;h=626a8c6e839113e1336edf5ab464ae85542f1124;p=mirror%2Fdsa-puppet.git postgres-make-base-backups: resist running as root --- diff --git a/modules/postgres/templates/backup_server/postgres-make-base-backups.erb b/modules/postgres/templates/backup_server/postgres-make-base-backups.erb index ab6cac8ad..ca17f62cb 100755 --- a/modules/postgres/templates/backup_server/postgres-make-base-backups.erb +++ b/modules/postgres/templates/backup_server/postgres-make-base-backups.erb @@ -41,6 +41,11 @@ STATEDIR=/var/lib/dsa/postgres-make-base-backups #### set -u +if [ "$(id -u)" = 0 ]; + echo >&2 "Do not run me as root. Probably you want sudo -u debbackup." + exit 1 +fi + SELF="`basename "$0"`[$$]" DELTA_WAIT_SUCCESS=$(( MAX_WAIT_SUCCESS - MIN_WAIT_SUCCESS )) MYHOSTNAME=$(hostname -f)