mirror of
https://gitlab.kube.huskypup.net/Scooby/Homelabv4.git
synced 2026-08-21 11:36:50 +00:00
44 lines
1.2 KiB
YAML
44 lines
1.2 KiB
YAML
apiVersion: kyverno.io/v1
|
|
kind: ClusterPolicy
|
|
metadata:
|
|
name: disallow-privileged-containers
|
|
annotations:
|
|
policies.kyverno.io/title: Disallow Privileged Containers
|
|
policies.kyverno.io/category: Zero Trust
|
|
policies.kyverno.io/severity: high
|
|
spec:
|
|
validationFailureAction: Enforce
|
|
background: true
|
|
rules:
|
|
- name: disallow-privileged
|
|
match:
|
|
any:
|
|
- resources:
|
|
kinds:
|
|
- Pod
|
|
exclude:
|
|
any:
|
|
- resources:
|
|
namespaces:
|
|
- kube-system
|
|
- rook-ceph
|
|
- istio-system
|
|
- kube-node-lease
|
|
- prometheus
|
|
- kyverno
|
|
- tetragon
|
|
- crowdsec
|
|
validate:
|
|
message: "Privileged containers are not allowed."
|
|
pattern:
|
|
spec:
|
|
containers:
|
|
- =(securityContext):
|
|
=(privileged): false
|
|
=(initContainers):
|
|
- =(securityContext):
|
|
=(privileged): false
|
|
=(ephemeralContainers):
|
|
- =(securityContext):
|
|
=(privileged): false
|