-
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
476eb45
commit c0025f0
Showing
7 changed files
with
230 additions
and
1 deletion.
There are no files selected for viewing
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
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" |
34 changes: 34 additions & 0 deletions
34
charts/test-krish-globalps/pols/restrict-apparmor-profiles.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,34 @@ | ||
apiVersion: kyverno.io/v1 | ||
kind: ClusterPolicy | ||
metadata: | ||
name: restrict-apparmor-profiles | ||
annotations: | ||
policies.kyverno.io/title: Restrict AppArmor | ||
policies.kyverno.io/category: Pod Security Standards (Baseline) | ||
policies.kyverno.io/severity: medium | ||
policies.kyverno.io/subject: Pod, Annotation | ||
policies.kyverno.io/minversion: 1.3.0 | ||
kyverno.io/kubernetes-version: "1.22-1.23" | ||
policies.nirmata.io/remediation-docs: "https://docs.nirmata.io/policysets/podsecurity/baseline/restrict-apparmor-profiles/" | ||
policies.kyverno.io/description: >- | ||
On supported hosts, the 'runtime/default' AppArmor profile is applied by default. | ||
The default policy should prevent overriding or disabling the policy, or restrict | ||
overrides to an allowed set of profiles. This policy ensures Pods do not | ||
specify any other AppArmor profiles than `runtime/default` or `localhost/*`. | ||
spec: | ||
validationFailureAction: Audit | ||
background: true | ||
rules: | ||
- name: app-armor | ||
match: | ||
any: | ||
- resources: | ||
kinds: | ||
- Pod | ||
validate: | ||
message: >- | ||
Specifying other AppArmor profiles is disallowed. | ||
pattern: | ||
=(metadata): | ||
=(annotations): | ||
=(container.apparmor.security.beta.kubernetes.io/*): "runtime/default | localhost/*" |
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,45 @@ | ||
apiVersion: kyverno.io/v1 | ||
kind: ClusterPolicy | ||
metadata: | ||
name: restrict-seccomp | ||
annotations: | ||
policies.kyverno.io/title: Restrict Seccomp | ||
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/restrict-seccomp/" | ||
policies.kyverno.io/description: >- | ||
The seccomp profile must not be explicitly set to Unconfined. This policy, | ||
requiring Kubernetes v1.19 or later, ensures that seccomp is unset or | ||
set to `RuntimeDefault` or `Localhost`. | ||
spec: | ||
background: true | ||
validationFailureAction: Audit | ||
rules: | ||
- name: check-seccomp | ||
match: | ||
any: | ||
- resources: | ||
kinds: | ||
- Pod | ||
validate: | ||
message: >- | ||
Use of custom Seccomp profiles is disallowed. | ||
pattern: | ||
spec: | ||
=(securityContext): | ||
=(seccompProfile): | ||
=(type): "RuntimeDefault | Localhost" | ||
=(ephemeralContainers): | ||
- =(securityContext): | ||
=(seccompProfile): | ||
=(type): "RuntimeDefault | Localhost" | ||
=(initContainers): | ||
- =(securityContext): | ||
=(seccompProfile): | ||
=(type): "RuntimeDefault | Localhost" | ||
containers: | ||
- =(securityContext): | ||
=(seccompProfile): | ||
=(type): "RuntimeDefault | Localhost" |
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,36 @@ | ||
apiVersion: kyverno.io/v1 | ||
kind: ClusterPolicy | ||
metadata: | ||
name: restrict-sysctls | ||
annotations: | ||
policies.kyverno.io/title: Restrict sysctls | ||
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/restrict-sysctls/" | ||
policies.kyverno.io/description: >- | ||
Sysctls can disable security mechanisms or affect all containers on a | ||
host, and should be disallowed except for an allowed "safe" subset. A | ||
sysctl is considered safe if it is namespaced in the container or the | ||
Pod, and it is isolated from other Pods or processes on the same Node. | ||
This policy ensures that only those "safe" subsets can be specified in | ||
a Pod. | ||
spec: | ||
validationFailureAction: Audit | ||
background: true | ||
rules: | ||
- name: check-sysctls | ||
match: | ||
any: | ||
- resources: | ||
kinds: | ||
- Pod | ||
validate: | ||
message: >- | ||
Setting additional sysctls above the allowed type is disallowed. | ||
pattern: | ||
spec: | ||
=(securityContext): | ||
=(sysctls): | ||
- =(name): "kernel.shm_rmid_forced | net.ipv4.ip_local_port_range | net.ipv4.ip_unprivileged_port_start | net.ipv4.tcp_syncookies | net.ipv4.ping_group_range" |