Skip to content

Conversation

@jbenzel
Copy link

@jbenzel jbenzel commented Oct 15, 2025

Summary

Adds CIS Kubernetes Benchmark v1.11 configuration for K3s clusters (versions 1.29-1.34).

Changes

  • Added cfg/k3s-cis-1.11/ directory with complete benchmark configuration
    • config.yaml (component settings)
    • master.yaml (60 control plane checks - Sections 1.1-1.4)
    • etcd.yaml (7 etcd checks - Section 2)
    • controlplane.yaml (3 control plane config checks - Section 3)
    • node.yaml (25 worker node checks - Sections 4.1-4.3)
    • policies.yaml (35 policy checks - Sections 5.1-5.6)
  • Updated cfg/config.yaml with k3s-cis-1.11 version and target mappings

@CLAassistant
Copy link

CLAassistant commented Oct 15, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ jbenzel
❌ benzeljd
You have signed the CLA already but the status is still pending? Let us recheck it.

@afdesk
Copy link
Collaborator

afdesk commented Oct 16, 2025

@jbenzel thanks for your contribution! it's really nice!

Copy link
Collaborator

@afdesk afdesk left a 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:

case "k3s":

@LaibaBareera WDYT?

@afdesk afdesk assigned afdesk and unassigned afdesk Oct 17, 2025
@afdesk
Copy link
Collaborator

afdesk commented Oct 17, 2025

@LaibaBareera could you pls take a look too when you have time?

@afdesk
Copy link
Collaborator

afdesk commented Oct 17, 2025

@jbenzel thanks!
could you sign license/cla?

@andypitcher
Copy link
Contributor

Copy link
Contributor

@LaibaBareera LaibaBareera left a 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'
Copy link
Contributor

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"
Copy link
Contributor

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.

@andypitcher
Copy link
Contributor

@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
Copy link

@ShashankSanil ShashankSanil Nov 17, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants