node: dir and file permissions to allow non-root to read UUID

Signed-off-by: HeshamTB <hishaminv@gmail.com>
This commit is contained in:
HeshamTB 2024-03-15 00:26:22 +03:00
parent 5d6a69806a
commit 39d3b55a34
Signed by: Hesham
GPG Key ID: 74876157D199B09E

View File

@ -41,13 +41,13 @@ func InitNodeUUID() (*uuid.UUID, error) {
}
func createNodeUUID() (*uuid.UUID, error) {
err := os.MkdirAll(CONFIG_PATH, 0600)
err := os.MkdirAll(CONFIG_PATH, 0755)
if err != nil {
return nil, err
}
mode := os.O_RDWR | os.O_CREATE | os.O_EXCL
f, err := os.OpenFile(UUID_PATH, mode, 0600)
f, err := os.OpenFile(UUID_PATH, mode, 0644)
if err != nil {
return nil, err
}