You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[A clear and concise description of what the bug is]
How did you run kube-bench?
I modified the permissions of admin.conf and super_admin.conf on all Kubernetes control nodes to 600 as required by kube-bench 1.1.13, but the check still failed. When I ran it again with -v 5, I discovered that there was an error in parsing %n with stat.
The log content is below.
[Please specify exactly how you ran kube-bench, including details of command parameters and/or job file that you used to run it]
./kube-bench --config-dir /root/cks/kube-bench/cfg/ run master --check 1.1.13 -v 5
[Please include output from the report to illustrate the problem. If possible please supply logs generated with the -v 3 parameter.]
I1009 18:50:22.961379 47649 check.go:180] failed to run: "for adminconf in /etc/kubernetes/{admin.conf,super-admin.conf}; do if test -e $adminconf; then stat -c \\\"permissions=%a %n\\\" $adminconf; fi; done", output: "stat: cannot statx '%n\"': No such file or directory\n\"permissions=600\nstat: cannot statx '%n\"': No such file or directory\n\"permissions=600\n", error: exit status 1
I1009 18:50:22.961412 47649 check.go:186] Command: "for adminconf in /etc/kubernetes/{admin.conf,super-admin.conf}; do if test -e $adminconf; then stat -c \\\"permissions=%a %n\\\" $adminconf; fi; done\n" TestResult: <<EMPTY>>
I1009 18:50:22.961444 47649 check.go:190] failed to run: "for adminconf in /etc/kubernetes/{admin.conf,super-admin.conf}; do if test -e $adminconf; then stat -c \\\"permissions=%a %n\\\" $adminconf; fi; done", output: "stat: cannot statx '%n\"': No such file or directory\n\"permissions=600\nstat: cannot statx '%n\"': No such file or directory\n\"permissions=600\n", error: exit status 1
What did you expect to happen:
1.1.13 check should pass after I modified the permissions of admin.conf and super_admin.conf on all Kubernetes control nodes.
[Please describe what you expected to happen differently.]
The 1.1.13 Check still failed.
Environment
Rocky Linux release 9.4 (Blue Onyx)
[What is your version of kube-bench? (run kube-bench version)]
0.8.0
[What is your version of Kubernetes? (run kubectl version or oc version on OpenShift.)]
Client Version: v1.31.1
Kustomize Version: v5.4.2
Server Version: v1.31.0
Running processes
[Please include the output from running ps -eaf | grep kube on the affected node. This will allow us to check what Kubernetes processes are running, and how this compares to what kube-bench detected.]
This may not be the main reason, but you can still check it.
Configuration files
default file, I didn't change any content.
[If kube-bench is reporting an issue related to the settings defined in a config file, please attach the file, or include an extract showing the settings that are being detected incorrectly.]
Anything else you would like to add:
It seems there was an error executing the stat command. I tried it on my local machine and encountered issues when stat dealt with escape characters:
stat -c "permissions=%a %n" admin.conf
permissions=600 admin.conf
[root@k8s-master-1 kubernetes]# stat -c \"permissions=%a %n\" admin.conf
stat: cannot statx '%n"': No such file or directory
"permissions=600
[Miscellaneous information that will assist in solving the issue.]
The text was updated successfully, but these errors were encountered:
J0nathan1ei
changed the title
kube-bench 1.1.13 check issue
kube-bench 1.1.13 'stat' command has errors dealing with escape character.
Oct 9, 2024
Overview
[A clear and concise description of what the bug is]
How did you run kube-bench?
I modified the permissions of admin.conf and super_admin.conf on all Kubernetes control nodes to 600 as required by kube-bench 1.1.13, but the check still failed. When I ran it again with -v 5, I discovered that there was an error in parsing %n with stat.
The log content is below.
[Please specify exactly how you ran kube-bench, including details of command parameters and/or job file that you used to run it]
./kube-bench --config-dir /root/cks/kube-bench/cfg/ run master --check 1.1.13 -v 5
[Please include output from the report to illustrate the problem. If possible please supply logs generated with the
-v 3
parameter.]What did you expect to happen:
1.1.13 check should pass after I modified the permissions of admin.conf and super_admin.conf on all Kubernetes control nodes.
[Please describe what you expected to happen differently.]
The 1.1.13 Check still failed.
Environment
Rocky Linux release 9.4 (Blue Onyx)
[What is your version of kube-bench? (run
kube-bench version
)]0.8.0
[What is your version of Kubernetes? (run
kubectl version
oroc version
on OpenShift.)]Client Version: v1.31.1
Kustomize Version: v5.4.2
Server Version: v1.31.0
Running processes
[Please include the output from running
ps -eaf | grep kube
on the affected node. This will allow us to check what Kubernetes processes are running, and how this compares to what kube-bench detected.]This may not be the main reason, but you can still check it.
Configuration files
default file, I didn't change any content.
[If kube-bench is reporting an issue related to the settings defined in a config file, please attach the file, or include an extract showing the settings that are being detected incorrectly.]
Anything else you would like to add:
It seems there was an error executing the stat command. I tried it on my local machine and encountered issues when stat dealt with escape characters:
stat -c "permissions=%a %n" admin.conf
permissions=600 admin.conf
[root@k8s-master-1 kubernetes]# stat -c \"permissions=%a %n\" admin.conf
stat: cannot statx '%n"': No such file or directory
"permissions=600
[Miscellaneous information that will assist in solving the issue.]
The text was updated successfully, but these errors were encountered: