Skip to content

Commit ce1c123

Browse files
authored
Merge pull request ComplianceAsCode#6338 from JAORMX/cis-2
OCP4/CIS 2.X: Fix descriptions and add checks
2 parents 97874a3 + d5e0bac commit ce1c123

File tree

10 files changed

+123
-37
lines changed

10 files changed

+123
-37
lines changed

applications/openshift/etcd/etcd_client_cert_auth/rule.yml

+23-7
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ title: 'Enable The Client Certificate Authentication'
66

77
description: |-
88
To ensure the <tt>etcd</tt> service is serving TLS to clients,
9-
edit the <tt>etcd</tt> configuration file
10-
<tt>/etc/etcd/etcd.conf</tt> on the master node and set
11-
<tt>ETCD_CLIENT_CERT_AUTH</tt> to <tt>true</tt>.
12-
<pre>ETCD_CLIENT_CERT_AUTH=true</pre>
9+
make sure the <tt>etcd-pod*</tt> <tt>ConfigMaps</tt> in the
10+
<tt>openshift-etcd</tt> namespace contain the following argument
11+
for the <tt>etcd</tt> binary in the <tt>etcd</tt> pod:
12+
<pre>oc get -nopenshift-etcd cm etcd-pod -oyaml | grep "\-\-client-cert-auth="</pre>
13+
the parameter should be set to <tt>true</tt>.
1314
1415
rationale: |-
1516
Without cryptographic integrity protections, information can be
@@ -26,6 +27,21 @@ references:
2627
ocil_clause: 'the etcd client certificate authentication is not configured'
2728

2829
ocil: |-
29-
Run the following command on the master node(s):
30-
<pre>$ grep ETCD_CLIENT_CERT_AUTH</pre>
31-
The output should return <tt>true</tt>.
30+
Run the following command:
31+
<pre>oc get -nopenshift-etcd cm etcd-pod -oyaml | grep "\-\-client-cert-auth="</pre>
32+
The parameter should be set to <tt>true</tt>.
33+
34+
warnings:
35+
- general: |-
36+
{{{ openshift_cluster_setting("/api/v1/namespaces/openshift-etcd/configmaps/etcd-pod") | indent(8) }}}
37+
38+
39+
template:
40+
name: yamlfile_value
41+
vars:
42+
ocp_data: "true"
43+
filepath: /api/v1/namespaces/openshift-etcd/configmaps/etcd-pod
44+
yamlpath: ".data['pod.yaml']"
45+
values:
46+
- value: ".*--client-cert-auth=true \\.*"
47+
operation: "pattern match"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
default_result: PASS

applications/openshift/etcd/etcd_peer_auto_tls/rule.yml

+22-6
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ title: 'Disable etcd Peer Self-Signed Certificates'
66

77
description: |-
88
To ensure the <tt>etcd</tt> service is not using self-signed
9-
certificates, edit the <tt>etcd</tt> configuration file
10-
<tt>/etc/etcd/etcd.conf</tt> from the master node and set
11-
<tt>ETCD_PEER_AUTO_TLS</tt> to <tt>false</tt>:
12-
<pre>ETCD_PEER_AUTO_TLS=false</pre>
9+
certificates, run the following command:
10+
<pre>$ oc get cm/etcd-pod -n openshift-etcd -o yaml</pre>
11+
The etcd pod configuration contained in the configmap should not
12+
contain the <tt>--peer-auto-tls=true</tt> flag.
1313
1414
rationale: |-
1515
Without cryptographic integrity protections, information can be
@@ -30,5 +30,21 @@ ocil_clause: 'the etcd is using peer self-signed certificates'
3030

