Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCP4/CIS 2.X: Fix descriptions and add checks #6338

Merged
merged 4 commits into from
Nov 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 23 additions & 7 deletions applications/openshift/etcd/etcd_client_cert_auth/rule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ title: 'Enable The Client Certificate Authentication'

description: |-
To ensure the <tt>etcd</tt> service is serving TLS to clients,
edit the <tt>etcd</tt> configuration file
<tt>/etc/etcd/etcd.conf</tt> on the master node and set
<tt>ETCD_CLIENT_CERT_AUTH</tt> to <tt>true</tt>.
<pre>ETCD_CLIENT_CERT_AUTH=true</pre>
make sure the <tt>etcd-pod*</tt> <tt>ConfigMaps</tt> in the
<tt>openshift-etcd</tt> namespace contain the following argument
for the <tt>etcd</tt> binary in the <tt>etcd</tt> pod:
<pre>oc get -nopenshift-etcd cm etcd-pod -oyaml | grep "\-\-client-cert-auth="</pre>
the parameter should be set to <tt>true</tt>.

rationale: |-
Without cryptographic integrity protections, information can be
Expand All @@ -26,6 +27,21 @@ references:
ocil_clause: 'the etcd client certificate authentication is not configured'

ocil: |-
Run the following command on the master node(s):
<pre>$ grep ETCD_CLIENT_CERT_AUTH</pre>
The output should return <tt>true</tt>.
Run the following command:
<pre>oc get -nopenshift-etcd cm etcd-pod -oyaml | grep "\-\-client-cert-auth="</pre>
The parameter should be set to <tt>true</tt>.

warnings:
- general: |-
{{{ openshift_cluster_setting("/api/v1/namespaces/openshift-etcd/configmaps/etcd-pod") | indent(8) }}}


template:
name: yamlfile_value
vars:
ocp_data: "true"
filepath: /api/v1/namespaces/openshift-etcd/configmaps/etcd-pod
yamlpath: ".data['pod.yaml']"
values:
- value: ".*--client-cert-auth=true \\.*"
operation: "pattern match"
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
default_result: PASS
28 changes: 22 additions & 6 deletions applications/openshift/etcd/etcd_peer_auto_tls/rule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ title: 'Disable etcd Peer Self-Signed Certificates'

description: |-
To ensure the <tt>etcd</tt> service is not using self-signed
certificates, edit the <tt>etcd</tt> configuration file
<tt>/etc/etcd/etcd.conf</tt> from the master node and set
<tt>ETCD_PEER_AUTO_TLS</tt> to <tt>false</tt>:
<pre>ETCD_PEER_AUTO_TLS=false</pre>
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
Expand All @@ -30,5 +30,21 @@ ocil_clause: 'the etcd is using peer self-signed certificates'

ocil: |-
Run the following command on the master node(s):
<pre>$ grep ETCD_PEER_AUTO_TLS /etc/etcd/etcd.conf</pre>
The output should return <tt>false</tt>.
<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_cluster_setting("/api/v1/namespaces/openshift-etcd/configmaps/etcd-pod") | indent(8) }}}

template:
name: yamlfile_value
vars:
ocp_data: "true"
filepath: /api/v1/namespaces/openshift-etcd/configmaps/etcd-pod
entity_check: "none satisfy"
yamlpath: '.data["pod.yaml"]'
values:
- value: '.*peer-auto-tls[= ]true.*'
operation: "pattern match"
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
default_result: PASS
30 changes: 22 additions & 8 deletions applications/openshift/etcd/etcd_peer_cert_file/rule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ prodtype: ocp4
title: 'Ensure That The etcd Peer Client Certificate Is Correctly Set'

description: |-
To ensure the <tt>etcd</tt> service is serving TLS to clients,
edit the <tt>etcd</tt> configuration file
<tt>/etc/etcd/etcd.conf</tt> on the master and adding a certificate
to <tt>ETCD_PEER_CERT_FILE</tt>:
<pre>ETCD_PEER_CERT_FILE=/etc/ssl/etcd/system:etcd-peer:<i>etcd_dns_name</i>.crt</pre>
To ensure the <tt>etcd</tt> service is serving TLS to peers,
make sure the <tt>etcd-pod*</tt> <tt>ConfigMaps</tt> in the
<tt>openshift-etcd</tt> namespace contain the following argument
for the <tt>etcd</tt> binary in the <tt>etcd</tt> pod:
<pre>--peer-cert-file=/etc/kubernetes/static-pod-certs/secrets/etcd-all-peer/etcd-peer-NODE_NAME.crt</pre>

rationale: |-
Without cryptographic integrity protections, information can be
Expand All @@ -23,9 +23,23 @@ severity: medium
references:
cis: '2.4'

ocil_clause: 'the etcd client certificate is not configured'
ocil_clause: 'the etcd peer client certificate is not configured'

ocil: |-
Run the following command on the master node(s):
<pre>$ grep ETCD_PEER_CERT_FILE=/etc/etcd/etcd.conf</pre>
Run the following command:
<pre>oc get -nopenshift-etcd cm etcd-pod -oyaml | grep "\-\-peer-cert-file=/etc/kubernetes/static-pod-certs/secrets/etcd-all-peer/etcd-peer-NODE_NAME.crt"</pre>
Verify that there is a certificate configured.

warnings:
- general: |-
{{{ openshift_cluster_setting("/api/v1/namespaces/openshift-etcd/configmaps/etcd-pod") | indent(8) }}}

template:
name: yamlfile_value
vars:
ocp_data: "true"
filepath: /api/v1/namespaces/openshift-etcd/configmaps/etcd-pod
yamlpath: ".data['pod.yaml']"
values:
- value: ".*--peer-cert-file=/etc/kubernetes/static-pod-certs/secrets/etcd-all-peer/etcd-peer-NODE_NAME.crt \\.*"
operation: "pattern match"
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
default_result: PASS
30 changes: 23 additions & 7 deletions applications/openshift/etcd/etcd_peer_client_cert_auth/rule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ title: 'Enable The Peer Client Certificate Authentication'

description: |-
To ensure the <tt>etcd</tt> service is serving TLS to clients,
edit the <tt>etcd</tt> configuration file
<tt>/etc/etcd/etcd.conf</tt> on the master node and set
<tt>ETCD_PEER_CLIENT_CERT_AUTH</tt> to <tt>true</tt>.
<pre>ETCD_PEER_CLIENT_CERT_AUTH=true</pre>
make sure the <tt>etcd-pod*</tt> <tt>ConfigMaps</tt> in the
<tt>openshift-etcd</tt> namespace contain the following argument
for the <tt>etcd</tt> binary in the <tt>etcd</tt> pod:
<pre>oc get -nopenshift-etcd cm etcd-pod -oyaml | grep "\-\-peer-client-cert-auth="</pre>
the parameter should be set to <tt>true</tt>.

rationale: |-
Without cryptographic integrity protections, information can be
Expand All @@ -26,6 +27,21 @@ references:
ocil_clause: 'the etcd peer client certificate authentication is not configured'

ocil: |-
Run the following command on the master node(s):
<pre>$ grep ETCD_PEER_CLIENT_CERT_AUTH</pre>
The output should return <tt>true</tt>.
Run the following command:
<pre>oc get -nopenshift-etcd cm etcd-pod -oyaml | grep "\-\-peer-client-cert-auth="</pre>
The parameter should be set to <tt>true</tt>.

warnings:
- general: |-
{{{ openshift_cluster_setting("/api/v1/namespaces/openshift-etcd/configmaps/etcd-pod") | indent(8) }}}


template:
name: yamlfile_value
vars:
ocp_data: "true"
filepath: /api/v1/namespaces/openshift-etcd/configmaps/etcd-pod
yamlpath: ".data['pod.yaml']"
values:
- value: ".*--peer-client-cert-auth=true \\.*"
operation: "pattern match"
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
default_result: PASS
32 changes: 23 additions & 9 deletions applications/openshift/etcd/etcd_peer_key_file/rule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ prodtype: ocp4
title: 'Ensure That The etcd Peer Key File Is Correctly Set'

description: |-
To ensure the <tt>etcd</tt> service is serving TLS to clients,
edit the <tt>etcd</tt> configuration file
<tt>/etc/etcd/etcd.conf</tt> on the master on the master and
adding a key file to <tt>ETCD_PEER_KEY_FILE</tt>:
<pre>ETCD_PEER_KEY_FILE=/etc/ssl/etcd/system:etcd-peer:<i>etcd_dns_name</i>.key</pre>
To ensure the <tt>etcd</tt> service is serving TLS to peers,
make sure the <tt>etcd-pod*</tt> <tt>ConfigMaps</tt> in the
<tt>openshift-etcd</tt> namespace contain the following argument
for the <tt>etcd</tt> binary in the <tt>etcd</tt> pod:
<pre>oc get -nopenshift-etcd cm etcd-pod -oyaml | grep "\-\-peer-key-file=/etc/kubernetes/static-pod-certs/secrets/etcd-all-peer/etcd-peer-NODE_NAME.key"</pre>

rationale: |-
Without cryptographic integrity protections, information can be
Expand All @@ -23,9 +23,23 @@ severity: medium
references:
cis: '2.4'

ocil_clause: 'the etcd client key file is not configured'
ocil_clause: 'the etcd peer client key file is not configured'

ocil: |-
Run the following command on the master node(s):
<pre>$ grep ETCD_PEER_KEY_FILE=/etc/etcd/etcd.conf</pre>
Verify that there is a key file configured.
Run the following command:
<pre>oc get -nopenshift-etcd cm etcd-pod -oyaml | grep "\-\-peer-key-file=/etc/kubernetes/static-pod-certs/secrets/etcd-all-peer/etcd-peer-NODE_NAME.key"</pre>
Verify that there is a certificate configured.

warnings:
- general: |-
{{{ openshift_cluster_setting("/api/v1/namespaces/openshift-etcd/configmaps/etcd-pod") | indent(8) }}}

template:
name: yamlfile_value
vars:
ocp_data: "true"
filepath: /api/v1/namespaces/openshift-etcd/configmaps/etcd-pod
yamlpath: ".data['pod.yaml']"
values:
- value: ".*--peer-key-file=/etc/kubernetes/static-pod-certs/secrets/etcd-all-peer/etcd-peer-NODE_NAME.key \\.*"
operation: "pattern match"
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
default_result: PASS