2019-11-13 13:56:20 -08:00
|
|
|
apiVersion: kyverno.io/v1
|
2019-11-11 17:17:09 -08:00
|
|
|
kind: ClusterPolicy
|
|
|
|
metadata:
|
|
|
|
name: disallow-sysctls
|
|
|
|
annotations:
|
|
|
|
policies.kyverno.io/category: Security
|
|
|
|
policies.kyverno.io/description: The Sysctl interface allows modifications to kernel parameters
|
|
|
|
at runtime. In a Kubernetes pod these parameters can be specified under `securityContext.sysctls`.
|
|
|
|
Kernel parameter modifications can be used for exploits and should be restricted.
|
|
|
|
spec:
|
2020-08-19 14:04:58 -07:00
|
|
|
validationFailureAction: audit
|
2019-11-11 17:17:09 -08:00
|
|
|
rules:
|
|
|
|
- name: validate-sysctls
|
|
|
|
match:
|
|
|
|
resources:
|
|
|
|
kinds:
|
|
|
|
- Pod
|
|
|
|
validate:
|
|
|
|
message: "Changes to kernel paramaters are not allowed"
|
|
|
|
pattern:
|
|
|
|
spec:
|
2020-06-03 17:46:01 -07:00
|
|
|
=(securityContext):
|
2019-11-11 17:17:09 -08:00
|
|
|
X(sysctls): null
|