Commit f2943901 authored by Simon Ruderich's avatar Simon Ruderich
Browse files

Use ioutil.ReadFile()

parent 3b97f0f1
Pipeline #4854 passed with stage
in 2 minutes and 11 seconds
......@@ -53,25 +53,19 @@ func main() {
"file in which the hmac secret is stored")
flag.Parse()
// setup hmac secret from file
f, err := os.Open(*hmacSecretFile)
if err != nil {
log.Fatalf("unable to open secrets file: %v", err)
}
hmacSecret, err := ioutil.ReadAll(f)
hmacSecret, err := ioutil.ReadFile(*hmacSecretFile)
if err != nil {
log.Fatalf("unable to read HMAC secret: %v", err)
}
// warn if hmac file has insecure permissions
s, err := f.Stat()
s, err := os.Stat(*hmacSecretFile)
if err != nil {
log.Fatalf("unable to fstat secrets file: %v", err)
}
if s.Mode().Perm()&0077 != 0 {
log.Fatalf("insecure permissions of secrets file")
}
f.Close()
l, err := net.Listen("tcp", ":ident")
if err != nil {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment