Skip to content

Commit 9133713

Browse files
committed
OCPBUGS-17216: Update rotate certificates check for OCP 4.14
By default, the rotate certificates rules for CIS 1.4.0 (section 4.2) fail on OpenShift 4.14. This commit updates the rule to check for the proper configuration so that it passes by default, since certificate rotation is enabled by default. This patch also updates the instructions to use a valid command for users looking to verify the configuration manually. The old command didn't return anything because it was looking in the wrong configuration section.
1 parent 0e7439a commit 9133713

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

  • applications/openshift/kubelet
    • kubelet_enable_server_cert_rotation_master
    • kubelet_enable_server_cert_rotation_worker
    • kubelet_enable_server_cert_rotation

applications/openshift/kubelet/kubelet_enable_server_cert_rotation/rule.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ ocil_clause: 'the kubelet cannot rotate server certificate'
3333

3434
ocil: |-
3535
Run the following command on the kubelet node(s):
36-
<pre>$ for NODE_NAME in $(oc get nodes -ojsonpath='{.items[*].metadata.name}'); do oc get --raw /api/v1/nodes/$NODE_NAME/proxy/configz | jq '.kubeletconfig|.kind="KubeletConfiguration"|.apiVersion="kubelet.config.k8s.io/v1beta1"' | grep RotateKubeletServerCertificate; done</pre>
36+
<pre>$ for node in $(oc get nodes -ojsonpath='{.items[*].metadata.name}'); do oc get --raw /api/v1/nodes/$node/proxy/configz | jq '.kubeletconfig.rotateCertificates' done</pre>
3737
The output should return <tt>true</tt>.
3838
3939
identifiers:

applications/openshift/kubelet/kubelet_enable_server_cert_rotation_master/rule.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ ocil_clause: 'the kubelet cannot rotate server certificate'
3333

3434
ocil: |-
3535
Run the following command on the kubelet node(s):
36-
<pre>$ for NODE_NAME in $(oc get nodes -ojsonpath='{.items[*].metadata.name}'); do oc get --raw /api/v1/nodes/$NODE_NAME/proxy/configz | jq '.kubeletconfig|.kind="KubeletConfiguration"|.apiVersion="kubelet.config.k8s.io/v1beta1"' | grep RotateKubeletServerCertificate; done</pre>
36+
<pre>$ for node in $(oc get nodes -ojsonpath='{.items[*].metadata.name}'); do oc get --raw /api/v1/nodes/$node/proxy/configz | jq '.kubeletconfig.rotateCertificates' done</pre>
3737
The output should return <tt>true</tt>.
3838
3939
references:
@@ -49,7 +49,7 @@ template:
4949
ocp_data: "true"
5050
filepath: '/kubeletconfig/role'
5151
filepath_suffix: var_role_master
52-
yamlpath: ".featureGates.RotateKubeletServerCertificate"
52+
yamlpath: ".rotateCertificates"
5353
values:
5454
- value: "true"
5555
operation: "equals"

applications/openshift/kubelet/kubelet_enable_server_cert_rotation_worker/rule.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ ocil_clause: 'the kubelet cannot rotate server certificate'
3333

3434
ocil: |-
3535
Run the following command on the kubelet node(s):
36-
<pre>$ for NODE_NAME in $(oc get nodes -ojsonpath='{.items[*].metadata.name}'); do oc get --raw /api/v1/nodes/$NODE_NAME/proxy/configz | jq '.kubeletconfig|.kind="KubeletConfiguration"|.apiVersion="kubelet.config.k8s.io/v1beta1"' | grep RotateKubeletServerCertificate; done</pre>
36+
<pre>$ for node in $(oc get nodes -ojsonpath='{.items[*].metadata.name}'); do oc get --raw /api/v1/nodes/$node/proxy/configz | jq '.kubeletconfig.rotateCertificates' done</pre>
3737
The output should return <tt>true</tt>.
3838
3939
references:
@@ -49,7 +49,7 @@ template:
4949
ocp_data: "true"
5050
filepath: '/kubeletconfig/role'
5151
filepath_suffix: var_role_worker
52-
yamlpath: ".featureGates.RotateKubeletServerCertificate"
52+
yamlpath: ".rotateCertificates"
5353
values:
5454
- value: "true"
5555
operation: "equals"

0 commit comments

Comments
 (0)