optimize(db): set database directory permission to 0750 to protect privacy

This commit is contained in:
mzz2017 committed 2020-06-07 01:19:06 +08:00
1 parent 6e30ad4e77
commit 7d8017d631
2 files changed
+3 -2

No files matched your search

+2 -1
View File
@@ -17,8 +17,9 @@ func initDB() {
opt := nutsdb.DefaultOptions
opt.Dir = confPath
db, err = nutsdb.Open(opt)
// for privacy
defer os.Chmod(confPath, os.ModeDir|0750)
if err != nil {
_ = os.Chmod(confPath, os.ModeDir|0755)
log.Fatal(err)
}
}
+1 -1
View File
@@ -135,7 +135,7 @@ func initConfigure() {
//db
confPath := global.GetEnvironmentConfig().Config
if _, err := os.Stat(confPath); os.IsNotExist(err) {
_ = os.MkdirAll(path.Dir(confPath), os.ModeDir|0755)
_ = os.MkdirAll(path.Dir(confPath), os.ModeDir|0750)
}
if configure.IsConfigureNotExists() {
// need to migrate?