3131
ocil: |-
3232
Run the following command on the master node(s):
33-
<pre>$ grep ETCD_PEER_AUTO_TLS /etc/etcd/etcd.conf</pre>
34-
The output should return <tt>false</tt>.
33+
<pre>$ oc get cm/etcd-pod -n openshift-etcd -o yaml</pre>
34+
The etcd pod configuration contained in the configmap should not
35+
contain the <tt>--peer-auto-tls=true</tt> flag.
36+
37+
warnings:
38+
- general: |-
39+
{{{ openshift_cluster_setting("/api/v1/namespaces/openshift-etcd/configmaps/etcd-pod") | indent(8) }}}
40+
41+
template:
42+
name: yamlfile_value
43+
vars:
44+
ocp_data: "true"
45+
filepath: /api/v1/namespaces/openshift-etcd/configmaps/etcd-pod
46+
entity_check: "none satisfy"
47+
yamlpath: '.data["pod.yaml"]'
48+
values:
49+
- value: '.*peer-auto-tls[= ]true.*'
50+
operation: "pattern match"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
default_result: PASS

applications/openshift/etcd/etcd_peer_cert_file/rule.yml

+22-8
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ prodtype: ocp4
55
title: 'Ensure That The etcd Peer Client Certificate Is Correctly Set'
66

77
description: |-
8-
To ensure the <tt>etcd</tt> service is serving TLS to clients,
9-
edit the <tt>etcd</tt> configuration file
10-
<tt>/etc/etcd/etcd.conf</tt> on the master and adding a certificate
11-
to <tt>ETCD_PEER_CERT_FILE</tt>:
12-
<pre>ETCD_PEER_CERT_FILE=/etc/ssl/etcd/system:etcd-peer:<i>etcd_dns_name</i>.crt</pre>
8+
To ensure the <tt>etcd</tt> service is serving TLS to peers,
9+
make sure the <tt>etcd-pod*</tt> <tt>ConfigMaps</tt> in the
10+
<tt>openshift-etcd</tt> namespace contain the following argument
11+
for the <tt>etcd</tt> binary in the <tt>etcd</tt> pod:
12+
<pre>--peer-cert-file=/etc/kubernetes/static-pod-certs/secrets/etcd-all-peer/etcd-peer-NODE_NAME.crt</pre>
1313
1414
rationale: |-
1515
Without cryptographic integrity protections, information can be
@@ -23,9 +23,23 @@ severity: medium
2323
references:
2424
cis: '2.4'
2525

26-
ocil_clause: 'the etcd client certificate is not configured'
26+
ocil_clause: 'the etcd peer client certificate is not configured'
2727

2828
ocil: |-
29-
Run the following command on the master node(s):
30-
<pre>$ grep ETCD_PEER_CERT_FILE=/etc/etcd/etcd.conf</pre>
29+
Run the following command:
30+
<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>
3131
Verify that there is a certificate configured.
32+
33+
warnings:
34+
- general: |-
35+
{{{ openshift_cluster_setting("/api/v1/namespaces/openshift-etcd/configmaps/etcd-pod") | indent(8) }}}
36+
37+
template:
38+
name: yamlfile_value
39+
vars:
40+
ocp_data: "true"
41+
filepath: /api/v1/namespaces/openshift-etcd/configmaps/etcd-pod
42+
yamlpath: ".data['pod.yaml']"
43+
values:
44+
- value: ".*--peer-cert-file=/etc/kubernetes/static-pod-certs/secrets/etcd-all-peer/etcd-peer-NODE_NAME.crt \\.*"
45+
operation: "pattern match"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
default_result: PASS

applications/openshift/etcd/etcd_peer_client_cert_auth/rule.yml

+23-7
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ title: 'Enable The Peer Client Certificate Authentication'
66

77
description: |-
88
To ensure the <tt>etcd</tt> service is serving TLS to clients,
9-
edit the <tt>etcd</tt> configuration file
10-
<tt>/etc/etcd/etcd.conf</tt> on the master node and set
11-
<tt>ETCD_PEER_CLIENT_CERT_AUTH</tt> to <tt>true</tt>.
12-
<pre>ETCD_PEER_CLIENT_CERT_AUTH=true</pre>
9+
make sure the <tt>etcd-pod*</tt> <tt>ConfigMaps</tt> in the
10+
<tt>openshift-etcd</tt> namespace contain the following argument
11+
for the <tt>etcd</tt> binary in the <tt>etcd</tt> pod:
12+
<pre>oc get -nopenshift-etcd cm etcd-pod -oyaml | grep "\-\-peer-client-cert-auth="</pre>
13+
the parameter should be set to <tt>true</tt>.
1314
1415
rationale: |-
1516
Without cryptographic integrity protections, information can be
@@ -26,6 +27,21 @@ references:
2627
ocil_clause: 'the etcd peer client certificate authentication is not configured'
2728

