mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-31 03:45:17 +00:00
add samples/best_practices/deny_runasrootuser.yaml
This commit is contained in:
parent
ac4da2432b
commit
8f8bd05106
4 changed files with 28 additions and 2 deletions
|
@ -0,0 +1,26 @@
|
||||||
|
apiVersion: kyverno.io/v1alpha1
|
||||||
|
kind: ClusterPolicy
|
||||||
|
metadata:
|
||||||
|
name: validate-deny-privileged-disallowpriviligedescalation
|
||||||
|
spec:
|
||||||
|
validationFailureAction: "audit"
|
||||||
|
rules:
|
||||||
|
- name: deny-privileged-disallowpriviligedescalation
|
||||||
|
exclude:
|
||||||
|
match:
|
||||||
|
resources:
|
||||||
|
kinds:
|
||||||
|
- Pod
|
||||||
|
validate:
|
||||||
|
message: "Privileged mode is not allowed. Set allowPrivilegeEscalation and privileged to false"
|
||||||
|
anyPattern:
|
||||||
|
- spec:
|
||||||
|
securityContext:
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
privileged: false
|
||||||
|
- spec:
|
||||||
|
containers:
|
||||||
|
- name: "*"
|
||||||
|
securityContext:
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
privileged: false
|
|
@ -1,7 +1,7 @@
|
||||||
# file path relative to project root
|
# file path relative to project root
|
||||||
input:
|
input:
|
||||||
policy: examples/best_practices/policy_validate_deny_runasrootuser.yaml
|
policy: samples/best_practices/deny_runasrootuser.yaml
|
||||||
resource: examples/best_practices/resources/resource_validate_deny_runasrootuser.yaml
|
resource: test/manifest/resource_validate_deny_runasrootuser.yaml
|
||||||
expected:
|
expected:
|
||||||
validation:
|
validation:
|
||||||
policyresponse:
|
policyresponse:
|
||||||
|
|
Loading…
Add table
Reference in a new issue