-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add k3s-cis-1.11 benchmark configuration #1977
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
base: main
Are you sure you want to change the base?
Conversation
|
|
|
@jbenzel thanks for your contribution! it's really nice! |
afdesk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jbenzel could you fix linter issue pls?
also It seems we need to update util.go here:
Line 558 in 76804bf
| case "k3s": |
@LaibaBareera WDYT?
|
@LaibaBareera could you pls take a look too when you have time? |
|
@jbenzel thanks! |
LaibaBareera
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution.
| - id: 1.1.4 | ||
| text: Ensure that the controller manager pod specification file ownership is set to root:root (Automated) | ||
| type: skip | ||
| audit: /bin/sh -c 'if test -e $controllermanagerconf; then stat -c %U:%G $controllermanagerconf; fi' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jbenzel, I noticed this check is marked as "skipped". Could you clarify why? Instead of skipping it, you could set the type to "manual".
| - flag: "is_compliant" | ||
| compare: | ||
| op: eq | ||
| value: "true" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you set the type to "manual", you don’t need to include the test— it can be skipped automatically.
|
@jbenzel @benzeljd I have a quick question about the origin of your PR (being one of the maintainer of the k3s/rke2/rke official profiles) Was this created entirely independently, or was any of it adapted from existing code using the recent security-scan project k3s-cis-1.11 ? If it utilizes or is based on some prior work, please ensure a clear reference is added (e.g., in a comment or the PR description) to align with attribution requirements of its license. Thanks for your contribution ! |
| - id: 4.2 | ||
| text: "Kubelet" | ||
| checks: | ||
| - id: 4.2.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jbenzel The current audit logic only checks the latest Running kubelet entry from journalctl, and if that log does not contain the --anonymous-auth flag, the check immediately falls back to the default value.
This is problematic for k3s because a kubelet flag may not always appear in the last log entry, even though it is still configured correctly in the kubelet config file ($kubeletconf). In such cases, kubebench will produce a false failure.
To avoid this, the audit logic should behave as follows:
If logs are present and the flag is found in the log, use that value.
If logs are present but the flag is not found, fall back to checking the kubelet config file.
If logs are not present at all, also check the config file.
Only if both sources are missing should we assume the default value.
This matches how other kubelet checks in kubebench behave and ensures correctness for k3s environments where kubelet args are sometimes set in config rather than in runtime logs.
I recommend updating the audit command accordingly to avoid false negatives.
Summary
Adds CIS Kubernetes Benchmark v1.11 configuration for K3s clusters (versions 1.29-1.34).
Changes
cfg/k3s-cis-1.11/directory with complete benchmark configurationcfg/config.yamlwith k3s-cis-1.11 version and target mappings