From 081d0585cdc7ece52411eb4ae5308cd3869d3248 Mon Sep 17 00:00:00 2001 From: Gokcehan Date: Sat, 22 Jan 2022 13:47:18 +0300 Subject: [PATCH] fix permissions of socket and log files cc #726 --- client.go | 4 ++++ server.go | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/client.go b/client.go index 0f3a7f9..fd64b8c 100644 --- a/client.go +++ b/client.go @@ -29,6 +29,10 @@ func run() { if err != nil { panic(err) } + err = os.Chmod(gLogPath, 0600) + if err != nil { + panic(err) + } defer f.Close() log.SetOutput(f) diff --git a/server.go b/server.go index 70a7d7c..14cd199 100644 --- a/server.go +++ b/server.go @@ -20,6 +20,10 @@ func serve() { if err != nil { panic(err) } + err = os.Chmod(gServerLogPath, 0600) + if err != nil { + panic(err) + } defer f.Close() log.SetOutput(f) @@ -30,6 +34,13 @@ func serve() { log.Printf("listening socket: %s", err) return } + if gSocketProt == "unix" { + err = os.Chmod(gSocketPath, 0600) + if err != nil { + log.Printf("chmod socket: %s", err) + return + } + } defer l.Close() gListener = l