-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy path3_2_control_plane_logging.rb
More file actions
41 lines (31 loc) · 1.9 KB
/
3_2_control_plane_logging.rb
File metadata and controls
41 lines (31 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# frozen_string_literal: true
title '3.2 Logging'
apiserver = input('apiserver')
# fallback if apiserver attribute is not defined
apiserver = kubernetes.apiserver_bin if apiserver.empty?
only_if('apiserver not found') do
processes(apiserver).exists?
end
control 'cis-kubernetes-benchmark-3.2.1' do
title 'Ensure that a minimal audit policy is created'
desc "Kubernetes can audit the details of requests made to the API server. The --audit-policy-file flag must be set for this logging to be enabled.\nRationale: Logging is an important detective control for all systems, to detect potential unauthorised access."
impact 1.0
tag cis: 'kubernetes:3.2.1'
tag level: 1
describe processes(apiserver).commands.to_s do
it { should match(/--audit-policy-file=(\S+)/) }
end
describe directory(processes(apiserver).commands.to_s.scan(/--audit-policy-file=(\S+)/)) do
it { should exist }
end
end
control 'cis-kubernetes-benchmark-3.2.2' do
title 'Ensure that the audit policy covers key security concerns'
desc "Ensure that the audit policy created for the cluster covers key security concerns.\nRationale: Security audit logs should cover access and modification of key resources in the cluster, to enable them to form an effective part of a security environment."
impact 0.0
tag cis: 'kubernetes:3.2.2'
tag level: 2
describe 'cis-kubernetes-benchmark-3.2.2' do
skip 'Review the audit policy provided for the cluster and ensure that it covers at least the following areas: 1) Access to Secrets managed by the cluster. Care should be taken to only log Metadata for requests to Secrets, ConfigMaps, and TokenReviews, in order to avoid the risk of logging sensitive data. 2) Modification of pod and deployment objects. 3) Use of pods/exec, pods/portforward, pods/proxy and services/proxy. For most requests, minimally logging at the Metadata level is recommended (the most basic level of logging).'
end
end