-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature/global-policy-set : upgrade version for test
- Loading branch information
1 parent
f9ed63e
commit 90daabd
Showing
5 changed files
with
194 additions
and
0 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
charts/test-krish-globalps/pols/disallow-capabilities.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
apiVersion: kyverno.io/v1 | ||
kind: ClusterPolicy | ||
metadata: | ||
name: disallow-capabilities | ||
annotations: | ||
policies.kyverno.io/title: Disallow Capabilities | ||
policies.kyverno.io/category: Pod Security Standards (Baseline) | ||
policies.kyverno.io/severity: medium | ||
policies.kyverno.io/minversion: 1.6.0 | ||
kyverno.io/kubernetes-version: "1.22-1.23" | ||
policies.kyverno.io/subject: Pod | ||
policies.nirmata.io/remediation-docs: "https://docs.nirmata.io/policysets/podsecurity/baseline/disallow-capabilities/" | ||
policies.kyverno.io/description: >- | ||
Adding capabilities beyond those listed in the policy must be disallowed. | ||
spec: | ||
validationFailureAction: Audit | ||
background: true | ||
rules: | ||
- name: adding-capabilities | ||
match: | ||
any: | ||
- resources: | ||
kinds: | ||
- Pod | ||
validate: | ||
message: >- | ||
Adding capabilities beyond those listed in the policy rule is disallowed. | ||
deny: | ||
conditions: | ||
all: | ||
- key: "{{ request.object.spec.[ephemeralContainers, initContainers, containers][].securityContext.capabilities.add[] }}" | ||
operator: AnyNotIn | ||
value: | ||
- AUDIT_WRITE | ||
- CHOWN | ||
- DAC_OVERRIDE | ||
- FOWNER | ||
- FSETID | ||
- KILL | ||
- MKNOD | ||
- NET_BIND_SERVICE | ||
- SETFCAP | ||
- SETGID | ||
- SETPCAP | ||
- SETUID | ||
- SYS_CHROOT |
35 changes: 35 additions & 0 deletions
35
charts/test-krish-globalps/pols/disallow-host-namespaces.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
apiVersion: kyverno.io/v1 | ||
kind: ClusterPolicy | ||
metadata: | ||
name: disallow-host-namespaces | ||
annotations: | ||
policies.kyverno.io/title: Disallow Host Namespaces | ||
policies.kyverno.io/category: Pod Security Standards (Baseline) | ||
policies.kyverno.io/severity: medium | ||
kyverno.io/kubernetes-version: "1.22-1.23" | ||
policies.kyverno.io/subject: Pod | ||
policies.nirmata.io/remediation-docs: "https://docs.nirmata.io/policysets/podsecurity/baseline/disallow-host-namespaces/" | ||
policies.nirmata.io/remediation: "https://github.com/nirmata/kyverno-policies/tree/main/pod-security/baseline/disallow-host-namespaces/remediate-disallow-host-namespaces.yaml" | ||
policies.kyverno.io/description: >- | ||
Host namespaces (Process ID namespace, Inter-Process Communication namespace, and | ||
network namespace) allow access to shared information and can be used to elevate | ||
privileges. Pods should not be allowed access to host namespaces. This policy ensures | ||
fields which make use of these host namespaces are unset or set to `false`. | ||
spec: | ||
validationFailureAction: Audit | ||
background: true | ||
rules: | ||
- name: host-namespaces | ||
match: | ||
any: | ||
- resources: | ||
kinds: | ||
- Pod | ||
validate: | ||
message: >- | ||
Sharing the host namespaces is disallowed. | ||
pattern: | ||
spec: | ||
=(hostPID): "false" | ||
=(hostIPC): "false" | ||
=(hostNetwork): "false" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
apiVersion: kyverno.io/v1 | ||
kind: ClusterPolicy | ||
metadata: | ||
name: disallow-host-path | ||
annotations: | ||
policies.kyverno.io/title: Disallow hostPath | ||
policies.kyverno.io/category: Pod Security Standards (Baseline) | ||
policies.kyverno.io/severity: medium | ||
policies.kyverno.io/subject: Pod,Volume | ||
kyverno.io/kubernetes-version: "1.22-1.23" | ||
policies.nirmata.io/remediation-docs: "https://docs.nirmata.io/policysets/podsecurity/baseline/disallow-host-path/" | ||
policies.nirmata.io/remediation: "https://github.com/nirmata/kyverno-policies/tree/main/pod-security/baseline/disallow-host-path/remediate-disallow-host-path.yaml" | ||
policies.kyverno.io/description: >- | ||
HostPath volumes let Pods use host directories and volumes in containers. | ||
Using host resources can be used to access shared data or escalate privileges | ||
and should not be allowed. This policy ensures no hostPath volumes are in use. | ||
spec: | ||
validationFailureAction: Audit | ||
background: true | ||
rules: | ||
- name: host-path | ||
match: | ||
any: | ||
- resources: | ||
kinds: | ||
- Pod | ||
validate: | ||
message: >- | ||
HostPath volumes are forbidden. | ||
pattern: | ||
spec: | ||
=(volumes): | ||
- X(hostPath): "null" |
39 changes: 39 additions & 0 deletions
39
charts/test-krish-globalps/pols/disallow-privileged-containers.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
apiVersion: kyverno.io/v1 | ||
kind: ClusterPolicy | ||
metadata: | ||
name: disallow-privileged-containers | ||
annotations: | ||
policies.kyverno.io/title: Disallow Privileged Containers | ||
policies.kyverno.io/category: Pod Security Standards (Baseline) | ||
policies.kyverno.io/severity: medium | ||
policies.kyverno.io/subject: Pod | ||
kyverno.io/kubernetes-version: "1.22-1.23" | ||
policies.nirmata.io/remediation-docs: "https://docs.nirmata.io/policysets/podsecurity/baseline/disallow-privileged-containers/" | ||
policies.nirmata.io/remediation: "https://github.com/nirmata/kyverno-policies/tree/main/pod-security/baseline/disallow-privileged-containers/remediate-disallow-privileged-containers.yaml" | ||
policies.kyverno.io/description: >- | ||
Privileged mode disables most security mechanisms and must not be allowed. This policy | ||
ensures Pods do not call for privileged mode. | ||
spec: | ||
validationFailureAction: Audit | ||
background: true | ||
rules: | ||
- name: privileged-containers | ||
match: | ||
any: | ||
- resources: | ||
kinds: | ||
- Pod | ||
validate: | ||
message: >- | ||
Privileged mode is disallowed. | ||
pattern: | ||
spec: | ||
=(ephemeralContainers): | ||
- =(securityContext): | ||
=(privileged): "false" | ||
=(initContainers): | ||
- =(securityContext): | ||
=(privileged): "false" | ||
containers: | ||
- =(securityContext): | ||
=(privileged): "false" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
apiVersion: kyverno.io/v1 | ||
kind: ClusterPolicy | ||
metadata: | ||
name: disallow-proc-mount | ||
annotations: | ||
policies.kyverno.io/title: Disallow procMount | ||
policies.kyverno.io/category: Pod Security Standards (Baseline) | ||
policies.kyverno.io/severity: medium | ||
policies.kyverno.io/subject: Pod | ||
kyverno.io/kubernetes-version: "1.22-1.23" | ||
policies.nirmata.io/remediation-docs: "https://docs.nirmata.io/policysets/podsecurity/baseline/disallow-proc-mount/" | ||
policies.nirmata.io/remediation: "https://github.com/nirmata/kyverno-policies/tree/main/pod-security/baseline/disallow-proc-mount/remediate-disallow-proc-mount-containers.yaml" | ||
policies.kyverno.io/description: >- | ||
The default /proc masks are set up to reduce attack surface and should be required. This policy | ||
ensures nothing but the default procMount can be specified. Note that in order for users | ||
to deviate from the `Default` procMount requires setting a feature gate at the API | ||
server. | ||
spec: | ||
validationFailureAction: Audit | ||
background: true | ||
rules: | ||
- name: check-proc-mount | ||
match: | ||
any: | ||
- resources: | ||
kinds: | ||
- Pod | ||
validate: | ||
message: >- | ||
Changing the proc mount from the default is not allowed. | ||
pattern: | ||
spec: | ||
=(ephemeralContainers): | ||
- =(securityContext): | ||
=(procMount): "Default" | ||
=(initContainers): | ||
- =(securityContext): | ||
=(procMount): "Default" | ||
containers: | ||
- =(securityContext): | ||
=(procMount): "Default" |