2829
ocil: |-
29-
Run the following command on the master node(s):
30-
<pre>$ grep ETCD_PEER_CLIENT_CERT_AUTH</pre>
31-
The output should return <tt>true</tt>.
30+
Run the following command:
31+
<pre>oc get -nopenshift-etcd cm etcd-pod -oyaml | grep "\-\-peer-client-cert-auth="</pre>
32+
The parameter should be set to <tt>true</tt>.
33+
34+
warnings:
35+
- general: |-
36+
{{{ openshift_cluster_setting("/api/v1/namespaces/openshift-etcd/configmaps/etcd-pod") | indent(8) }}}
37+
38+
39+
template:
40+
name: yamlfile_value
41+
vars:
42+
ocp_data: "true"
43+
filepath: /api/v1/namespaces/openshift-etcd/configmaps/etcd-pod
44+
yamlpath: ".data['pod.yaml']"
45+
values:
46+
- value: ".*--peer-client-cert-auth=true \\.*"
47+
operation: "pattern match"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
default_result: PASS

applications/openshift/etcd/etcd_peer_key_file/rule.yml

+23-9
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ prodtype: ocp4
55
title: 'Ensure That The etcd Peer Key File Is Correctly Set'
66

77
description: |-
8-
To ensure the <tt>etcd</tt> service is serving TLS to clients,
9-
edit the <tt>etcd</tt> configuration file
10-
<tt>/etc/etcd/etcd.conf</tt> on the master on the master and
11-
adding a key file to <tt>ETCD_PEER_KEY_FILE</tt>:
12-
<pre>ETCD_PEER_KEY_FILE=/etc/ssl/etcd/system:etcd-peer:<i>etcd_dns_name</i>.key</pre>
8+
To ensure the <tt>etcd</tt> service is serving TLS to peers,
9+
make sure the <tt>etcd-pod*</tt> <tt>ConfigMaps</tt> in the
10+
<tt>openshift-etcd</tt> namespace contain the following argument
11+
for the <tt>etcd</tt> binary in the <tt>etcd</tt> pod:
12+
<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>
1313
1414
rationale: |-
1515
Without cryptographic integrity protections, information can be
@@ -23,9 +23,23 @@ severity: medium
2323
references:
2424
cis: '2.4'
2525

26-
ocil_clause: 'the etcd client key file is not configured'
26+
ocil_clause: 'the etcd peer client key file is not configured'
2727

2828
ocil: |-
29-
Run the following command on the master node(s):
30-
<pre>$ grep ETCD_PEER_KEY_FILE=/etc/etcd/etcd.conf</pre>
31-
Verify that there is a key file configured.
29+
Run the following command:
30+
<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>
31+
Verify that there is a certificate configured.
32+
33+
warnings:
34+
- general: |-
35+
{{{ openshift_cluster_setting("/api/v1/namespaces/openshift-etcd/configmaps/etcd-pod") | indent(8) }}}
36+
37+
template:
38+
name: yamlfile_value
39+
vars:
40+
ocp_data: "true"
41+
filepath: /api/v1/namespaces/openshift-etcd/configmaps/etcd-pod
42+
yamlpath: ".data['pod.yaml']"
43+
values:
44+
- value: ".*--peer-key-file=/etc/kubernetes/static-pod-certs/secrets/etcd-all-peer/etcd-peer-NODE_NAME.key \\.*"
45+
operation: "pattern match"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
default_result: PASS

0 commit comments

Comments
 (0)