-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix 4.1.7 and 4.1.8 audits: test flag from -z to -n #1467
Fix 4.1.7 and 4.1.8 audits: test flag from -z to -n #1467
Conversation
The test flag -z makes the node.yaml checks 4.1.7 and 4.1.8 to fail: as -z verifies if $CAFILE is zero instead of nonzero, to enter the first if condition and set CAFILE=$kubeletcafile. As per test man page: -n STRING the length of STRING is nonzero -z STRING the length of STRING is zero
The use of |
@mozillazg makes sense, the nature of Here is an example of the two processes that are returned (
As rke runs entirely within Docker containers, the first process is the entrypoint and parent (17000) of the second process kubelet (17411). Thus, in order to fix the Before:
After:
This said, I would lean towards implementing this improvement in the dedicated Let me know what you think, thanks ! |
@andypitcher SGTM. |
IMHO, Changing all previous cis versions is better, but implementing this improvement in the dedicated rke cis profiles is ok for me too. |
I agree to apply this change against all CIS versions (the ones that use this CIS profiles to improve are
Should I create a new PR with the updated files ^ (+ |
Yes. Thanks for your hard work. |
I'm closing this PR, following #1472 merge. |
Bug Details
Fix 4.1.7 and 4.1.8 audits: test flag from -z to -n (+ missing double quotes).
Target: node.yaml
Test ids: 4.1.7 and 4.1.8
Impacted CIS versions: 1.5 to 1.7
test -z
makes the node.yaml test ids4.1.7
and4.1.8
failing, as-z
verifies if $CAFILE iszero
instead ofnonzero
, to enter the first if condition and set CAFILE=$kubeletcafile.As per test man page:
Test environment
kube-bench version:
0.6.2
OS distro:
Ubuntu 18.04.6 LTS
K8s version:
rke1-v1.25.9
Bug Tests
Before patch
Failing commands:
Failing logs for 4.1.7 caused by missing double quotes :
Failing logs for 4.1.8 caused by missing double quotes:
Failing logs for 4.1.7 with fixed double quotes, but test
-z
present :Failing logs for 4.1.8 with fixed double quotes, but test
-z
present:After patch (
double quotes + test -n
)Successful commands:
Successful logs for 4.1.7:
Successful logs for 4.1.8: