Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
CIP-Admins
pcidentd
Commits
f2943901
Commit
f2943901
authored
Nov 28, 2017
by
Simon Ruderich
Browse files
Use ioutil.ReadFile()
parent
3b97f0f1
Pipeline
#4854
passed with stage
in 2 minutes and 11 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
main.go
View file @
f2943901
...
...
@@ -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
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment