CIS 1.8 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.26-1.31 release line of RKE2 and the v1.8 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.8. 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 control is automated (scored: true). The RKE2 cluster under test passed the audit outlined in the benchmark.
- Not Applicable - The control is not applicable (type: skip) to RKE2 because of how it is designed to operate. The rationale section will explain why this is so.
- WARN - The control is manual (scored: false) 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
Expected Result: 'root:root' is present
Returned Value:
root:root
root:root
root:root
root:root
root:root
root:root
root:root
root:root
root:root
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 <path/to/cni/files>
1.1.11 Ensure that the etcd data directory permissions are set to 700 or more restrictive (Manual)
Result: PASS
Audit:
stat -c permissions=%a /var/lib/rancher/rke2/server/db/etcd
Expected Result: permissions has permissions 700, expected 700 or more restrictive
Returned Value:
permissions=700
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
On the etcd server node, get the etcd data directory, passed as an argument --data-dir,
from the command 'ps -ef | grep etcd'.
Run the below command (based on the etcd data directory found above). For example,
chmod 700 /var/lib/rancher/rke2/server/db/etcd
1.1.12 Ensure that the etcd data directory ownership is set to etcd:etcd (Manual)
Result: PASS
Audit:
stat -c %U:%G /var/lib/rancher/rke2/server/db/etcd
Expected Result: 'etcd:etcd' is present
Returned Value:
etcd:etcd
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
On the etcd server node, get the etcd data directory, passed as an argument --data-dir,
from the command 'ps -ef | grep etcd'.
Run the below command (based on the etcd data directory found above).
For example, chown etcd:etcd /var/lib/rancher/rke2/server/db/etcd
1.1.13 Ensure that the admin.conf file permissions are set to 600 or more restrictive (Automated)
Result: PASS
Audit:
stat -c permissions=%a /var/lib/rancher/rke2/server/cred/admin.kubeconfig
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/server/cred/admin.kubeconfig
1.1.14 Ensure that the admin.conf file ownership is set to root:root (Automated)
Result: PASS
Audit:
stat -c %U:%G /var/lib/rancher/rke2/server/cred/admin.kubeconfig
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/server/cred/admin.kubeconfig
1.1.15 Ensure that the scheduler.conf file permissions are set to 600 or more restrictive (Automated)
Result: PASS
Audit:
/bin/sh -c 'if test -e /var/lib/rancher/rke2/server/cred/scheduler.kubeconfig; then stat -c permissions=%a /var/lib/rancher/rke2/server/cred/scheduler.kubeconfig; 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/server/cred/scheduler.kubeconfig
1.1.16 Ensure that the scheduler.conf file ownership is set to root:root (Automated)
Result: PASS
Audit:
stat -c %U:%G /var/lib/rancher/rke2/server/cred/scheduler.kubeconfig
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/server/cred/scheduler.kubeconfig
1.1.17 Ensure that the controller-manager.conf file permissions are set to 600 or more restrictive (Automated)
Result: PASS
Audit:
/bin/sh -c 'if test -e /var/lib/rancher/rke2/server/cred/controller.kubeconfig; then stat -c permissions=%a /var/lib/rancher/rke2/server/cred/controller.kubeconfig; 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/server/cred/controller.kubeconfig
1.1.18 Ensure that the controller-manager.conf file ownership is set to root:root (Automated)
Result: PASS
Audit:
stat -c %U:%G /var/lib/rancher/rke2/server/cred/controller.kubeconfig
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/server/cred/controller.kubeconfig
1.1.19 Ensure that the Kubernetes PKI directory and file ownership is set to root:root (Automated)
Result: PASS
Audit:
stat -c %U:%G /var/lib/rancher/rke2/server/tls
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 -R root:root /var/lib/rancher/rke2/server/tls
1.1.20 Ensure that the Kubernetes PKI certificate file permissions are set to 600 or more restrictive (Manual)
Result: WARN
Remediation:
Run the below command (based on the file location on your system) on the control plane node.
For example,
chmod -R 600 /var/lib/rancher/rke2/server/tls/*.crt