1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-15 17:51:20 +00:00
kyverno/samples/DisallowHostPIDIPC.md

37 lines
1.4 KiB
Markdown
Raw Normal View History

2019-10-23 21:06:03 +00:00
# Disallow `hostPID` and `hostIPC`
2019-10-23 22:36:37 +00:00
Sharing the host's PID namespace allows an application pod to gain visibility of processes on the host, potentially exposing sensitive information. Sharing the host's IPC namespace also allows the container process to communicate with processes on the host.
2019-10-23 21:06:03 +00:00
2019-10-23 22:36:37 +00:00
To avoid pod container from having visibility to host process space, validate that `hostPID` and `hostIPC` are set to `false`.
2019-10-23 21:06:03 +00:00
## Policy YAML
[disallow_hostpid_hostipc.yaml](best_practices/disallow_hostpid_hostipc.yaml)
````yaml
apiVersion: kyverno.io/v1alpha1
kind: ClusterPolicy
metadata:
2019-11-08 03:20:51 +00:00
name: validate-host-pid-ipc
annotations:
policies.kyverno.io/category: Security
policies.kyverno.io/description: Sharing the host's PID namespace allows visibility of process
on the host, potentially exposing process information. Sharing the host's IPC namespace allows
the container process to communicate with processes on the host. To avoid pod container from
having visibility to host process space, validate that 'hostPID' and 'hostIPC' are set to 'false'.
2019-10-23 21:06:03 +00:00
spec:
2019-11-08 03:20:51 +00:00
validationFailureAction: enforce
2019-10-23 21:06:03 +00:00
rules:
2019-11-08 03:20:51 +00:00
- name: validate-host-pid-ipc
2019-10-23 21:06:03 +00:00
match:
resources:
kinds:
- Pod
validate:
2019-11-08 03:20:51 +00:00
message: "Use of host PID and IPC namespaces is not allowed"
2019-10-23 21:06:03 +00:00
pattern:
spec:
2019-11-08 03:20:51 +00:00
=(hostPID): "false"
=(hostIPC): "false"
2019-10-23 21:06:03 +00:00
````