|
48 | 48 | end |
49 | 49 |
|
50 | 50 | control 'cis-kubernetes-benchmark-1.3.3' do |
51 | | - title 'Ensure that the --insecure-experimental-approve-all-kubelet-csrs-for-group argument is not set' |
52 | | - desc "Do not accept all certificates.\n\nRationale: Setting the `--insecure-experimental-approve-all-kubelet-csrs-for-group` flag circumvents the desired “approval” process. All the certificates are auto-approved without checking their integrity. This flag is meant to be used for development and testing purposes only and hence should not be used in the production." |
| 51 | + title 'Ensure that the --use-service-account-credentials argument is set to true' |
| 52 | + desc "Use individual service account credentials for each controller.\n\nRationale: The controller manager creates a service account per controller in the `kube-system` namespace, generates a credential for it, and builds a dedicated API client with that service account credential for each controller loop to use. Setting the `--use-service-account-credentials` to `true` runs each control loop within the controller manager using a separate service account credential. When used in combination with RBAC, this ensures that the control loops run with the minimum permissions required to perform their intended tasks." |
53 | 53 | impact 1.0 |
54 | 54 |
|
55 | 55 | tag cis: 'kubernetes:1.3.3' |
56 | 56 | tag level: 1 |
57 | 57 |
|
58 | 58 | describe processes('kube-controller-manager').commands.to_s do |
59 | | - it { should_not match(/--insecure-experimental-approve-all-kubelet-csrs-for-group/) } |
| 59 | + it { should match(/--use-service-account-credentials=true/) } |
60 | 60 | end |
61 | 61 | end |
62 | 62 |
|
63 | 63 | control 'cis-kubernetes-benchmark-1.3.4' do |
64 | | - title 'Ensure that the --use-service-account-credentials argument is set to true' |
65 | | - desc "Use individual service account credentials for each controller.\n\nRationale: The controller manager creates a service account per controller in the `kube-system` namespace, generates a credential for it, and builds a dedicated API client with that service account credential for each controller loop to use. Setting the `--use-service-account-credentials` to `true` runs each control loop within the controller manager using a separate service account credential. When used in combination with RBAC, this ensures that the control loops run with the minimum permissions required to perform their intended tasks." |
| 64 | + title 'Ensure that the --service-account-private-key-file argument is set as appropriate' |
| 65 | + desc "Explicitly set a service account private key file for service accounts on the controller manager.\n\nRationale: To ensure that keys for service account tokens can be rotated as needed, a separate public/private key pair should be used for signing service account tokens. The private key should be specified to the controller manager with `--service-account-private-key-file` as appropriate." |
66 | 66 | impact 1.0 |
67 | 67 |
|
68 | 68 | tag cis: 'kubernetes:1.3.4' |
69 | 69 | tag level: 1 |
70 | 70 |
|
71 | 71 | describe processes('kube-controller-manager').commands.to_s do |
72 | | - it { should match(/--use-service-account-credentials=true/) } |
| 72 | + it { should match(/--service-account-private-key-file=/) } |
73 | 73 | end |
74 | 74 | end |
75 | 75 |
|
76 | 76 | control 'cis-kubernetes-benchmark-1.3.5' do |
77 | | - title 'Ensure that the --service-account-private-key-file argument is set as appropriate' |
78 | | - desc "Explicitly set a service account private key file for service accounts on the controller manager.\n\nRationale: To ensure that keys for service account tokens can be rotated as needed, a separate public/private key pair should be used for signing service account tokens. The private key should be specified to the controller manager with `--service-account-private-key-file` as appropriate." |
| 77 | + title 'Ensure that the --root-ca-file argument is set as appropriate' |
| 78 | + desc "Allow pods to verify the API server's serving certificate before establishing connections.\n\nRationale: Processes running within pods that need to contact the API server must verify the API server's serving certificate. Failing to do so could be a subject to man-in-the-middle attacks. Providing the root certificate for the API server's serving certificate to the controller manager with the `--root-ca-file` argument allows the controller manager to inject the trusted bundle into pods so that they can verify TLS connections to the API server." |
79 | 79 | impact 1.0 |
80 | 80 |
|
81 | 81 | tag cis: 'kubernetes:1.3.5' |
82 | 82 | tag level: 1 |
83 | 83 |
|
84 | 84 | describe processes('kube-controller-manager').commands.to_s do |
85 | | - it { should match(/--service-account-private-key-file=/) } |
| 85 | + it { should match(/--root-ca-file=/) } |
86 | 86 | end |
87 | 87 | end |
88 | 88 |
|
89 | 89 | control 'cis-kubernetes-benchmark-1.3.6' do |
90 | | - title 'Ensure that the --root-ca-file argument is set as appropriate' |
91 | | - desc "Allow pods to verify the API server's serving certificate before establishing connections.\n\nRationale: Processes running within pods that need to contact the API server must verify the API server's serving certificate. Failing to do so could be a subject to man-in-the-middle attacks. Providing the root certificate for the API server's serving certificate to the controller manager with the `--root-ca-file` argument allows the controller manager to inject the trusted bundle into pods so that they can verify TLS connections to the API server." |
92 | | - impact 1.0 |
| 90 | + title 'Apply Security Context to Your Pods and Containers' |
| 91 | + desc "Apply Security Context to Your Pods and Containers.\n\nRationale: A security context defines the operating system security settings (uid, gid, capabilities, SELinux role, etc..) applied to a container. When designing your containers and pods, make sure that you configure the security context for your pods, containers, and volumes. A security context is a property defined in the deployment yaml. It controls the security parameters that will be assigned to the pod/container/volume. There are two levels of security context: pod level security context, and container level security context." |
| 92 | + impact 0.0 |
93 | 93 |
|
94 | 94 | tag cis: 'kubernetes:1.3.6' |
95 | 95 | tag level: 1 |
96 | 96 |
|
| 97 | + describe 'cis-kubernetes-benchmark-1.3.6' do |
| 98 | + skip 'Review the pod definitions in your cluster and verify that you have security contexts defined as appropriate.' |
| 99 | + end |
| 100 | +end |
| 101 | + |
| 102 | +control 'cis-kubernetes-benchmark-1.3.7' do |
| 103 | + title 'Ensure that the RotateKubeletServerCertificate argument is set to true' |
| 104 | + desc "Enable kubelet server certificate rotation on controller-manager.\n\nRationale: RotateKubeletServerCertificate causes the kubelet to both request a serving certificate after bootstrapping its client credentials and rotate the certificate as its existing credentials expire. This automated periodic rotation ensures that the there are no downtimes due to expired certificates and thus addressing availability in the CIA security triad. Note: This recommendation only applies if you let kubelets get their certificates from the API server. In case your kubelet certificates come from an outside authority/tool (e.g. Vault) then you need to take care of rotation yourself." |
| 105 | + impact 1.0 |
| 106 | + |
| 107 | + tag cis: 'kubernetes:1.3.7' |
| 108 | + tag level: 1 |
| 109 | + |
97 | 110 | describe processes('kube-controller-manager').commands.to_s do |
98 | | - it { should match(/--root-ca-file=/) } |
| 111 | + it { should match(/--feature-gates=(?:.)*RotateKubeletServerCertificate=true,*(?:.)*/) } |
99 | 112 | end |
100 | 113 | end |
0 commit comments