Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
kube-bench
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
aquasecurity
kube-bench
Commits
f589fd58
Commit
f589fd58
authored
8 years ago
by
Abubakr-Sadik Nii Nai Davis
Browse files
Options
Downloads
Patches
Plain Diff
Add few modifications.
parent
3d395994
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
check/check.go
+3
-3
3 additions, 3 deletions
check/check.go
cmd/util.go
+14
-2
14 additions, 2 deletions
cmd/util.go
with
17 additions
and
5 deletions
check/check.go
+
3
−
3
View file @
f589fd58
...
...
@@ -106,7 +106,7 @@ func (c *Check) Run(verbose bool) {
cs
[
i
-
1
]
.
Stdout
,
err
=
cs
[
i
]
.
StdinPipe
()
errmsgs
+=
handleError
(
err
,
fmt
.
Sprintf
(
"
check.Run: Audit %s failed
\n
failing
command: %s"
,
fmt
.
Sprintf
(
"
failed to run: %s
\n
failed
command: %s"
,
c
.
Audit
,
cs
[
i
]
.
Args
,
),
...
...
@@ -121,7 +121,7 @@ func (c *Check) Run(verbose bool) {
err
:=
cs
[
i
]
.
Start
()
errmsgs
+=
handleError
(
err
,
fmt
.
Sprintf
(
"
check.Run: Audit %s failed
\n
failing
command: %s"
,
fmt
.
Sprintf
(
"
failed to run: %s
\n
failed
command: %s"
,
c
.
Audit
,
cs
[
i
]
.
Args
,
),
...
...
@@ -135,7 +135,7 @@ func (c *Check) Run(verbose bool) {
err
:=
cs
[
i
]
.
Wait
()
errmsgs
+=
handleError
(
err
,
fmt
.
Sprintf
(
"
check.Run: Audit %s failed
\n
failing
command:
%s"
,
fmt
.
Sprintf
(
"
failed to run: %s
\n
failed
command:%s"
,
c
.
Audit
,
cs
[
i
]
.
Args
,
),
...
...
This diff is collapsed.
Click to expand it.
cmd/util.go
+
14
−
2
View file @
f589fd58
...
...
@@ -56,7 +56,13 @@ func verifyBin(binPath ...string) []string {
// Construct proc name for ps(1)
for
_
,
b
:=
range
binPath
{
binList
+=
b
+
","
_
,
err
:=
exec
.
LookPath
(
b
)
errmsgs
+=
handleError
(
err
,
fmt
.
Sprintf
(
"%s: command not found in path"
,
b
),
)
}
binList
=
strings
.
Trim
(
binList
,
","
)
// Run ps command
...
...
@@ -64,7 +70,7 @@ func verifyBin(binPath ...string) []string {
out
,
err
:=
cmd
.
Output
()
errmsgs
+=
handleError
(
err
,
fmt
.
Sprintf
(
"
verifyBin: %s failed"
,
binList
),
fmt
.
Sprintf
(
"
failed to run: %s"
,
cmd
.
Args
),
)
// Actual verification
...
...
@@ -84,12 +90,18 @@ func verifyKubeVersion(b string) []string {
// TODO! Check the version number using kubectl, which is more likely to be on the path.
var
w
[]
string
_
,
err
:=
exec
.
LookPath
(
b
)
errmsgs
+=
handleError
(
err
,
fmt
.
Sprintf
(
"%s: command not found on path - version check skipped"
,
b
),
)
// Check version
cmd
:=
exec
.
Command
(
b
,
"--version"
)
out
,
err
:=
cmd
.
Output
()
errmsgs
+=
handleError
(
err
,
fmt
.
Sprintf
(
"
verifyKubeVersion: failed
\n
Command
:%s"
,
cmd
.
Args
),
fmt
.
Sprintf
(
"
failed to run
:%s"
,
cmd
.
Args
),
)
matched
:=
strings
.
Contains
(
string
(
out
),
kubeVersion
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment