2019-10-07 11:21:14 -07:00
|
|
|
apiVersion: kyverno.io/v1alpha1
|
|
|
|
kind: ClusterPolicy
|
|
|
|
metadata:
|
|
|
|
name: validate-allow-portrange-with-sysctl
|
2019-10-11 18:57:16 -07:00
|
|
|
annotations:
|
|
|
|
policies.kyverno.io/category: Security Context
|
|
|
|
policies.kyverno.io/description: The local port range can be used by TCP and UDP is from 1024 to 65535
|
2019-10-07 11:21:14 -07:00
|
|
|
spec:
|
|
|
|
validationFailureAction: "audit"
|
|
|
|
rules:
|
|
|
|
- name: allow-portrange-with-sysctl
|
|
|
|
match:
|
|
|
|
resources:
|
|
|
|
kinds:
|
|
|
|
- Pod
|
|
|
|
validate:
|
|
|
|
message: "Allowed port range is from 1024 to 65535"
|
|
|
|
pattern:
|
|
|
|
spec:
|
|
|
|
securityContext:
|
|
|
|
sysctls:
|
|
|
|
- name: net.ipv4.ip_local_port_range
|
|
|
|
value: "1024 65535"
|