Browse Source

Make possible to configure the permissions of backup files (Debian patch 18_backup_files_persmissons)

Emmanuel Bouthenot 5 years ago
parent
commit
b6b750c30f
1 changed files with 5 additions and 1 deletions
  1. 5 1
      autopostgresqlbackup

+ 5 - 1
autopostgresqlbackup

@@ -99,6 +99,9 @@ OPT=""
 # Backup files extension
 EXT="sql"
 
+# Backup files permissions
+PERM=600
+
 # Encyrption settings
 # (inspired by http://blog.altudov.com/2010/09/27/using-openssl-for-asymmetric-encryption-of-backups/)
 #
@@ -353,7 +356,7 @@ exec 2> $LOGERR     # stderr replaced with file $LOGERR.
 dbdump () {
 	rm -f $2
 	touch $2
-	chmod 600 $2
+	chmod $PERM $2
 	for db in $1 ; do
 		if [ -n "$SU_USERNAME" ]; then
 			if [ "$db" = "$GLOBALS_OBJECTS" ]; then
@@ -385,6 +388,7 @@ encryption() {
 			-out "$ENCRYPTED_FILE" \
 			-in "$1" "$ENCRYPTION_PUBLIC_KEY" ; then
 			echo "	and remove $1"
+			chmod $PERM "$ENCRYPTED_FILE"
 			rm -f "$1"
 		fi
 	fi