Files
Homelabv4/infrastructure/kyverno/policies/disallow-host-namespaces.yaml
T
2026-03-09 20:21:35 -05:00

41 lines
1.2 KiB
YAML

apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: disallow-host-namespaces
annotations:
policies.kyverno.io/title: Disallow Host Namespaces
policies.kyverno.io/category: DoD STIG
policies.kyverno.io/severity: high
policies.kyverno.io/description: >-
STIG V-242386: Containers must not share the host process ID, IPC,
or network namespace. Sharing host namespaces allows containers to
access host-level resources and break isolation boundaries.
spec:
validationFailureAction: Enforce
background: true
rules:
- name: host-namespaces
match:
any:
- resources:
kinds:
- Pod
exclude:
any:
- resources:
namespaces:
- kube-system
- rook-ceph
- istio-system
- prometheus
- kyverno
- crowdsec
validate:
message: >-
Sharing host PID, IPC, or network namespaces is not allowed (STIG V-242386).
pattern:
spec:
=(hostPID): false
=(hostIPC): false
=(hostNetwork): false