Skip to content

Commit ab4e912

Browse files
committed
CMP-3580: Implement checks for unsupported API server configs
CIS has guidance that recommends checking Kubernetes and OpenShift API servers for any unsupported configuration options (control 1.2.33 in newer versions and 1.2.31 in recent versions). This commit adds two new rules to check the API servers for unsupported configs so that users have some automated way of checking this control, even though OpenShift doesn't use this feature by default.
1 parent 7cdcb3a commit ab4e912

File tree

4 files changed

+95
-3
lines changed

4 files changed

+95
-3
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
title: Ensure No Unsupported Configuration Overrides are Used
2+
3+
description: |-
4+
Kubernetes API servers should not use unsupported configuration overrides that
5+
can potentially compromise the security and stability of the cluster. This
6+
rule checks that no unsupported configuration overrides are present in the
7+
cluster API server configurations.
8+
9+
rationale: |-
10+
Unsupported configuration overrides can introduce security vulnerabilities,
11+
performance issues, and unexpected behaviors in the cluster. They bypass the
12+
standard configuration mechanisms and can potentially weaken the cluster's
13+
security posture or introduce instability.
14+
15+
severity: medium
16+
17+
identifiers:
18+
cce@ocp4: CCE-89304-0
19+
20+
references:
21+
cis@ocp4: 1.2.31
22+
23+
{{% set jqfilter = '[.items[] | select(.spec.unsupportedConfigOverrides != null and .spec.unsupportedConfigOverrides != {}) | .metadata.name]' %}}
24+
25+
ocil_clause: 'Unsupported Kubernetes API server configuration overrides are detected'
26+
27+
ocil: |-
28+
Run the following commands to check for unsupported configuration overrides:
29+
<pre>$ oc get kubeapiserver/cluster -o jsonpath='{.spec.unsupportedConfigOverrides}'</pre>
30+
Verify that these commands return an empty object or no output.
31+
32+
warnings:
33+
- general: |-
34+
{{{ openshift_filtered_cluster_setting({'/apis/config.openshift.io/v1/kubeapiservers': jqfilter}) | indent(4) }}}
35+
36+
template:
37+
name: yamlfile_value
38+
vars:
39+
ocp_data: "true"
40+
filepath: {{{ openshift_filtered_path('/apis/config.openshift.io/v1/kubeapiservers', jqfilter) }}}
41+
yamlpath: "[:]"
42+
check_existence: "none_exist"
43+
entity_check: "all"
44+
values:
45+
- value: "(.*?)"
46+
operation: "pattern match"
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
title: Ensure No Unsupported Configuration Overrides are Used
2+
3+
description: |-
4+
OpenShift API servers should not use unsupported configuration overrides that
5+
can potentially compromise the security and stability of the cluster. This
6+
rule checks that no unsupported configuration overrides are present in the
7+
cluster API server configurations.
8+
9+
rationale: |-
10+
Unsupported configuration overrides can introduce security vulnerabilities,
11+
performance issues, and unexpected behaviors in the cluster. They bypass the
12+
standard configuration mechanisms and can potentially weaken the cluster's
13+
security posture or introduce instability.
14+
15+
severity: medium
16+
17+
identifiers:
18+
cce@ocp4: CCE-89950-0
19+
20+
references:
21+
cis@ocp4: 1.2.31
22+
23+
{{% set jqfilter = '[.items[] | select(.spec.unsupportedConfigOverrides != null and .spec.unsupportedConfigOverrides != {}) | .metadata.name]' %}}
24+
25+
ocil_clause: 'Unsupported OpenShift API server configuration overrides are detected'
26+
27+
ocil: |-
28+
Run the following commands to check for unsupported configuration overrides:
29+
<pre>$ oc get openshiftapiserver/cluster -o jsonpath='{.spec.unsupportedConfigOverrides}'</pre>
30+
Verify that these commands return an empty object or no output.
31+
32+
warnings:
33+
- general: |-
34+
{{{ openshift_filtered_cluster_setting({'/apis/config.openshift.io/v1/openshiftapiservers': jqfilter}) | indent(4) }}}
35+
36+
template:
37+
name: yamlfile_value
38+
vars:
39+
ocp_data: "true"
40+
filepath: {{{ openshift_filtered_path('/apis/config.openshift.io/v1/openshiftapiservers', jqfilter) }}}
41+
yamlpath: "[:]"
42+
check_existence: "none_exist"
43+
entity_check: "all"
44+
values:
45+
- value: "(.*?)"
46+
operation: "pattern match"

controls/cis_ocp/section-1.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,9 @@ controls:
461461
- id: 1.2.33
462462
title: Ensure unsupported configuration overrides are not used
463463
status: pending
464-
rules: []
464+
rules:
465+
- api_server_no_unsupported_config_overrides
466+
- api_server_kube_no_unsupported_config_overrides
465467
levels:
466468
- level_1
467469
- id: '1.3'

shared/references/cce-redhat-avail.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,7 +1561,6 @@ CCE-89293-5
15611561
CCE-89294-3
15621562
CCE-89295-0
15631563
CCE-89303-2
1564-
CCE-89304-0
15651564
CCE-89305-7
15661565
CCE-89308-1
15671566
CCE-89310-7
@@ -1986,7 +1985,6 @@ CCE-89943-5
19861985
CCE-89946-8
19871986
CCE-89948-4
19881987
CCE-89949-2
1989-
CCE-89950-0
19901988
CCE-89951-8
19911989
CCE-89953-4
19921990
CCE-89954-2

0 commit comments

Comments
 (0)