github.com/khulnasoft-lab/kube-bench@v0.2.1-0.20240330183753-9df52345ae58/integration/testdata/Expected_output.data (about) 1 [INFO] 1 Master Node Security Configuration 2 [INFO] 1.1 Master Node Configuration Files 3 [PASS] 1.1.1 Ensure that the API server pod specification file permissions are set to 644 or more restrictive (Automated) 4 [PASS] 1.1.2 Ensure that the API server pod specification file ownership is set to root:root (Automated) 5 [PASS] 1.1.3 Ensure that the controller manager pod specification file permissions are set to 644 or more restrictive (Automated) 6 [PASS] 1.1.4 Ensure that the controller manager pod specification file ownership is set to root:root (Automated) 7 [PASS] 1.1.5 Ensure that the scheduler pod specification file permissions are set to 644 or more restrictive (Automated) 8 [PASS] 1.1.6 Ensure that the scheduler pod specification file ownership is set to root:root (Automated) 9 [PASS] 1.1.7 Ensure that the etcd pod specification file permissions are set to 644 or more restrictive (Automated) 10 [PASS] 1.1.8 Ensure that the etcd pod specification file ownership is set to root:root (Automated) 11 [WARN] 1.1.9 Ensure that the Container Network Interface file permissions are set to 644 or more restrictive (Manual) 12 [WARN] 1.1.10 Ensure that the Container Network Interface file ownership is set to root:root (Manual) 13 [PASS] 1.1.11 Ensure that the etcd data directory permissions are set to 700 or more restrictive (Automated) 14 [FAIL] 1.1.12 Ensure that the etcd data directory ownership is set to etcd:etcd (Automated) 15 [PASS] 1.1.13 Ensure that the admin.conf file permissions are set to 644 or more restrictive (Automated) 16 [PASS] 1.1.14 Ensure that the admin.conf file ownership is set to root:root (Automated) 17 [PASS] 1.1.15 Ensure that the scheduler.conf file permissions are set to 644 or more restrictive (Automated) 18 [PASS] 1.1.16 Ensure that the scheduler.conf file ownership is set to root:root (Automated) 19 [PASS] 1.1.17 Ensure that the controller-manager.conf file permissions are set to 644 or more restrictive (Automated) 20 [PASS] 1.1.18 Ensure that the controller-manager.conf file ownership is set to root:root (Automated) 21 [PASS] 1.1.19 Ensure that the Kubernetes PKI directory and file ownership is set to root:root (Automated) 22 [PASS] 1.1.20 Ensure that the Kubernetes PKI certificate file permissions are set to 644 or more restrictive (Manual) 23 [PASS] 1.1.21 Ensure that the Kubernetes PKI key file permissions are set to 600 (Manual) 24 [INFO] 1.2 API Server 25 [WARN] 1.2.1 Ensure that the --anonymous-auth argument is set to false (Manual) 26 [PASS] 1.2.2 Ensure that the --token-auth-file parameter is not set (Automated) 27 [PASS] 1.2.3 Ensure that the --kubelet-https argument is set to true (Automated) 28 [PASS] 1.2.4 Ensure that the --kubelet-client-certificate and --kubelet-client-key arguments are set as appropriate (Automated) 29 [FAIL] 1.2.5 Ensure that the --kubelet-certificate-authority argument is set as appropriate (Automated) 30 [PASS] 1.2.6 Ensure that the --authorization-mode argument is not set to AlwaysAllow (Automated) 31 [PASS] 1.2.7 Ensure that the --authorization-mode argument includes Node (Automated) 32 [PASS] 1.2.8 Ensure that the --authorization-mode argument includes RBAC (Automated) 33 [WARN] 1.2.9 Ensure that the admission control plugin EventRateLimit is set (Manual) 34 [PASS] 1.2.10 Ensure that the admission control plugin AlwaysAdmit is not set (Automated) 35 [WARN] 1.2.11 Ensure that the admission control plugin AlwaysPullImages is set (Manual) 36 [WARN] 1.2.12 Ensure that the admission control plugin SecurityContextDeny is set if PodSecurityPolicy is not used (Manual) 37 [PASS] 1.2.13 Ensure that the admission control plugin ServiceAccount is set (Automated) 38 [PASS] 1.2.14 Ensure that the admission control plugin NamespaceLifecycle is set (Automated) 39 [FAIL] 1.2.15 Ensure that the admission control plugin PodSecurityPolicy is set (Automated) 40 [PASS] 1.2.16 Ensure that the admission control plugin NodeRestriction is set (Automated) 41 [PASS] 1.2.17 Ensure that the --insecure-bind-address argument is not set (Automated) 42 [PASS] 1.2.18 Ensure that the --insecure-port argument is set to 0 (Automated) 43 [PASS] 1.2.19 Ensure that the --secure-port argument is not set to 0 (Automated) 44 [FAIL] 1.2.20 Ensure that the --profiling argument is set to false (Automated) 45 [FAIL] 1.2.21 Ensure that the --audit-log-path argument is set (Automated) 46 [FAIL] 1.2.22 Ensure that the --audit-log-maxage argument is set to 30 or as appropriate (Automated) 47 [FAIL] 1.2.23 Ensure that the --audit-log-maxbackup argument is set to 10 or as appropriate (Automated) 48 [FAIL] 1.2.24 Ensure that the --audit-log-maxsize argument is set to 100 or as appropriate (Automated) 49 [WARN] 1.2.25 Ensure that the --request-timeout argument is set as appropriate (Manual) 50 [PASS] 1.2.26 Ensure that the --service-account-lookup argument is set to true (Automated) 51 [PASS] 1.2.27 Ensure that the --service-account-key-file argument is set as appropriate (Automated) 52 [PASS] 1.2.28 Ensure that the --etcd-certfile and --etcd-keyfile arguments are set as appropriate (Automated) 53 [PASS] 1.2.29 Ensure that the --tls-cert-file and --tls-private-key-file arguments are set as appropriate (Automated) 54 [PASS] 1.2.30 Ensure that the --client-ca-file argument is set as appropriate (Automated) 55 [PASS] 1.2.31 Ensure that the --etcd-cafile argument is set as appropriate (Automated) 56 [WARN] 1.2.32 Ensure that the --encryption-provider-config argument is set as appropriate (Manual) 57 [WARN] 1.2.33 Ensure that encryption providers are appropriately configured (Manual) 58 [WARN] 1.2.34 Ensure that the API Server only makes use of Strong Cryptographic Ciphers (Manual) 59 [INFO] 1.3 Controller Manager 60 [WARN] 1.3.1 Ensure that the --terminated-pod-gc-threshold argument is set as appropriate (Manual) 61 [FAIL] 1.3.2 Ensure that the --profiling argument is set to false (Automated) 62 [PASS] 1.3.3 Ensure that the --use-service-account-credentials argument is set to true (Automated) 63 [PASS] 1.3.4 Ensure that the --service-account-private-key-file argument is set as appropriate (Automated) 64 [PASS] 1.3.5 Ensure that the --root-ca-file argument is set as appropriate (Automated) 65 [PASS] 1.3.6 Ensure that the RotateKubeletServerCertificate argument is set to true (Automated) 66 [PASS] 1.3.7 Ensure that the --bind-address argument is set to 127.0.0.1 (Automated) 67 [INFO] 1.4 Scheduler 68 [FAIL] 1.4.1 Ensure that the --profiling argument is set to false (Automated) 69 [PASS] 1.4.2 Ensure that the --bind-address argument is set to 127.0.0.1 (Automated) 70 71 == Remediations master == 72 1.1.9 Run the below command (based on the file location on your system) on the master node. 73 For example, 74 chmod 644 <path/to/cni/files> 75 76 1.1.10 Run the below command (based on the file location on your system) on the master node. 77 For example, 78 chown root:root <path/to/cni/files> 79 80 1.1.12 On the etcd server node, get the etcd data directory, passed as an argument --data-dir, 81 from the below command: 82 ps -ef | grep etcd 83 Run the below command (based on the etcd data directory found above). 84 For example, chown etcd:etcd /var/lib/etcd 85 86 1.2.1 Edit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml 87 on the master node and set the below parameter. 88 --anonymous-auth=false 89 90 1.2.5 Follow the Kubernetes documentation and setup the TLS connection between 91 the apiserver and kubelets. Then, edit the API server pod specification file 92 /etc/kubernetes/manifests/kube-apiserver.yaml on the master node and set the 93 --kubelet-certificate-authority parameter to the path to the cert file for the certificate authority. 94 --kubelet-certificate-authority=<ca-string> 95 96 1.2.9 Follow the Kubernetes documentation and set the desired limits in a configuration file. 97 Then, edit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml 98 and set the below parameters. 99 --enable-admission-plugins=...,EventRateLimit,... 100 --admission-control-config-file=<path/to/configuration/file> 101 102 1.2.11 Edit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml 103 on the master node and set the --enable-admission-plugins parameter to include 104 AlwaysPullImages. 105 --enable-admission-plugins=...,AlwaysPullImages,... 106 107 1.2.12 Edit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml 108 on the master node and set the --enable-admission-plugins parameter to include 109 SecurityContextDeny, unless PodSecurityPolicy is already in place. 110 --enable-admission-plugins=...,SecurityContextDeny,... 111 112 1.2.15 Follow the documentation and create Pod Security Policy objects as per your environment. 113 Then, edit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml 114 on the master node and set the --enable-admission-plugins parameter to a 115 value that includes PodSecurityPolicy: 116 --enable-admission-plugins=...,PodSecurityPolicy,... 117 Then restart the API Server. 118 119 1.2.20 Edit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml 120 on the master node and set the below parameter. 121 --profiling=false 122 123 1.2.21 Edit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml 124 on the master node and set the --audit-log-path parameter to a suitable path and 125 file where you would like audit logs to be written, for example: 126 --audit-log-path=/var/log/apiserver/audit.log 127 128 1.2.22 Edit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml 129 on the master node and set the --audit-log-maxage parameter to 30 or as an appropriate number of days: 130 --audit-log-maxage=30 131 132 1.2.23 Edit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml 133 on the master node and set the --audit-log-maxbackup parameter to 10 or to an appropriate 134 value. 135 --audit-log-maxbackup=10 136 137 1.2.24 Edit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml 138 on the master node and set the --audit-log-maxsize parameter to an appropriate size in MB. 139 For example, to set it as 100 MB: 140 --audit-log-maxsize=100 141 142 1.2.25 Edit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml 143 and set the below parameter as appropriate and if needed. 144 For example, 145 --request-timeout=300s 146 147 1.2.32 Follow the Kubernetes documentation and configure a EncryptionConfig file. 148 Then, edit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml 149 on the master node and set the --encryption-provider-config parameter to the path of that file: --encryption-provider-config=</path/to/EncryptionConfig/File> 150 151 1.2.33 Follow the Kubernetes documentation and configure a EncryptionConfig file. 152 In this file, choose aescbc, kms or secretbox as the encryption provider. 153 154 1.2.34 Edit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml 155 on the master node and set the below parameter. 156 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM 157 _SHA256,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_256_GCM 158 _SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_ECDSA_WITH_AES_256_GCM 159 _SHA384 160 161 1.3.1 Edit the Controller Manager pod specification file /etc/kubernetes/manifests/kube-controller-manager.yaml 162 on the master node and set the --terminated-pod-gc-threshold to an appropriate threshold, 163 for example: 164 --terminated-pod-gc-threshold=10 165 166 1.3.2 Edit the Controller Manager pod specification file /etc/kubernetes/manifests/kube-controller-manager.yaml 167 on the master node and set the below parameter. 168 --profiling=false 169 170 1.4.1 Edit the Scheduler pod specification file /etc/kubernetes/manifests/kube-scheduler.yaml file 171 on the master node and set the below parameter. 172 --profiling=false 173 174 175 == Summary master == 176 43 checks PASS 177 10 checks FAIL 178 11 checks WARN 179 0 checks INFO 180 181 [INFO] 2 Etcd Node Configuration 182 [INFO] 2 Etcd Node Configuration Files 183 [PASS] 2.1 Ensure that the --cert-file and --key-file arguments are set as appropriate (Automated) 184 [PASS] 2.2 Ensure that the --client-cert-auth argument is set to true (Automated) 185 [PASS] 2.3 Ensure that the --auto-tls argument is not set to true (Automated) 186 [PASS] 2.4 Ensure that the --peer-cert-file and --peer-key-file arguments are set as appropriate (Automated) 187 [PASS] 2.5 Ensure that the --peer-client-cert-auth argument is set to true (Automated) 188 [PASS] 2.6 Ensure that the --peer-auto-tls argument is not set to true (Automated) 189 [PASS] 2.7 Ensure that a unique Certificate Authority is used for etcd (Manual) 190 191 == Summary etcd == 192 7 checks PASS 193 0 checks FAIL 194 0 checks WARN 195 0 checks INFO 196 197 [INFO] 3 Control Plane Configuration 198 [INFO] 3.1 Authentication and Authorization 199 [WARN] 3.1.1 Client certificate authentication should not be used for users (Manual) 200 [INFO] 3.2 Logging 201 [WARN] 3.2.1 Ensure that a minimal audit policy is created (Manual) 202 [WARN] 3.2.2 Ensure that the audit policy covers key security concerns (Manual) 203 204 == Remediations controlplane == 205 3.1.1 Alternative mechanisms provided by Kubernetes such as the use of OIDC should be 206 implemented in place of client certificates. 207 208 3.2.1 Create an audit policy file for your cluster. 209 210 3.2.2 Consider modification of the audit policy in use on the cluster to include these items, at a 211 minimum. 212 213 214 == Summary controlplane == 215 0 checks PASS 216 0 checks FAIL 217 3 checks WARN 218 0 checks INFO 219 220 [INFO] 4 Worker Node Security Configuration 221 [INFO] 4.1 Worker Node Configuration Files 222 [PASS] 4.1.1 Ensure that the kubelet service file permissions are set to 644 or more restrictive (Automated) 223 [PASS] 4.1.2 Ensure that the kubelet service file ownership is set to root:root (Automated) 224 [WARN] 4.1.3 If proxy kubeconfig file exists ensure permissions are set to 644 or more restrictive (Manual) 225 [WARN] 4.1.4 If proxy kubeconfig file exists ensure ownership is set to root:root (Manual) 226 [PASS] 4.1.5 Ensure that the --kubeconfig kubelet.conf file permissions are set to 644 or more restrictive (Automated) 227 [PASS] 4.1.6 Ensure that the --kubeconfig kubelet.conf file ownership is set to root:root (Automated) 228 [PASS] 4.1.7 Ensure that the certificate authorities file permissions are set to 644 or more restrictive (Manual) 229 [PASS] 4.1.8 Ensure that the client certificate authorities file ownership is set to root:root (Manual) 230 [PASS] 4.1.9 Ensure that the kubelet --config configuration file has permissions set to 644 or more restrictive (Automated) 231 [PASS] 4.1.10 Ensure that the kubelet --config configuration file ownership is set to root:root (Automated) 232 [INFO] 4.2 Kubelet 233 [PASS] 4.2.1 Ensure that the anonymous-auth argument is set to false (Automated) 234 [PASS] 4.2.2 Ensure that the --authorization-mode argument is not set to AlwaysAllow (Automated) 235 [PASS] 4.2.3 Ensure that the --client-ca-file argument is set as appropriate (Automated) 236 [PASS] 4.2.4 Ensure that the --read-only-port argument is set to 0 (Manual) 237 [PASS] 4.2.5 Ensure that the --streaming-connection-idle-timeout argument is not set to 0 (Manual) 238 [FAIL] 4.2.6 Ensure that the --protect-kernel-defaults argument is set to true (Automated) 239 [PASS] 4.2.7 Ensure that the --make-iptables-util-chains argument is set to true (Automated) 240 [PASS] 4.2.8 Ensure that the --hostname-override argument is not set (Manual) 241 [WARN] 4.2.9 Ensure that the --event-qps argument is set to 0 or a level which ensures appropriate event capture (Manual) 242 [WARN] 4.2.10 Ensure that the --tls-cert-file and --tls-private-key-file arguments are set as appropriate (Manual) 243 [PASS] 4.2.11 Ensure that the --rotate-certificates argument is not set to false (Automated) 244 [PASS] 4.2.12 Verify that the RotateKubeletServerCertificate argument is set to true (Manual) 245 [WARN] 4.2.13 Ensure that the Kubelet only makes use of Strong Cryptographic Ciphers (Manual) 246 247 == Remediations node == 248 4.1.3 Run the below command (based on the file location on your system) on the each worker node. 249 For example, 250 chmod 644 /etc/kubernetes/proxy.conf 251 252 4.1.4 Run the below command (based on the file location on your system) on the each worker node. 253 For example, chown root:root /etc/kubernetes/proxy.conf 254 255 4.2.6 If using a Kubelet config file, edit the file to set protectKernelDefaults: true. 256 If using command line arguments, edit the kubelet service file 257 /etc/systemd/system/kubelet.service.d/10-kubeadm.conf on each worker node and 258 set the below parameter in KUBELET_SYSTEM_PODS_ARGS variable. 259 --protect-kernel-defaults=true 260 Based on your system, restart the kubelet service. For example: 261 systemctl daemon-reload 262 systemctl restart kubelet.service 263 264 4.2.9 If using a Kubelet config file, edit the file to set eventRecordQPS: to an appropriate level. 265 If using command line arguments, edit the kubelet service file 266 /etc/systemd/system/kubelet.service.d/10-kubeadm.conf on each worker node and 267 set the below parameter in KUBELET_SYSTEM_PODS_ARGS variable. 268 Based on your system, restart the kubelet service. For example: 269 systemctl daemon-reload 270 systemctl restart kubelet.service 271 272 4.2.10 If using a Kubelet config file, edit the file to set tlsCertFile to the location 273 of the certificate file to use to identify this Kubelet, and tlsPrivateKeyFile 274 to the location of the corresponding private key file. 275 If using command line arguments, edit the kubelet service file 276 /etc/systemd/system/kubelet.service.d/10-kubeadm.conf on each worker node and 277 set the below parameters in KUBELET_CERTIFICATE_ARGS variable. 278 --tls-cert-file=<path/to/tls-certificate-file> 279 --tls-private-key-file=<path/to/tls-key-file> 280 Based on your system, restart the kubelet service. For example: 281 systemctl daemon-reload 282 systemctl restart kubelet.service 283 284 4.2.13 If using a Kubelet config file, edit the file to set TLSCipherSuites: to 285 TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_RSA_WITH_AES_256_GCM_SHA384,TLS_RSA_WITH_AES_128_GCM_SHA256 286 or to a subset of these values. 287 If using executable arguments, edit the kubelet service file 288 /etc/systemd/system/kubelet.service.d/10-kubeadm.conf on each worker node and 289 set the --tls-cipher-suites parameter as follows, or to a subset of these values. 290 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_RSA_WITH_AES_256_GCM_SHA384,TLS_RSA_WITH_AES_128_GCM_SHA256 291 Based on your system, restart the kubelet service. For example: 292 systemctl daemon-reload 293 systemctl restart kubelet.service 294 295 296 == Summary node == 297 17 checks PASS 298 1 checks FAIL 299 5 checks WARN 300 0 checks INFO 301 302 [INFO] 5 Kubernetes Policies 303 [INFO] 5.1 RBAC and Service Accounts 304 [WARN] 5.1.1 Ensure that the cluster-admin role is only used where required (Manual) 305 [WARN] 5.1.2 Minimize access to secrets (Manual) 306 [WARN] 5.1.3 Minimize wildcard use in Roles and ClusterRoles (Manual) 307 [WARN] 5.1.4 Minimize access to create pods (Manual) 308 [WARN] 5.1.5 Ensure that default service accounts are not actively used. (Manual) 309 [WARN] 5.1.6 Ensure that Service Account Tokens are only mounted where necessary (Manual) 310 [WARN] 5.1.7 Avoid use of system:masters group (Manual) 311 [WARN] 5.1.8 Limit use of the Bind, Impersonate and Escalate permissions in the Kubernetes cluster (Manual) 312 [INFO] 5.2 Pod Security Policies 313 [WARN] 5.2.1 Minimize the admission of privileged containers (Automated) 314 [WARN] 5.2.2 Minimize the admission of containers wishing to share the host process ID namespace (Automated) 315 [WARN] 5.2.3 Minimize the admission of containers wishing to share the host IPC namespace (Automated) 316 [WARN] 5.2.4 Minimize the admission of containers wishing to share the host network namespace (Automated) 317 [WARN] 5.2.5 Minimize the admission of containers with allowPrivilegeEscalation (Automated) 318 [WARN] 5.2.6 Minimize the admission of root containers (Automated) 319 [WARN] 5.2.7 Minimize the admission of containers with the NET_RAW capability (Automated) 320 [WARN] 5.2.8 Minimize the admission of containers with added capabilities (Automated) 321 [WARN] 5.2.9 Minimize the admission of containers with capabilities assigned (Manual) 322 [INFO] 5.3 Network Policies and CNI 323 [WARN] 5.3.1 Ensure that the CNI in use supports Network Policies (Manual) 324 [WARN] 5.3.2 Ensure that all Namespaces have Network Policies defined (Manual) 325 [INFO] 5.4 Secrets Management 326 [WARN] 5.4.1 Prefer using secrets as files over secrets as environment variables (Manual) 327 [WARN] 5.4.2 Consider external secret storage (Manual) 328 [INFO] 5.5 Extensible Admission Control 329 [WARN] 5.5.1 Configure Image Provenance using ImagePolicyWebhook admission controller (Manual) 330 [INFO] 5.7 General Policies 331 [WARN] 5.7.1 Create administrative boundaries between resources using namespaces (Manual) 332 [WARN] 5.7.2 Ensure that the seccomp profile is set to docker/default in your pod definitions (Manual) 333 [WARN] 5.7.3 Apply Security Context to Your Pods and Containers (Manual) 334 [WARN] 5.7.4 The default namespace should not be used (Manual) 335 336 == Remediations policies == 337 5.1.1 Identify all clusterrolebindings to the cluster-admin role. Check if they are used and 338 if they need this role or if they could use a role with fewer privileges. 339 Where possible, first bind users to a lower privileged role and then remove the 340 clusterrolebinding to the cluster-admin role : 341 kubectl delete clusterrolebinding [name] 342 343 5.1.2 Where possible, remove get, list and watch access to secret objects in the cluster. 344 345 5.1.3 Where possible replace any use of wildcards in clusterroles and roles with specific 346 objects or actions. 347 348 5.1.4 Where possible, remove create access to pod objects in the cluster. 349 350 5.1.5 Create explicit service accounts wherever a Kubernetes workload requires specific access 351 to the Kubernetes API server. 352 Modify the configuration of each default service account to include this value 353 automountServiceAccountToken: false 354 355 5.1.6 Modify the definition of pods and service accounts which do not need to mount service 356 account tokens to disable it. 357 358 5.1.7 Remove the system:masters group from all users in the cluster. 359 360 5.1.8 Where possible, remove the impersonate, bind and escalate rights from subjects. 361 362 5.2.1 Create a PSP as described in the Kubernetes documentation, ensuring that 363 the .spec.privileged field is omitted or set to false. 364 365 5.2.2 Create a PSP as described in the Kubernetes documentation, ensuring that the 366 .spec.hostPID field is omitted or set to false. 367 368 5.2.3 Create a PSP as described in the Kubernetes documentation, ensuring that the 369 .spec.hostIPC field is omitted or set to false. 370 371 5.2.4 Create a PSP as described in the Kubernetes documentation, ensuring that the 372 .spec.hostNetwork field is omitted or set to false. 373 374 5.2.5 Create a PSP as described in the Kubernetes documentation, ensuring that the 375 .spec.allowPrivilegeEscalation field is omitted or set to false. 376 377 5.2.6 Create a PSP as described in the Kubernetes documentation, ensuring that the 378 .spec.runAsUser.rule is set to either MustRunAsNonRoot or MustRunAs with the range of 379 UIDs not including 0. 380 381 5.2.7 Create a PSP as described in the Kubernetes documentation, ensuring that the 382 .spec.requiredDropCapabilities is set to include either NET_RAW or ALL. 383 384 5.2.8 Ensure that allowedCapabilities is not present in PSPs for the cluster unless 385 it is set to an empty array. 386 387 5.2.9 Review the use of capabilites in applications running on your cluster. Where a namespace 388 contains applicaions which do not require any Linux capabities to operate consider adding 389 a PSP which forbids the admission of containers which do not drop all capabilities. 390 391 5.3.1 If the CNI plugin in use does not support network policies, consideration should be given to 392 making use of a different plugin, or finding an alternate mechanism for restricting traffic 393 in the Kubernetes cluster. 394 395 5.3.2 Follow the documentation and create NetworkPolicy objects as you need them. 396 397 5.4.1 if possible, rewrite application code to read secrets from mounted secret files, rather than 398 from environment variables. 399 400 5.4.2 Refer to the secrets management options offered by your cloud provider or a third-party 401 secrets management solution. 402 403 5.5.1 Follow the Kubernetes documentation and setup image provenance. 404 405 5.7.1 Follow the documentation and create namespaces for objects in your deployment as you need 406 them. 407 408 5.7.2 Use security context to enable the docker/default seccomp profile in your pod definitions. 409 An example is as below: 410 securityContext: 411 seccompProfile: 412 type: RuntimeDefault 413 414 5.7.3 Follow the Kubernetes documentation and apply security contexts to your pods. For a 415 suggested list of security contexts, you may refer to the CIS Security Benchmark for Docker 416 Containers. 417 418 5.7.4 Ensure that namespaces are created to allow for appropriate segregation of Kubernetes 419 resources and that all new resources are created in a specific namespace. 420 421 422 == Summary policies == 423 0 checks PASS 424 0 checks FAIL 425 26 checks WARN 426 0 checks INFO 427 428 == Summary total == 429 67 checks PASS 430 11 checks FAIL 431 45 checks WARN 432 0 checks INFO 433