浏览代码

Fix #3361: Dumps are created world readable (#3473)

* Set dump file permission to 0600

* Typo
Thibault Meyer 8 年之前
父节点
当前提交
2c5411b00c
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      cmd/dump.go

+ 4 - 0
cmd/dump.go

@@ -96,6 +96,10 @@ func runDump(ctx *cli.Context) error {
 		log.Fatalf("Fail to save %s: %v", fileName, err)
 	}
 
+	if err := os.Chmod(fileName, 0600); err != nil {
+		log.Printf("Can't change file access permissions mask to 0600: %v", err)
+	}
+
 	log.Printf("Removing tmp work dir: %s", TmpWorkDir)
 	os.RemoveAll(TmpWorkDir)
 	log.Printf("Finish dumping in file %s", fileName)