|
15 | 15 | #
|
16 | 16 | # author: Kristian Vlaardingerbroek
|
17 | 17 |
|
| 18 | +cis_level = attribute('cis_level', default: '2', description: 'CIS profile level to audit', required: true) |
| 19 | + |
18 | 20 | title '1.6 Master Node: General Security Primitives'
|
19 | 21 |
|
20 | 22 | control 'cis-kubernetes-benchmark-1.6.1' do
|
|
56 | 58 | end
|
57 | 59 | end
|
58 | 60 |
|
59 |
| -control 'cis-kubernetes-benchmark-1.6.4' do |
60 |
| - title 'Create network segmentation using Network Policies' |
61 |
| - desc "Use network policies to isolate your cluster network.\n\nRationale: Running different applications on the same Kubernetes cluster creates a risk of one compromised application attacking a neighboring application. Network segmentation is important to ensure that containers can communicate only with those they are supposed to. A network policy is a specification of how selections of pods are allowed to communicate with each other and other network endpoints. `NetworkPolicy` resources use labels to select pods and define whitelist rules which allow traffic to the selected pods in addition to what is allowed by the isolation policy for a given namespace." |
62 |
| - impact 0.0 |
| 61 | +if cis_level == '2' |
| 62 | + control 'cis-kubernetes-benchmark-1.6.4' do |
| 63 | + title 'Create network segmentation using Network Policies' |
| 64 | + desc "Use network policies to isolate your cluster network.\n\nRationale: Running different applications on the same Kubernetes cluster creates a risk of one compromised application attacking a neighboring application. Network segmentation is important to ensure that containers can communicate only with those they are supposed to. A network policy is a specification of how selections of pods are allowed to communicate with each other and other network endpoints. `NetworkPolicy` resources use labels to select pods and define whitelist rules which allow traffic to the selected pods in addition to what is allowed by the isolation policy for a given namespace." |
| 65 | + impact 0.0 |
63 | 66 |
|
64 |
| - tag cis: 'kubernetes:1.6.4' |
65 |
| - tag level: 2 |
| 67 | + tag cis: 'kubernetes:1.6.4' |
| 68 | + tag level: 2 |
66 | 69 |
|
67 |
| - describe 'cis-kubernetes-benchmark-1.6.4' do |
68 |
| - skip 'Review the output of `kubectl get pods --namespace=kube-system` and ensure the `NetworkPolicy` objects are the ones you need.' |
| 70 | + describe 'cis-kubernetes-benchmark-1.6.4' do |
| 71 | + skip 'Review the output of `kubectl get pods --namespace=kube-system` and ensure the `NetworkPolicy` objects are the ones you need.' |
| 72 | + end |
69 | 73 | end
|
70 |
| -end |
71 | 74 |
|
72 |
| -control 'cis-kubernetes-benchmark-1.6.5' do |
73 |
| - title 'Ensure that the seccomp profile is set to docker/default in your pod definitions' |
74 |
| - desc "Enable `docker/default` seccomp profile in your pod definitions.\n\nRationale: Seccomp (secure computing mode) is used to restrict the set of system calls applications can make, allowing cluster administrators greater control over the security of workloads running in the cluster. Kubernetes disables seccomp profiles by default for historical reasons. You should enable it to ensure that the workloads have restricted actions available within the container." |
75 |
| - impact 0.0 |
| 75 | + control 'cis-kubernetes-benchmark-1.6.5' do |
| 76 | + title 'Ensure that the seccomp profile is set to docker/default in your pod definitions' |
| 77 | + desc "Enable `docker/default` seccomp profile in your pod definitions.\n\nRationale: Seccomp (secure computing mode) is used to restrict the set of system calls applications can make, allowing cluster administrators greater control over the security of workloads running in the cluster. Kubernetes disables seccomp profiles by default for historical reasons. You should enable it to ensure that the workloads have restricted actions available within the container." |
| 78 | + impact 0.0 |
76 | 79 |
|
77 |
| - tag cis: 'kubernetes:1.6.5' |
78 |
| - tag level: 2 |
| 80 | + tag cis: 'kubernetes:1.6.5' |
| 81 | + tag level: 2 |
79 | 82 |
|
80 |
| - describe 'cis-kubernetes-benchmark-1.6.5' do |
81 |
| - skip 'Review all the pod definitions in your cluster and verify that `seccomp` is enabled.' |
| 83 | + describe 'cis-kubernetes-benchmark-1.6.5' do |
| 84 | + skip 'Review all the pod definitions in your cluster and verify that `seccomp` is enabled.' |
| 85 | + end |
82 | 86 | end
|
83 |
| -end |
84 | 87 |
|
85 |
| -control 'cis-kubernetes-benchmark-1.6.6' do |
86 |
| - title 'Apply Security Context to Your Pods and Containers' |
87 |
| - 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." |
88 |
| - impact 0.0 |
| 88 | + control 'cis-kubernetes-benchmark-1.6.6' do |
| 89 | + title 'Apply Security Context to Your Pods and Containers' |
| 90 | + 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." |
| 91 | + impact 0.0 |
89 | 92 |
|
90 |
| - tag cis: 'kubernetes:1.6.6' |
91 |
| - tag level: 2 |
| 93 | + tag cis: 'kubernetes:1.6.6' |
| 94 | + tag level: 2 |
92 | 95 |
|
93 |
| - describe 'cis-kubernetes-benchmark-1.6.6' do |
94 |
| - skip 'Review the pod definitions in your cluster and verify that you have security contexts defined as appropriate.' |
| 96 | + describe 'cis-kubernetes-benchmark-1.6.6' do |
| 97 | + skip 'Review the pod definitions in your cluster and verify that you have security contexts defined as appropriate.' |
| 98 | + end |
95 | 99 | end
|
96 |
| -end |
97 | 100 |
|
98 |
| -control 'cis-kubernetes-benchmark-1.6.7' do |
99 |
| - title 'Configure Image Provenance using ImagePolicyWebhook admission controller' |
100 |
| - desc "Configure Image Provenance for your deployment.\n\nRationale: Kubernetes supports plugging in provenance rules to accept or reject the images in your deployments. You could configure such rules to ensure that only approved images are deployed in the cluster." |
101 |
| - impact 0.0 |
| 101 | + control 'cis-kubernetes-benchmark-1.6.7' do |
| 102 | + title 'Configure Image Provenance using ImagePolicyWebhook admission controller' |
| 103 | + desc "Configure Image Provenance for your deployment.\n\nRationale: Kubernetes supports plugging in provenance rules to accept or reject the images in your deployments. You could configure such rules to ensure that only approved images are deployed in the cluster." |
| 104 | + impact 0.0 |
102 | 105 |
|
103 |
| - tag cis: 'kubernetes:1.6.7' |
104 |
| - tag level: 2 |
| 106 | + tag cis: 'kubernetes:1.6.7' |
| 107 | + tag level: 2 |
105 | 108 |
|
106 |
| - describe 'cis-kubernetes-benchmark-1.6.7' do |
107 |
| - skip 'Review the pod definitions in your cluster and verify that image provenance is configured as appropriate.' |
| 109 | + describe 'cis-kubernetes-benchmark-1.6.7' do |
| 110 | + skip 'Review the pod definitions in your cluster and verify that image provenance is configured as appropriate.' |
| 111 | + end |
108 | 112 | end
|
109 |
| -end |
110 | 113 |
|
111 |
| -control 'cis-kubernetes-benchmark-1.6.8' do |
112 |
| - title 'Configure Network policies as appropriate' |
113 |
| - desc "Configure Network policies as appropriate.\n\nRationale: The Network Policy API is now stable. Network policy, implemented through a network plug-in, allows users to set and enforce rules governing which pods can communicate with each other. You should leverage it as appropriate in your environment." |
114 |
| - impact 0.0 |
| 114 | + control 'cis-kubernetes-benchmark-1.6.8' do |
| 115 | + title 'Configure Network policies as appropriate' |
| 116 | + desc "Configure Network policies as appropriate.\n\nRationale: The Network Policy API is now stable. Network policy, implemented through a network plug-in, allows users to set and enforce rules governing which pods can communicate with each other. You should leverage it as appropriate in your environment." |
| 117 | + impact 0.0 |
115 | 118 |
|
116 |
| - tag cis: 'kubernetes:1.6.8' |
117 |
| - tag level: 2 |
| 119 | + tag cis: 'kubernetes:1.6.8' |
| 120 | + tag level: 2 |
118 | 121 |
|
119 |
| - describe 'cis-kubernetes-benchmark-1.6.8' do |
120 |
| - skip 'Review the network policies enforced and ensure that they are suitable for your requirements.' |
| 122 | + describe 'cis-kubernetes-benchmark-1.6.8' do |
| 123 | + skip 'Review the network policies enforced and ensure that they are suitable for your requirements.' |
| 124 | + end |
121 | 125 | end
|
122 | 126 | end
|
0 commit comments