mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-31 03:45:17 +00:00
* Adding default policies for restricted mode, taking validationFailureAction from values.yaml and adding notes on helm install Signed-off-by: Raj Das <mail.rajdas@gmail.com> * Adding emoji Signed-off-by: Raj Das <mail.rajdas@gmail.com> * Update NOTES.txt * minor fix Signed-off-by: Raj Das <mail.rajdas@gmail.com> * adding to readme Signed-off-by: Raj Das <mail.rajdas@gmail.com>
34 lines
No EOL
1.3 KiB
YAML
34 lines
No EOL
1.3 KiB
YAML
{{- if or (eq .Values.podSecurityStandard "default") (eq .Values.podSecurityStandard "restricted") }}
|
|
apiVersion: kyverno.io/v1
|
|
kind: ClusterPolicy
|
|
metadata:
|
|
name: restrict-sysctls
|
|
annotations:
|
|
policies.kyverno.io/category: Pod Security Standards (Default)
|
|
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.
|
|
spec:
|
|
validationFailureAction: {{ .Values.validationFailureAction }}
|
|
background: true
|
|
rules:
|
|
- name: sysctls
|
|
match:
|
|
resources:
|
|
kinds:
|
|
- Pod
|
|
validate:
|
|
message: >-
|
|
Setting additional sysctls above the allowed type is disallowed.
|
|
The field spec.securityContext.sysctls must not use any other names
|
|
than 'kernel.shm_rmid_forced', 'net.ipv4.ip_local_port_range',
|
|
'net.ipv4.tcp_syncookies' and 'net.ipv4.ping_group_range'.
|
|
pattern:
|
|
spec:
|
|
=(securityContext):
|
|
=(sysctls):
|
|
- name: "kernel.shm_rmid_forced | net.ipv4.ip_local_port_range | net.ipv4.tcp_syncookies | net.ipv4.ping_group_range"
|
|
value: "?*"
|
|
{{- end -}} |