Skip to content

Commit b55b345

Browse files
authored
Merge pull request ComplianceAsCode#6239 from JAORMX/cis-1.2.20
ocp4: Add check for CIS 1.2.20
2 parents d0bd390 + 7e741d3 commit b55b345

File tree

3 files changed

+39
-17
lines changed

3 files changed

+39
-17
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
documentation_complete: true
2+
3+
prodtype: ocp4
4+
5+
title: Ensure that the bindAddress is set to a relevant secure port
6+
7+
description: "The bindAddress is set by default to <tt>0.0.0.0:6443</tt>, and listening with TLS enabled."
8+
9+
rationale: |-
10+
The OpenShift API server is served over HTTPS with authentication and authorization;
11+
the secure API endpoint is bound to <tt>0.0.0.0:6443</tt> by default. In OpenShift, the only
12+
supported way to access the API server pod is through the load balancer and then through
13+
the internal service. The value is set by the bindAddress argument under the servingInfo
14+
parameter.
15+
16+
identifiers: {}
17+
18+
severity: low
19+
20+
references:
21+
cis: 1.2.20
22+
23+
warnings:
24+
- general: |-
25+
{{{ openshift_cluster_setting("/api/v1/namespaces/openshift-kube-apiserver/configmaps/config") | indent(4) }}}
26+
27+
template:
28+
name: yamlfile_value
29+
vars:
30+
ocp_data: "true"
31+
entity_check: "all"
32+
filepath: /api/v1/namespaces/openshift-kube-apiserver/configmaps/config
33+
yamlpath: '.data["config.yaml"]'
34+
values:
35+
- value: '"servingInfo":{.*"bindAddress":"0.0.0.0:6443"'
36+
operation: "pattern match"
37+
type: "string"
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
documentation_complete: true
22

3-
prodtype: ocp3,ocp4
3+
prodtype: ocp3
44

55
title: 'Enable the Secure Port for the API Server'
66

@@ -9,16 +9,6 @@ description: |-
99
edit the <tt>openshift-kube-apiserver</tt> configmap on the master node(s)
1010
and either remove the <tt>secure-port</tt> or set it to a different
1111
(non-zero) desired port.
12-
{{%- if product == "ocp4" %}}
13-
<pre>
14-
"apiServerArguments":{
15-
...
16-
"secure-port":[
17-
"8443"
18-
],
19-
...
20-
</pre>
21-
{{% else %}}
2212
edit the API Server pod specification
2313
file <tt>/etc/origin/master/master-config.yaml</tt> on the master node(s)
2414
and either remove the <tt>secure-port</tt> or set it to a different
@@ -27,7 +17,6 @@ description: |-
2717
apiServerArguments:
2818
secure-port:
2919
- 8443</pre>
30-
{{%- endif %}}
3120
3221
rationale: |-
3322
The secure port is used to serve HTTPS with authentication and authorization.
@@ -43,9 +32,5 @@ ocil_clause: '<tt>secure-port</tt> is set with a value greater than <tt>0</tt>'
4332

4433
ocil: |-
4534
Run the following command on the master node(s):
46-
{{%- if product == "ocp4" %}}
47-
<pre>$ oc get configmap config -n openshift-kube-apiserver -ojson | jq -r '.data["config.yaml"]' | jq '.apiServerArguments["secure-port"]'</pre>
48-
{{% else %}}
4935
<pre>$ sudo grep -A2 secure-port /etc/origin/master/master-config.yaml</pre>
50-
{{%- endif %}}
5136
The output should not return <pre>0</pre>.

Diff for: ocp4/profiles/cis.profile

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ selections:
5656
# 1.2.19 Ensure that the --insecure-port argument is set to 0
5757
- api_server_insecure_port
5858
# 1.2.20 Ensure that the --secure-port argument is not set to 0
59-
- api_server_secure_port
59+
- api_server_bind_address
6060
# 1.2.21 Ensure that the --profiling argument is set to false
6161
- api_server_profiling
6262
# 1.2.22 Ensure that the --audit-log-path argument is set

0 commit comments

Comments
 (0)