Skip to content

Commit

Permalink
Update /conf file permissions
Browse files Browse the repository at this point in the history
Signed-off-by: Utkarsh Bhatt <[email protected]>
  • Loading branch information
UtkarshBhatthere committed Aug 29, 2023
1 parent 9c3d9bf commit f855a80
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 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

0 comments on commit f855a80

Please sign in to comment.