| name | cis-ocp-v180-1.2.17 |
| description | Ensure that the healthz endpoint is protected by RBAC (Manual) |
| category | cis-openshift |
| version | 1.8.0 |
| author | cyberstrike-official |
| tags | ["cis","openshift","kubernetes","redhat","control-plane","api-server"] |
| cis_id | 1.2.17 |
| cis_benchmark | CIS Red Hat OpenShift Container Platform Benchmark v1.8.0 |
| tech_stack | ["kubernetes","openshift","redhat"] |
| cwe_ids | [] |
| chains_with | [] |
| prerequisites | [] |
| severity_boost | {} |
CIS Red Hat OpenShift Container Platform Benchmark v1.8.0 - Control 1.2.17
Profile Applicability
Description
Disable profiling, if not needed.
Rationale
Profiling allows for the identification of specific performance bottlenecks. It generates a significant amount of program data that could potentially be exploited to uncover system and program details. If you are not experiencing any bottlenecks and do not need the profiler for troubleshooting purposes, it is recommended to turn it off to reduce the potential attack surface.
Impact
Profiling information would not be available.
Audit Procedure
Profiling is enabled by default in OpenShift. The API server operators expose Prometheus metrics via the metrics service. Profiling data is sent to healthzPort, the port of the localhost healthz endpoint. Changing this value may disrupt components that monitor the kubelet health. The default port value is 10248, and the healthz BindAddress is 127.0.0.1.
To ensure the collected data is not exploited, profiling endpoints are exposed at each master port and secured via RBAC (see cluster-debugger role). By default, the profiling endpoints are accessible only by users bound to cluster-admin or cluster-debugger role.
Profiling cannot be disabled.
To verify the configuration, run the following command to verify the Kubernetes API server endpoints:
oc -n openshift-kube-apiserver describe endpoints
Use the following steps to ensure Kubernetes API server metrics are protected by RBAC:
oc project openshift-kube-apiserver
export POD=$(oc get pods -n openshift-kube-apiserver -l app=openshift-kube-apiserver -o jsonpath='{.items[0].metadata.name}')
export PORT=$(oc get pods -n openshift-kube-apiserver -l app=openshift-kube-apiserver -o jsonpath='{.items[0].spec.containers[0].ports[0].hostPort}')
Verify unauthenticated access returns an HTTP 403:
oc rsh -n openshift-kube-apiserver $POD curl https://localhost:$PORT/metrics -k
Create a service account to test RBAC:
oc create -n openshift-kube-apiserver sa permission-test-sa
SA_TOKEN=$(oc sa -n openshift-kube-apiserver get-token permission-test-sa)