Merge pull request #49840 from markuskowa/fix-pgBackup

nixos/postgresqlBackup: set to umask to 0077
This commit is contained in:
Samuel Dionne-Riel 2018-11-14 01:40:38 +00:00 committed by GitHub
commit 58c0c2574c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 0 deletions

View File

@ -20,6 +20,8 @@ let
'';
script = ''
umask 0077 # ensure backup is only readable by postgres user
if [ -e ${cfg.location}/${db}.sql.gz ]; then
${pkgs.coreutils}/bin/mv ${cfg.location}/${db}.sql.gz ${cfg.location}/${db}.prev.sql.gz
fi

View File

@ -58,6 +58,7 @@ let
# Check backup service
$machine->succeed("systemctl start postgresqlBackup-postgres.service");
$machine->succeed("zcat /var/backup/postgresql/postgres.sql.gz | grep '<test>ok</test>'");
$machine->succeed("stat -c '%a' /var/backup/postgresql/postgres.sql.gz | grep 600");
$machine->shutdown;
'';