Browse and discover Kyverno policies for Kubernetes security and governance

617 policies found(Page 1 of 26)
ValidateMedium
Prevent Use of Default Project

This policy prevents the use of the default project in an Application.

#Argo
Applicationv1.6.0+
ValidateMedium
Prevent Updates to Project

This policy prevents updates to the project field after an Application is created.

#Argo
Applicationv1.6.0+
ValidateMedium
Ensure ApplicationSet Name Matches Project

This policy ensures that the name of the ApplicationSet is the same value provided in the project.

#Argo
ApplicationSetv1.6.0+
ValidateMedium
Require aws-node DaemonSet use IRSA

According to EKS best practices, the `aws-node` DaemonSet is configured to use a role assigned to the EC2 instances to assign IPs to Pods. This role includes several AWS managed policies that effectively allow all Pods running on a Node to attach/detach ENIs, assign/unassign IP addresses, or pull images from ECR. Since this presents a risk to your cluster, it is recommended that you update the `aws-node` DaemonSet to use IRSA. This policy ensures that the `aws-node` DaemonSet running in the `kube-system` Namespace is not still using the `aws-node` ServiceAccount.

#AWS#EKS Best Practices
DaemonSetv1.6.0+
ValidateMedium
Require Encryption with AWS LoadBalancers

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.

#AWS#EKS Best Practices
Servicev1.6.0+
ValidateMedium
Prevent Use of Default Project in CEL expressions

This policy prevents the use of the default project in an Application.

#Argo in CEL
Applicationv1.11.0+
ValidateMedium
Application Field Validation

This policy performs some best practices validation on Application fields. Path or chart must be specified but never both. And destination.name or destination.server must be specified but never both.

#Argo
Applicationv1.6.0+
ValidateMedium
Application Field Validation in CEL expressions

This policy performs some best practices validation on Application fields. Path or chart must be specified but never both. And destination.name or destination.server must be specified but never both.

#Argo in CEL
Applicationv1.11.0+
ValidateMedium
Enforce AppProject with clusterResourceBlacklist

An AppProject may optionally specify clusterResourceBlacklist which is a blacklisted group of cluster resources. This is often a good practice to ensure AppProjects do not allow more access than needed. This policy is a combination of two rules which enforce that all AppProjects specify clusterResourceBlacklist and that their group and kind have wildcards as values.

#Argo
AppProjectv1.6.0+
GenerateMedium
Argo Cluster Secret Generation From Rancher CAPI Secret

This policy generates and synchronizes Argo CD cluster secrets from Rancher managed cluster.provisioning.cattle.io/v1 resources and their corresponding CAPI secrets. In this solution, Argo CD integrates with Rancher managed clusters via the central Rancher authentication proxy which shares the network endpoint of the Rancher API/GUI. The policy implements work-arounds for Argo CD issue https://github.com/argoproj/argo-cd/issues/9033 "Cluster-API cluster auto-registration" and Rancher issue https://github.com/rancher/rancher/issues/38053 "Fix type and labels Rancher v2 provisioner specifies when creating CAPI Cluster Secret".

#Argo
Secretv1.7.0+
ValidateMedium
Prevent Updates to Project in CEL expressions

This policy prevents updates to the project field after an Application is created.

#Argo in CEL
Application
ValidateMedium
Enforce AppProject with clusterResourceBlacklist in CEL expressions

An AppProject may optionally specify clusterResourceBlacklist which is a blacklisted group of cluster resources. This is often a good practice to ensure AppProjects do not allow more access than needed. This policy is a combination of two rules which enforce that all AppProjects specify clusterResourceBlacklist and that their group and kind have wildcards as values.

#Argo in CEL
AppProjectv1.11.0+
ValidateMedium
Ensure ApplicationSet Name Matches Project in CEL expressions

This policy ensures that the name of the ApplicationSet is the same value provided in the project.

#Argo in CEL
ApplicationSetv1.11.0+
ValidateMedium
Require Encryption with AWS LoadBalancers in CEL expressions

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.

