Capabilities permit privileged actions without giving full root access. The CAP_NET_RAW capability, enabled by default, allows processes in a container to forge packets and bind to any interface potentially leading to MitM attacks. This policy ensures that all containers explicitly drop the CAP_NET_RAW ability. Note that this policy also illustrates how to cover drop entries in any case although this may not strictly conform to the Pod Security Standards.
apiVersion: kyverno.io/v1kind: ClusterPolicymetadata:name: drop-cap-net-rawannotations:policies.kyverno.io/title: Drop CAP_NET_RAWpolicies.kyverno.io/category: Best Practicespolicies.kyverno.io/minversion: 1.6.0policies.kyverno.io/severity: mediumpolicies.kyverno.io/subject: Podpolicies.kyverno.io/description: Capabilities permit privileged actions without giving full root access. The CAP_NET_RAW capability, enabled by default, allows processes in a container to forge packets and bind to any interface potentially leading to MitM attacks. This policy ensures that all containers explicitly drop the CAP_NET_RAW ability. Note that this policy also illustrates how to cover drop entries in any case although this may not strictly conform to the Pod Security Standards.spec:validationFailureAction: Auditbackground: truerules:- name: require-drop-cap-net-rawmatch:any:- resources:kinds:- Podpreconditions:all:- key: "{{ request.operation || 'BACKGROUND' }}"operator: NotEqualsvalue: DELETEvalidate:message: Containers must drop the `CAP_NET_RAW` capability.foreach:- list: request.object.spec.[ephemeralContainers, initContainers, containers][]deny:conditions:all:- key: CAP_NET_RAWoperator: AnyNotInvalue: "{{ element.securityContext.capabilities.drop[].to_upper(@) || `[]` }}"- key: NET_RAWoperator: AnyNotInvalue: "{{ element.securityContext.capabilities.drop[].to_upper(@) || `[]` }}"
This policy prevents the use of the default project in an Application.
Services of type LoadBalancer when deployed inside AWS have support for transport encryption if it is enabled via an annotation. This policy requires that Services of type LoadBalancer contain the annotation service.beta.kubernetes.io/aws-load-balancer-ssl-cert with some value.
This policy prevents updates to the project field after an Application is created.