Skip to content

Commit

Permalink
Optimize KubeletConfig rules
Browse files Browse the repository at this point in the history
We made some optimization in CO to scan runtime KubeletConfig in a different way, this PR adapts those changes.
  • Loading branch information
Vincent056 committed Apr 25, 2023
1 parent fea56dd commit 4aec368
Show file tree
Hide file tree
Showing 119 changed files with 355 additions and 14,378 deletions.
17 changes: 9 additions & 8 deletions applications/openshift/kubelet/kubelet_anonymous_auth/rule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ documentation_complete: true

prodtype: eks,ocp4

platform: {{{ product }}}

{{%- if product == "eks" %}}
{{%- set kubeletconf_path = "/etc/kubernetes/kubelet/kubelet-config.json" %}}
{{%- else %}}
platform: ocp4-node
{{%- set kubeletconf_path = "/etc/kubernetes/kubelet.conf" %}}
{{%- endif %}}

Expand Down Expand Up @@ -52,10 +51,12 @@ ocil: |-
<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 -A1 anonymous; done</pre>
The output should return <pre>enabled: false</pre>.
warnings:
- general: |-
{{{ openshift_cluster_setting_kubeletconfig() | indent(4) }}}
template:
name: kubelet_combine

name: yamlfile_value
vars:
filepath: '/tmp/compliance-operator/kubeletconfig/openscap-kubeletconfig'
yamlpath: ".kubeletconfig.authentication.anonymous.enabled"
check_existence: "all_exist"
values:
- value: "false"
operation: "equals"

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ documentation_complete: true

prodtype: eks,ocp4

platform: {{{ product }}}

{{%- if product == "eks" %}}
{{%- set kubeletconf_path = "/etc/kubernetes/kubelet/kubelet-config.json" %}}
{{%- else %}}
platform: ocp4-node
{{%- set kubeletconf_path = "/etc/kubernetes/kubelet.conf" %}}
{{%- endif %}}

Expand All @@ -31,7 +30,6 @@ rationale: |-
identifiers:
cce@ocp4: CCE-83593-4


severity: medium

references:
Expand All @@ -49,10 +47,12 @@ ocil: |-
Verify that the output is not set to <tt>mode: AlwaysAllow</tt>, or missing
(defaults to <tt>mode: Webhook</tt>).
warnings:
- general: |-
{{{ openshift_cluster_setting_kubeletconfig() | indent(4) }}}
template:
name: kubelet_combine
name: yamlfile_value
vars:
filepath: '/tmp/compliance-operator/kubeletconfig/openscap-kubeletconfig'
yamlpath: ".kubeletconfig.authorization.mode"
check_existence: "all_exist"
values:
- value: "AlwaysAllow"
operation: "not equal"

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ documentation_complete: true

prodtype: eks,ocp4

platform: {{{ product }}}

{{%- if product == "eks" %}}
{{%- set kubeletconf_path = "/etc/kubernetes/kubelet/kubelet-config.json" %}}
{{%- set ca_path = "/etc/kubernetes/pki/ca.crt" %}}
{{%- else %}}
platform: ocp4-node
{{%- set kubeletconf_path = "/etc/kubernetes/kubelet.conf" %}}
{{%- set ca_path = "/etc/kubernetes/kubelet-ca.crt" %}}
{{%- endif %}}
Expand Down Expand Up @@ -54,10 +53,12 @@ references:
nist: CM-6,CM-6(1)
srg: SRG-APP-000516-CTR-001325

warnings:
- general: |-
{{{ openshift_cluster_setting_kubeletconfig() | indent(4) }}}
template:
name: kubelet_combine
name: yamlfile_value
vars:
filepath: '/tmp/compliance-operator/kubeletconfig/openscap-kubeletconfig'
yamlpath: ".kubeletconfig.authentication.x509.clientCAFile"
check_existence: "all_exist"
values:
- value: "{{{ ca_path}}}"
operation: "equals"
Loading

0 comments on commit 4aec368

Please sign in to comment.