CIS 1.7 Self-Assessment Guide
Overview
This document is a companion to the RKE2 security hardening guide. The hardening guide provides prescriptive guidance for hardening a production installation of RKE2, and this benchmark guide is meant to help you evaluate the level of security of the hardened cluster against each control in the CIS Kubernetes benchmark. It is to be used by RKE2 operators, security teams, auditors, and decision makers.
This guide is specific to the v1.25 release line of RKE2 and the v1.7 release of the CIS Kubernetes Benchmark.
For more information about each control, including detailed rationales and descriptions checks, you can refer to the corresponding section of the CIS Kubernetes Benchmark v1.7. You can download the benchmark, after creating a free account, in Center for Internet Security (CIS).
Testing controls methodology
Each control in the CIS Kubernetes Benchmark was evaluated against a RKE2 cluster that was configured according to the accompanying hardening guide.
These are the possible results for each control:
- PASS - The RKE2 cluster under test passed the audit outlined in the benchmark.
- Not Applicable - The control is not applicable to RKE2 because of how it is designed to operate. The rationale section will explain why this is so.
- WARN - The control is manual in the CIS benchmark and depends on the manual operator intervention. The remediation section will provide guidance on how to achieve a PASS result.
1 Control Plane Security Configuration
1.1 Control Plane Node Configuration Files
1.1.1 Ensure that the API server pod specification file permissions are set to 600 or more restrictive (Automated)
Result: PASS
Audit:
stat -c permissions=%a /var/lib/rancher/rke2/agent/pod-manifests/kube-apiserver.yaml
Expected Result: permissions has permissions 600, expected 600 or more restrictive
Returned Value:
permissions=600
Remediation:
Run the below command (based on the file location on your system) on the
control plane node.
For example, chmod 600 /var/lib/rancher/rke2/agent/pod-manifests/kube-apiserver.yaml
1.1.2 Ensure that the API server pod specification file ownership is set to root:root (Automated)
Result: PASS
Audit:
/bin/sh -c 'if test -e /var/lib/rancher/rke2/agent/pod-manifests/kube-apiserver.yaml; then stat -c %U:%G /var/lib/rancher/rke2/agent/pod-manifests/kube-apiserver.yaml; fi'
Expected Result: 'root:root' is equal to 'root:root'
Returned Value:
root:root
Remediation:
Run the below command (based on the file location on your system) on the control plane node.
For example, chown root:root /var/lib/rancher/rke2/agent/pod-manifests/kube-apiserver.yaml
1.1.3 Ensure that the controller manager pod specification file permissions are set to 600 or more restrictive (Automated)
Result: PASS
Audit:
/bin/sh -c 'if test -e /var/lib/rancher/rke2/agent/pod-manifests/kube-controller-manager.yaml; then stat -c permissions=%a /var/lib/rancher/rke2/agent/pod-manifests/kube-controller-manager.yaml; fi'
Expected Result: permissions has permissions 600, expected 600 or more restrictive
Returned Value:
permissions=600
Remediation:
Run the below command (based on the file location on your system) on the control plane node.
For example, chmod 600 /var/lib/rancher/rke2/agent/pod-manifests/kube-controller-manager.yaml
1.1.4 Ensure that the controller manager pod specification file ownership is set to root:root (Automated)
Result: PASS
Audit:
/bin/sh -c 'if test -e /var/lib/rancher/rke2/agent/pod-manifests/kube-controller-manager.yaml; then stat -c %U:%G /var/lib/rancher/rke2/agent/pod-manifests/kube-controller-manager.yaml; fi'
Expected Result: 'root:root' is equal to 'root:root'
Returned Value:
root:root
Remediation:
Run the below command (based on the file location on your system) on the control plane node.
For example, chown root:root /var/lib/rancher/rke2/agent/pod-manifests/kube-controller-manager.yaml
1.1.5 Ensure that the scheduler pod specification file permissions are set to 600 or more restrictive (Automated)
Result: PASS
Audit:
/bin/sh -c 'if test -e /var/lib/rancher/rke2/agent/pod-manifests/kube-scheduler.yaml; then stat -c permissions=%a /var/lib/rancher/rke2/agent/pod-manifests/kube-scheduler.yaml; fi'
Expected Result: permissions has permissions 600, expected 600 or more restrictive
Returned Value:
permissions=600
Remediation:
Run the below command (based on the file location on your system) on the control plane node.
For example, chmod 600 /var/lib/rancher/rke2/agent/pod-manifests/kube-scheduler.yaml
1.1.6 Ensure that the scheduler pod specification file ownership is set to root:root (Automated)
Result: PASS
Audit:
/bin/sh -c 'if test -e /var/lib/rancher/rke2/agent/pod-manifests/kube-scheduler.yaml; then stat -c %U:%G /var/lib/rancher/rke2/agent/pod-manifests/kube-scheduler.yaml; fi'
Expected Result: 'root:root' is present
Returned Value:
root:root
Remediation:
Run the below command (based on the file location on your system) on the control plane node.
For example, chown root:root /var/lib/rancher/rke2/agent/pod-manifests/kube-scheduler.yaml
1.1.7 Ensure that the etcd pod specification file permissions are set to 600 or more restrictive (Manual)
Result: PASS
Audit:
/bin/sh -c 'if test -e /var/lib/rancher/rke2/agent/pod-manifests/etcd.yaml; then stat -c permissions=%a /var/lib/rancher/rke2/agent/pod-manifests/etcd.yaml; fi'
Expected Result: permissions has permissions 600, expected 600 or more restrictive
Returned Value:
permissions=600
Remediation:
If running master only with no etcd role, this check is Not applicable.
If controlplane and etcd roles are present on the same nodes but this check is warn then
Run the below command (based on the file location on your system) on the control plane node.
For example,
chmod 600 /var/lib/rancher/rke2/agent/pod-manifests/etcd.yaml
1.1.8 Ensure that the etcd pod specification file ownership is set to root:root (Manual)
Result: PASS
Audit:
/bin/sh -c 'if test -e /var/lib/rancher/rke2/agent/pod-manifests/etcd.yaml; then stat -c %U:%G /var/lib/rancher/rke2/agent/pod-manifests/etcd.yaml; fi'
Expected Result: 'root:root' is equal to 'root:root'
Returned Value:
root:root
Remediation:
If running master only with no etcd role, this check is Not applicable.
If controlplane and etcd roles are present on the same nodes but this check is warn then
Run the below command (based on the file location on your system) on the control plane node.
For example,
chown root:root /var/lib/rancher/rke2/agent/pod-manifests/etcd.yaml
1.1.9 Ensure that the Container Network Interface file permissions are set to 600 or more restrictive (Manual)
Result: WARN
Remediation:
Note that for many CNIs, a lock file is created with permissions 750. This is expected and can be ignored.
Run the below command (based on the file location on your system) on the control plane node.
For example, chmod 600 /var/lib/cni/networks/<filename> and chmod 600 /etc/cni/net.d/<filename>
1.1.10 Ensure that the Container Network Interface file ownership is set to root:root (Manual)
Result: PASS
Audit:
ps -fC ${kubeletbin:-kubelet} | grep -- --cni-conf-dir || echo "/etc/cni/net.d" | sed 's%.*cni-conf-dir[= ]\([^ ]*\).*%\1%' | xargs -I{} find {} -mindepth 1 | xargs --no-run-if-empty stat -c %U:%G
find /var/lib/cni/networks -type f 2> /dev/null | xargs --no-run-if-empty stat -c %U:%G