documentation_complete: true


title: 'Disable etcd Peer Self-Signed Certificates'

{{% set default_api_path = '/api/v1/namespaces/openshift-etcd/configmaps/etcd-pod' %}}
{{% set default_jqfilter = '[.data."pod.yaml"]' %}}
{{% set hypershift_path = '/api/v1/namespaces/{{.hypershift_namespace_prefix}}-{{.hypershift_cluster}}/pods?labelSelector=app%3Detcd' %}}
{{% set hypershift_jqfilter = '[.items[0].spec.containers[0].command | join(" ")]' %}}
{{% set custom_api_path = '{{if ne .hypershift_cluster "None"}}' ~ hypershift_path ~ '{{else}}' ~  default_api_path ~ '{{end}}' %}}
{{% set custom_jqfilter = '{{if ne .hypershift_cluster "None"}}' ~ hypershift_jqfilter ~ '{{else}}' ~  default_jqfilter ~ '{{end}}' %}}
{{% set dump_path = default_api_path ~ ',' ~ default_jqfilter ~ ',' ~ custom_jqfilter %}}

description: |-
    To ensure the <tt>etcd</tt> service is not using self-signed
    certificates, run the following command:
    <pre>$ oc get cm/etcd-pod -n openshift-etcd -o yaml</pre>
    The etcd pod configuration contained in the configmap should not
    contain the <tt>--peer-auto-tls=true</tt> flag.

rationale: |-
    Without cryptographic integrity protections, information can be
    altered by unauthorized users without detection. Using self-signed
    certificates ensures that the certificates are never validated
    against a certificate authority and could lead to compromised
    and invalidated data.

severity: medium

identifiers:
    cce@ocp4: CCE-84184-1

references:
    cis@ocp4: '2.6'
    nerc-cip: CIP-003-8 R4.2,CIP-003-8 R6,CIP-004-6 R3,CIP-007-3 R5.1,CIP-007-3 R6.1
    nist: CM-6,CM-6(1),SC-8,SC-8(1)
    pcidss: Req-2.2
    srg: SRG-APP-000516-CTR-001325

platform: not ocp4-on-hypershift-hosted

ocil_clause: 'the etcd is using peer self-signed certificates'

ocil: |-
    Run the following command:
    <pre>$ oc get cm/etcd-pod -n openshift-etcd -o yaml</pre>
    The etcd pod configuration contained in the configmap should not
    contain the <tt>--peer-auto-tls=true</tt> flag.

warnings:
    - general: |-
        {{{ openshift_filtered_cluster_setting({custom_api_path: dump_path}) | indent(8) }}}

template:
    name: yamlfile_value
    vars:
        ocp_data: "true"
        filepath: {{{ openshift_filtered_path(default_api_path, default_jqfilter) }}}
        entity_check: "none satisfy"
        yamlpath: '[:]'
        values:
          - value: '.*peer-auto-tls[= ]true.*'
            operation: "pattern match"
