Skip to content

Commit 2d8dff0

Browse files
authored
Add new templates/checks based on Docker CIS benchmarks (#170)
1 parent 9a8ea02 commit 2d8dff0

File tree

47 files changed

+1705
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1705
-0
lines changed

docs/generated/checks.md

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,22 @@
22

33
KubeLinter includes the following built-in checks:
44

5+
## cluster-admin-role-binding
6+
7+
**Enabled by default**: No
8+
9+
**Description**: CIS Benchmark 5.1.1 Ensure that the cluster-admin role is only used where required
10+
11+
**Remediation**: Create and assign a separate role that has access to specific resources/actions needed for the service account.
12+
13+
**Template**: [cluster-admin-role-binding](generated/templates.md#cluster-admin-role-binding)
14+
15+
**Parameters**:
16+
17+
```json
18+
{}
19+
```
20+
521
## dangling-service
622

723
**Enabled by default**: Yes
@@ -50,6 +66,22 @@ KubeLinter includes the following built-in checks:
5066
{}
5167
```
5268

69+
## docker-sock
70+
71+
**Enabled by default**: Yes
72+
73+
**Description**: Alert on deployments with docker.sock mounted in containers.
74+
75+
**Remediation**: Ensure the Docker socket is not mounted inside any containers by removing the associated Volume and VolumeMount in deployment yaml specification. If the Docker socket is mounted inside a container it could allow processes running within the container to execute Docker commands which would effectively allow for full control of the host.
76+
77+
**Template**: [host-mounts](generated/templates.md#host-mounts)
78+
79+
**Parameters**:
80+
81+
```json
82+
{"dirs":["docker.sock$"]}
83+
```
84+
5385
## drop-net-raw-capability
5486

5587
**Enabled by default**: Yes
@@ -82,6 +114,70 @@ KubeLinter includes the following built-in checks:
82114
{"name":"(?i).*secret.*","value":".+"}
83115
```
84116

117+
## exposed-services
118+
119+
**Enabled by default**: No
120+
121+
**Description**: Alert on services for forbidden types
122+
123+
**Remediation**: Ensure containers are not exposed through a forbidden service type such as NodePort or LoadBalancer.
124+
125+
**Template**: [forbidden-service-types](generated/templates.md#forbidden-service-types)
126+
127+
**Parameters**:
128+
129+
```json
130+
{"forbiddenServiceTypes":["NodePort","LoadBalancer"]}
131+
```
132+
133+
## host-ipc
134+
135+
**Enabled by default**: Yes
136+
137+
**Description**: Alert on pods/deployment-likes with sharing host's IPC namespace
138+
139+
**Remediation**: Ensure the host's IPC namespace is not shared.
140+
141+
**Template**: [host-ipc](generated/templates.md#host-ipc)
142+
143+
**Parameters**:
144+
145+
```json
146+
{}
147+
```
148+
149+
## host-network
150+
151+
**Enabled by default**: Yes
152+
153+
**Description**: Alert on pods/deployment-likes with sharing host's network namespace
154+
155+
**Remediation**: Ensure the host's network namespace is not shared.
156+
157+
**Template**: [host-network](generated/templates.md#host-network)
158+
159+
**Parameters**:
160+
161+
```json
162+
{}
163+
```
164+
165+
## host-pid
166+
167+
**Enabled by default**: Yes
168+
169+
**Description**: Alert on pods/deployment-likes with sharing host's process namespace
170+
171+
**Remediation**: Ensure the host's process namespace is not shared.
172+
173+
**Template**: [host-pid](generated/templates.md#host-pid)
174+
175+
**Parameters**:
176+
177+
```json
178+
{}
179+
```
180+
85181
## mismatching-selector
86182

87183
**Enabled by default**: Yes
@@ -194,6 +290,22 @@ KubeLinter includes the following built-in checks:
194290
{}
195291
```
196292

293+
## privilege-escalation-container
294+
295+
**Enabled by default**: Yes
296+
297+
**Description**: Alert on containers of allowing privilege escalation that could gain more privileges than its parent process.
298+
299+
**Remediation**: Ensure containers do not allow privilege escalation by setting allowPrivilegeEscalation=false." See https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ for more details.
300+
301+
**Template**: [privilege-escalation-container](generated/templates.md#privilege-escalation-on-containers)
302+
303+
**Parameters**:
304+
305+
```json
306+
{}
307+
```
308+
197309
## privileged-container
198310

199311
**Enabled by default**: Yes
@@ -210,6 +322,22 @@ KubeLinter includes the following built-in checks:
210322
{}
211323
```
212324

325+
## privileged-ports
326+
327+
**Enabled by default**: No
328+
329+
**Description**: Alert on deployments with privileged ports mapped in containers
330+
331+
**Remediation**: Ensure privileged ports [0, 1024] are not mapped within containers.
332+
333+
**Template**: [privileged-ports](generated/templates.md#privileged-ports)
334+
335+
**Parameters**:
336+
337+
```json
338+
{}
339+
```
340+
213341
## required-annotation-email
214342

215343
**Enabled by default**: No
@@ -258,6 +386,22 @@ KubeLinter includes the following built-in checks:
258386
{}
259387
```
260388

389+
## sensitive-host-mounts
390+
391+
**Enabled by default**: Yes
392+
393+
**Description**: Alert on deployments with sensitive host system directories mounted in containers
394+
395+
**Remediation**: Ensure sensitive host system directories are not mounted in containers by removing those Volumes and VolumeMounts.
396+
397+
**Template**: [host-mounts](generated/templates.md#host-mounts)
398+
399+
**Parameters**:
400+
401+
```json
402+
{"dirs":["^/$","^/boot$","^/dev$","^/etc$","^/lib$","^/proc$","^/sys$","^/usr$"]}
403+
```
404+
261405
## ssh-port
262406

263407
**Enabled by default**: Yes
@@ -274,6 +418,38 @@ KubeLinter includes the following built-in checks:
274418
{"port":22,"protocol":"TCP"}
275419
```
276420

421+
## unsafe-proc-mount
422+
423+
**Enabled by default**: No
424+
425+
**Description**: Alert on deployments with unsafe /proc mount (procMount=Unmasked) that will bypass the default masking behavior of the container runtime
426+
427+
**Remediation**: Ensure container does not unsafely exposes parts of /proc by setting procMount=Default. Unmasked ProcMount bypasses the default masking behavior of the container runtime. See https://kubernetes.io/docs/concepts/security/pod-security-standards/ for more details.
428+
429+
**Template**: [unsafe-proc-mount](generated/templates.md#unsafe-proc-mount)
430+
431+
**Parameters**:
432+
433+
```json
434+
{}
435+
```
436+
437+
## unsafe-sysctls
438+
439+
**Enabled by default**: Yes
440+
441+
**Description**: Alert on deployments specifying unsafe sysctls that may lead to severe problems like wrong behavior of containers
442+
443+
**Remediation**: Ensure container does not allow unsafe allocation of system resources by removing unsafe sysctls configurations. For more details see https://kubernetes.io/docs/tasks/administer-cluster/sysctl-cluster/ https://docs.docker.com/engine/reference/commandline/run/#configure-namespaced-kernel-parameters-sysctls-at-runtime.
444+
445+
**Template**: [unsafe-sysctls](generated/templates.md#unsafe-sysctls)
446+
447+
**Parameters**:
448+
449+
```json
450+
{"unsafeSysCtls":["kernel.msg","kernel.sem","kernel.shm","fs.mqueue.","net."]}
451+
```
452+
277453
## unset-cpu-requirements
278454

279455
**Enabled by default**: Yes

0 commit comments

Comments
 (0)