+18
-1
lines changedFilter options
+18
-1
lines changed Original file line number Diff line number Diff line change
@@ -515,6 +515,7 @@ func TestParseCli(t *testing.T) {
515
515
[]string{"--delete-uploaded", "yes"},
516
516
options{
517
517
Directory: "/var/backups/postgresql",
518
+
Mode: 0o600,
518
519
Format: 'c',
519
520
DirJobs: 1,
520
521
CompressLevel: -1,
@@ -544,6 +545,7 @@ func TestParseCli(t *testing.T) {
544
545
[]string{"--delete-uploaded", "true"},
545
546
options{
546
547
Directory: "/var/backups/postgresql",
548
+
Mode: 0o600,
547
549
Format: 'c',
548
550
DirJobs: 1,
549
551
CompressLevel: -1,
Original file line number Diff line number Diff line change
@@ -169,6 +169,11 @@ func encryptFile(path string, mode int, params encryptParams, keep bool) ([]stri
169
169
}
170
170
171
171
encrypted = append(encrypted, dstFile)
172
+
if mode > 0 {
173
+
if err := os.Chmod(dstFile, os.FileMode(mode)); err != nil {
174
+
return fmt.Errorf("could not chmod to more secure permission for encrypted file: %w", err)
175
+
}
176
+
}
172
177
173
178
if !keep {
174
179
l.Verboseln("removing source file:", path)
Original file line number Diff line number Diff line change
@@ -750,10 +750,20 @@ func (d *dump) dump(fc chan<- sumFileJob) error {
750
750
if (mode&0o400 > 0) || (mode&0o200 > 0) {
751
751
mode = mode | 0o100
752
752
}
753
+
754
+
if (mode&0o040 > 0) || (mode&0o020 > 0) {
755
+
mode = mode | 0o010
756
+
}
757
+
758
+
if (mode&0o004 > 0) || (mode&0o002 > 0) {
759
+
mode = mode | 0o001
760
+
}
753
761
}
762
+
754
763
if err := os.Chmod(file, mode); err != nil {
755
764
return fmt.Errorf("could not chmod to more secure permission for %s: %w", dbname, err)
756
765
}
766
+
757
767
if isDirFormat {
758
768
// adapt mode on files on directory based on initial configured mode
759
769
if err := recursiveChmod(file, os.FileMode(d.Mode)); err != nil {
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ backup_directory = /var/backups/postgresql
14
14
# disable modifying permission and let the system handle that (example when
15
15
# umask is defined). When the format is set to directory, pg_back ensures
16
16
# the top-level directory is traversable by adding execute (+x) permission
17
-
# if read (r) or write (w) permission is set. This does not affect the
17
+
# if read (r) or write (w) permission is set and it set the configured
18
18
# permissions of files inside the directory.
19
19
backup_file_mode = 0600
20
20
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4