Skip to content

Commit 6406ec3

Browse files
aromeyerAlain ROMEYER
and
Alain ROMEYER
authored
Feature/cis k8s benchmark v1.5.0 (#26)
* start to adpat tests to 1.5.0 doc Signed-off-by: Alain ROMEYER <[email protected]> * create structure Signed-off-by: Alain ROMEYER <[email protected]> * delet old file Signed-off-by: Alain ROMEYER <[email protected]> * 1.5.0 first implementation Signed-off-by: Alain ROMEYER <[email protected]> * correct syntax Signed-off-by: Alain ROMEYER <[email protected]> * correct syntax Signed-off-by: Alain ROMEYER <[email protected]> * correct syntax Signed-off-by: Alain ROMEYER <[email protected]> * start to correct controls Signed-off-by: Alain ROMEYER <[email protected]> * switch from 1.4.1 to 1.5.0 Signed-off-by: Alain ROMEYER <[email protected]> * take into account travis build errors Signed-off-by: Alain ROMEYER <[email protected]> * take into account travis build errors Signed-off-by: Alain ROMEYER <[email protected]> * take into account travis build errors Signed-off-by: Alain ROMEYER <[email protected]> * take into account travis build errors Signed-off-by: Alain ROMEYER <[email protected]> * fix incorrectly signed off commit Signed-off-by: Alain ROMEYER <[email protected]> Co-authored-by: Alain ROMEYER <[email protected]>
1 parent 66dabc1 commit 6406ec3

19 files changed

+860
-797
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# CIS Kubernetes Benchmark - InSpec Profile
22

33
## Description
4-
This profile implements the [CIS Kubernetes 1.4.1 Benchmark](https://www.cisecurity.org/benchmark/kubernetes/).
4+
5+
This profile implements the [CIS Kubernetes 1.5.0 Benchmark](https://www.cisecurity.org/benchmark/kubernetes/).
56

67
## Attributes
78

controls/1_4_master_node_configuration_files.rb controls/1_1_master_node_configuration_files.rb

+50-67
Large diffs are not rendered by default.

controls/1_1_master_node_api_server.rb controls/1_2_master_node_api_server.rb

+230-254
Large diffs are not rendered by default.

controls/1_3_master_node_controller_manager.rb

-17
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,3 @@
1-
#
2-
# Copyright 2019, Schuberg Philis B.V.
3-
#
4-
# Licensed under the Apache License, Version 2.0 (the "License");
5-
# you may not use this file except in compliance with the License.
6-
# You may obtain a copy of the License at
7-
#
8-
# http://www.apache.org/licenses/LICENSE-2.0
9-
#
10-
# Unless required by applicable law or agreed to in writing, software
11-
# distributed under the License is distributed on an "AS IS" BASIS,
12-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
# See the License for the specific language governing permissions and
14-
# limitations under the License.
15-
#
16-
# author: Kristian Vlaardingerbroek
17-
181
title '1.3 Master Node: Controller Manager'
192

203
controller_manager = attribute('controller_manager')

controls/1_2_master_node_scheduler.rb controls/1_4_master_node_scheduler.rb

+5-22
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,4 @@
1-
#
2-
# Copyright 2019, Schuberg Philis B.V.
3-
#
4-
# Licensed under the Apache License, Version 2.0 (the "License");
5-
# you may not use this file except in compliance with the License.
6-
# You may obtain a copy of the License at
7-
#
8-
# http://www.apache.org/licenses/LICENSE-2.0
9-
#
10-
# Unless required by applicable law or agreed to in writing, software
11-
# distributed under the License is distributed on an "AS IS" BASIS,
12-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
# See the License for the specific language governing permissions and
14-
# limitations under the License.
15-
#
16-
# author: Kristian Vlaardingerbroek
17-
18-
title '1.2 Master Node: Scheduler'
1+
title '1.4 Master Node: Scheduler'
192

203
scheduler = attribute('scheduler')
214
# fallback if scheduler attribute is not defined
@@ -25,25 +8,25 @@
258
processes(scheduler).exists?
269
end
2710

28-
control 'cis-kubernetes-benchmark-1.2.1' do
11+
control 'cis-kubernetes-benchmark-1.4.1' do
2912
title 'Ensure that the --profiling argument is set to false'
3013
desc "Disable profiling, if not needed.\n\nRationale: Profiling allows for the identification of specific performance bottlenecks. It generates a significant amount of program data that could potentially be exploited to uncover system and program details. If you are not experiencing any bottlenecks and do not need the profiler for troubleshooting purposes, it is recommended to turn it off to reduce the potential attack surface."
3114
impact 1.0
3215

33-
tag cis: 'kubernetes:1.2.1'
16+
tag cis: 'kubernetes:1.4.1'
3417
tag level: 1
3518

3619
describe processes(scheduler).commands.to_s do
3720
it { should match(/--profiling=false/) }
3821
end
3922
end
4023

41-
control 'cis-kubernetes-benchmark-1.2.2' do
24+
control 'cis-kubernetes-benchmark-1.4.2' do
4225
title 'Ensure that the --address argument is set to 127.0.0.1'
4326
desc "Do not bind the scheduler service to non-loopback insecure addresses.\n\nRationale: The Scheduler API service which runs on port 10251/TCP by default is used for health and metrics information and is available without authentication or encryption. As such it should only be bound to a localhost interface, to minimize the cluster's attack surface."
4427
impact 1.0
4528

46-
tag cis: 'kubernetes:1.2.2'
29+
tag cis: 'kubernetes:1.4.2'
4730
tag level: 1
4831

4932
describe.one do

controls/1_6_master_node_general_security_primitives.rb

-136
This file was deleted.

controls/1_5_master_node_etcd.rb controls/2_etcd_node.rb

+16-33
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,4 @@
1-
#
2-
# Copyright 2019, Schuberg Philis B.V.
3-
#
4-
# Licensed under the Apache License, Version 2.0 (the "License");
5-
# you may not use this file except in compliance with the License.
6-
# You may obtain a copy of the License at
7-
#
8-
# http://www.apache.org/licenses/LICENSE-2.0
9-
#
10-
# Unless required by applicable law or agreed to in writing, software
11-
# distributed under the License is distributed on an "AS IS" BASIS,
12-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
# See the License for the specific language governing permissions and
14-
# limitations under the License.
15-
#
16-
# author: Kristian Vlaardingerbroek
17-
18-
title '1.5 Master Node: etcd'
1+
title '2 Etcd Node'
192

203
etcd_regex = Regexp.new(%r{/usr/bin/etcd})
214
etcd_process = processes(etcd_regex)
@@ -25,12 +8,12 @@
258
etcd_process.exists?
269
end
2710

28-
control 'cis-kubernetes-benchmark-1.5.1' do
11+
control 'cis-kubernetes-benchmark:2.1' do
2912
title 'Ensure that the --cert-file and --key-file arguments are set as appropriate'
3013
desc "Configure TLS encryption for the etcd service.\n\nRationale: etcd is a highly-available key value store used by Kubernetes deployments for persistent storage of all of its REST API objects. These objects are sensitive in nature and should be encrypted in transit."
3114
impact 1.0
3215

33-
tag cis: 'kubernetes:1.5.1'
16+
tag cis: 'kubernetes:2.1'
3417
tag level: 1
3518

3619
describe.one do
@@ -54,12 +37,12 @@
5437
end
5538
end
5639

57-
control 'cis-kubernetes-benchmark-1.5.2' do
40+
control 'cis-kubernetes-benchmark:2.2' do
5841
title 'Ensure that the --client-cert-auth argument is set to true'
5942
desc "Enable client authentication on etcd service.\n\nRationale: etcd is a highly-available key value store used by Kubernetes deployments for persistent storage of all of its REST API objects. These objects are sensitive in nature and should not be available to unauthenticated clients. You should enable the client authentication via valid certificates to secure the access to the etcd service."
6043
impact 1.0
6144

62-
tag cis: 'kubernetes:1.5.2'
45+
tag cis: 'kubernetes:2.2'
6346
tag level: 1
6447

6548
describe.one do
@@ -73,25 +56,25 @@
7356
end
7457
end
7558

76-
control 'cis-kubernetes-benchmark-1.5.3' do
59+
control 'cis-kubernetes-benchmark:2.3' do
7760
title 'Ensure that the --auto-tls argument is not set to true'
7861
desc "Do not use self-signed certificates for TLS.\n\nRationale: etcd is a highly-available key value store used by Kubernetes deployments for persistent storage of all of its REST API objects. These objects are sensitive in nature and should not be available to unauthenticated clients. You should enable the client authentication via valid certificates to secure the access to the etcd service."
7962
impact 1.0
8063

81-
tag cis: 'kubernetes:1.5.3'
64+
tag cis: 'kubernetes:2.3'
8265
tag level: 1
8366

8467
describe etcd_process.commands.to_s do
8568
it { should_not match(/--auto-tls=true/) }
8669
end
8770
end
8871

89-
control 'cis-kubernetes-benchmark-1.5.4' do
72+
control 'cis-kubernetes-benchmark:2.4' do
9073
title 'Ensure that the --peer-cert-file and --peer-key-file arguments are set as appropriate'
9174
desc "etcd should be configured to make use of TLS encryption for peer connections.\n\nRationale: etcd is a highly-available key value store used by Kubernetes deployments for persistent storage of all of its REST API objects. These objects are sensitive in nature and should be encrypted in transit and also amongst peers in the etcd clusters."
9275
impact 1.0
9376

94-
tag cis: 'kubernetes:1.5.4'
77+
tag cis: 'kubernetes:2.4'
9578
tag level: 1
9679

9780
describe.one do
@@ -115,12 +98,12 @@
11598
end
11699
end
117100

118-
control 'cis-kubernetes-benchmark-1.5.5' do
101+
control 'cis-kubernetes-benchmark:2.5' do
119102
title 'Ensure that the --peer-client-cert-auth argument is set to true'
120103
desc "etcd should be configured for peer authentication.\n\nRationale: etcd is a highly-available key value store used by Kubernetes deployments for persistent storage of all of its REST API objects. These objects are sensitive in nature and should be accessible only by authenticated etcd peers in the etcd cluster."
121104
impact 1.0
122105

123-
tag cis: 'kubernetes:1.5.5'
106+
tag cis: 'kubernetes:2.5'
124107
tag level: 1
125108

126109
describe.one do
@@ -134,30 +117,30 @@
134117
end
135118
end
136119

137-
control 'cis-kubernetes-benchmark-1.5.6' do
120+
control 'cis-kubernetes-benchmark:2.6' do
138121
title 'Ensure that the --peer-auto-tls argument is not set to true'
139122
desc "Do not use automatically generated self-signed certificates for TLS connections between peers.\n\nRationale: etcd is a highly-available key value store used by Kubernetes deployments for persistent storage of all of its REST API objects. These objects are sensitive in nature and should be accessible only by authenticated etcd peers in the etcd cluster. Hence, do not use self-signed certificates for authentication."
140123
impact 1.0
141124

142-
tag cis: 'kubernetes:1.5.6'
125+
tag cis: 'kubernetes:2.6'
143126
tag level: 1
144127

145128
describe etcd_process.commands.to_s do
146129
it { should_not match(/--peer-auto-tls=true/) }
147130
end
148131
end
149132

150-
control 'cis-kubernetes-benchmark-1.5.9' do
133+
control 'cis-kubernetes-benchmark:2.7' do
151134
title 'Ensure that a unique Certificate Authority is used for etcd'
152135
desc "Use a different certificate authority for etcd from the one used for Kubernetes.\n\nRationale: etcd is a highly available key-value store used by Kubernetes deployments for persistent storage of all of its REST API objects. Its access should be restricted to specifically designated clients and peers only.\nAuthentication to etcd is based on whether the certificate presented was issued by a trusted certificate authority. There is no checking of certificate attributes such as common name or subject alternative name. As such, if any attackers were able to gain access to any certificate issued by the trusted certificate authority, they would be able to gain full access to the etcd database."
153136
impact 0.0
154137

155-
tag cis: 'kubernetes:1.5.9'
138+
tag cis: 'kubernetes:2.7'
156139
tag level: 2
157140

158141
only_if { cis_level == 2 }
159142

160-
describe 'cis-kubernetes-benchmark-1.5.9' do
143+
describe 'cis-kubernetes-benchmark:2.7' do
161144
skip 'Review if the CA used for etcd is different from the one used for Kubernetes'
162145
end
163146
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
title '3.1 Control Plane Configuration'
2+
3+
control 'cis-kubernetes-benchmark-3.1.1' do
4+
title 'Client certificate authentication should not be used for users'
5+
desc "Kubernetes provides the option to use client certificates for user authentication. However as there is no way to revoke these certificates when a user leaves an organization or loses their credential, they are not suitable for this purpose. It is not possible to fully disable client certificate use within a cluster as it is used for component to component authentication.\nRationale: With any authentication mechanism the ability to revoke credentials if they are compromised or no longer required, is a key control. Kubernetes client certificate authentication does not allow for this due to a lack of support for certificate revocation."
6+
impact 1.0
7+
8+
tag cis: 'kubernetes:3.1.1'
9+
tag level: 2
10+
11+
describe 'cis-kubernetes-benchmark-3.1.1' do
12+
skip 'Review user access to the cluster and ensure that users are not making use of Kubernetes client certificate authentication.'
13+
end
14+
end

0 commit comments

Comments
 (0)