fix permissions of socket and log files

cc #726
This commit is contained in:
Gokcehan 2022-01-22 13:47:18 +03:00
parent ac4bdccf8d
commit 081d0585cd
2 changed files with 15 additions and 0 deletions

View File

@ -29,6 +29,10 @@ func run() {
if err != nil { if err != nil {
panic(err) panic(err)
} }
err = os.Chmod(gLogPath, 0600)
if err != nil {
panic(err)
}
defer f.Close() defer f.Close()
log.SetOutput(f) log.SetOutput(f)

View File

@ -20,6 +20,10 @@ func serve() {
if err != nil { if err != nil {
panic(err) panic(err)
} }
err = os.Chmod(gServerLogPath, 0600)
if err != nil {
panic(err)
}
defer f.Close() defer f.Close()
log.SetOutput(f) log.SetOutput(f)
@ -30,6 +34,13 @@ func serve() {
log.Printf("listening socket: %s", err) log.Printf("listening socket: %s", err)
return return
} }
if gSocketProt == "unix" {
err = os.Chmod(gSocketPath, 0600)
if err != nil {
log.Printf("chmod socket: %s", err)
return
}
}
defer l.Close() defer l.Close()
gListener = l gListener = l