ce7cb702218693d08ea6d83464d2457c9250027c
This commit is contained in:
commit
34c5f8963c
1 changed files with 145336 additions and 0 deletions
51
vendor/platform/kyverno/policies/deny-privileged.yaml
vendored
Normal file
51
vendor/platform/kyverno/policies/deny-privileged.yaml
vendored
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
apiVersion: kyverno.io/v1
|
||||
kind: ClusterPolicy
|
||||
metadata:
|
||||
name: deny-privileged
|
||||
annotations:
|
||||
policies.kyverno.io/title: Deny privileged containers
|
||||
policies.kyverno.io/category: Pod Security
|
||||
policies.kyverno.io/severity: high
|
||||
policies.kyverno.io/description: >-
|
||||
Flag containers with privileged: true. Host storage exporters should use
|
||||
narrow capabilities instead of full privileged where possible.
|
||||
spec:
|
||||
validationFailureAction: Enforce
|
||||
background: true
|
||||
rules:
|
||||
- name: deny-privileged-containers
|
||||
match:
|
||||
any:
|
||||
- resources:
|
||||
kinds:
|
||||
- Pod
|
||||
exclude:
|
||||
any:
|
||||
- resources:
|
||||
namespaces:
|
||||
- kube-system
|
||||
- kube-public
|
||||
- kube-node-lease
|
||||
- flux-system
|
||||
- flux-canary
|
||||
- kyverno
|
||||
- cert-manager
|
||||
- cilium-secrets
|
||||
- olm
|
||||
- operators
|
||||
- longhorn
|
||||
- openebs
|
||||
- intel-system
|
||||
- nfd
|
||||
validate:
|
||||
message: >-
|
||||
Containers must not set privileged: true. Prefer drop ALL plus the
|
||||
minimal capabilities and hostPaths required for the workload.
|
||||
foreach:
|
||||
- list: "request.object.spec.[initContainers, ephemeralContainers, containers][]"
|
||||
deny:
|
||||
conditions:
|
||||
any:
|
||||
- key: "{{ element.securityContext.privileged || false }}"
|
||||
operator: Equals
|
||||
value: true
|
||||
Loading…
Reference in a new issue