#AWS#EKS Best Practices in CEL
Service
ValidateMedium
Check deprecated APIs in CEL expressions

Kubernetes APIs are sometimes deprecated and removed after a few releases. As a best practice, older API versions should be replaced with newer versions. This policy validates for APIs that are deprecated or scheduled for removal. Note that checking for some of these resources may require modifying the Kyverno ConfigMap to remove filters. PodSecurityPolicy is removed in v1.25 so therefore the validate-v1-25-removals rule may not completely work on 1.25+.

#Best Practices in CEL
Kubernetes APIs
ValidateMedium
Disallow CRI socket mounts in CEL expressions

Container daemon socket bind mounts allows access to the container engine on the node. This access can be used for privilege escalation and to manage containers outside of Kubernetes, and hence should not be allowed. This policy validates that the sockets used for CRI engines Docker, Containerd, and CRI-O are not used. In addition to or replacement of this policy, preventing users from mounting the parent directories (/var/run and /var) may be necessary to completely prevent socket bind mounts.

#Best Practices#EKS Best Practices in CEL
Podv1.11.0+
ValidateMedium
Disallow Default Namespace in CEL expressions

Kubernetes Namespaces are an optional feature that provide a way to segment and isolate cluster resources across multiple applications and users. As a best practice, workloads should be isolated with Namespaces. Namespaces should be required and the default (empty) Namespace should not be used. This policy validates that Pods specify a Namespace name other than `default`. Rule auto-generation is disabled here due to Pod controllers need to specify the `namespace` field under the top-level `metadata` object and not at the Pod template level.

#Multi-Tenancy in CEL
Podv1.11.0+
ValidateMedium
Disallow empty Ingress host in CEL expressions

An ingress resource needs to define an actual host name in order to be valid. This policy ensures that there is a hostname for each rule defined.

#Best Practices in CEL
Ingressv1.11.0+
ValidateMedium
Disallow Helm Tiller in CEL expressions

Tiller, found in Helm v2, has known security challenges. It requires administrative privileges and acts as a shared resource accessible to any authenticated user. Tiller can lead to privilege escalation as restricted users can impact other users. It is recommend to use Helm v3+ which does not contain Tiller for these reasons. This policy validates that there is not an image containing the name `tiller`.

#Sample in CEL
Podv1.11.0+
ValidateMedium
Drop All Capabilities in CEL expressions

Capabilities permit privileged actions without giving full root access. All capabilities should be dropped from a Pod, with only those required added back. This policy ensures that all containers explicitly specify the `drop: ["ALL"]` 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.

#Best Practices in CEL
Podv1.11.0+
ValidateMedium
Drop CAP_NET_RAW in CEL expressions

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.

#Best Practices in CEL
Podv1.11.0+
ValidateMedium
Require Labels in CEL expressions

Define and use labels that identify semantic attributes of your application or Deployment. A common set of labels allows tools to work collaboratively, describing objects in a common manner that all tools can understand. The recommended labels describe applications in a way that can be queried. This policy validates that the label `app.kubernetes.io/name` is specified with some value.

#Best Practices in CEL
Podv1.11.0+
ValidateMedium
Require Limits and Requests in CEL expressions

As application workloads share cluster resources, it is important to limit resources requested and consumed by each Pod. It is recommended to require resource requests and limits per Pod, especially for memory and CPU. If a Namespace level request or limit is specified, defaults will automatically be applied to each Pod based on the LimitRange configuration. This policy validates that all containers have something specified for memory and CPU requests and memory limits.

#Best Practices#EKS Best Practices in CEL
Podv1.11.0+
ValidateMedium
Require Read-Only Root Filesystem in CEL expressions

A read-only root file system helps to enforce an immutable infrastructure strategy; the container only needs to write on the mounted volume that persists the state. An immutable root filesystem can also prevent malicious binaries from writing to the host system. This policy validates that containers define a securityContext with `readOnlyRootFilesystem: true`.

#Best Practices#EKS Best Practices#PSP Migration in CEL
Podv1.11.0+
Showing 1 to 24 of 617 policies
...