Skip to content

Commit

Permalink
Merge pull request #198 from UtkarshBhatthere/issues/196
Browse files Browse the repository at this point in the history
Update /conf file permissions
  • Loading branch information
sabaini authored Aug 30, 2023
2 parents 9c3d9bf + b5f5f11 commit 8034cb7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion microceph/ceph/configwriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ func (c *Config) GetPath() string {

// WriteConfig writes the configuration file given a data bag
func (c *Config) WriteConfig(data map[string]any) error {
fd, err := os.OpenFile(c.GetPath(), os.O_CREATE|os.O_TRUNC|os.O_RDWR, 0644)
mode := int(0640) // rw: user, r: group, others: none.
fd, err := os.OpenFile(c.GetPath(), os.O_CREATE|os.O_TRUNC|os.O_RDWR, os.FileMode(mode))
if err != nil {
return fmt.Errorf("Couldn't write %s: %w", c.configFile, err)
}
Expand Down
2 changes: 1 addition & 1 deletion microceph/ceph/testutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func copyTestConf(dir string, conf string) error {
if err != nil {
return err
}
err = os.WriteFile(filepath.Join(dir, "SNAP_DATA", "conf", conf), source, 0644)
err = os.WriteFile(filepath.Join(dir, "SNAP_DATA", "conf", conf), source, 0640)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion microceph/common/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func GetPathConst() PathConst {
func GetPathFileMode() PathFileMode {
pathConsts := GetPathConst()
return PathFileMode{
pathConsts.ConfPath: 0755,
pathConsts.ConfPath: 0750,
pathConsts.RunPath: 0700,
pathConsts.DataPath: 0700,
pathConsts.LogPath: 0700,
Expand Down

0 comments on commit 8034cb7

Please sign in to comment.