The Kubernetes API includes a CertificateSigningRequest resource which can be used to generate a certificate for an entity. Because this API can be abused to create a long-lived credential, it is important to be able to audit this API to understand who/what is creating these CSRs and for what actors they are being created. This policy, intended to always be run in Audit mode and produce failure results in a Policy Report, inspects all incoming CertificateSigningRequests and writes out into the Policy Report information on who/what requested it and parsing the CSR to show the Subject information of that CSR resource.
apiVersion: kyverno.io/v2beta1kind: ClusterPolicymetadata:name: inspect-csrannotations:policies.kyverno.io/title: Inspect CertificateSigningRequestpolicies.kyverno.io/category: Otherpolicies.kyverno.io/subject: CertificateSigningRequestpolicies.kyverno.io/minversion: 1.10.0kyverno.io/kubernetes-version: "1.26"policies.kyverno.io/description: The Kubernetes API includes a CertificateSigningRequest resource which can be used to generate a certificate for an entity. Because this API can be abused to create a long-lived credential, it is important to be able to audit this API to understand who/what is creating these CSRs and for what actors they are being created. This policy, intended to always be run in Audit mode and produce failure results in a Policy Report, inspects all incoming CertificateSigningRequests and writes out into the Policy Report information on who/what requested it and parsing the CSR to show the Subject information of that CSR resource.spec:background: falsevalidationFailureAction: Auditrules:- name: csrmatch:any:- resources:kinds:- CertificateSigningRequestvalidate:message: "A CSR was created by {{ request.userInfo.{groups: groups, username: username} | to_string(@) }} holding ClusterRoles {{ request.clusterRoles | to_string(@) }} and Roles {{ request.roles | to_string(@) }}. The subjects and groups requested in the CSR were \"{{ x509_decode(base64_decode('{{ request.object.spec.request }}')).Subject | to_string(@) }}\""deny: {}
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.