Add Kyverno admission policies and CIS mappings
Kube-bench CIS scan / Scan ephemeral K3s cluster (push) Failing after 3m11s

This commit is contained in:
2026-08-10 17:34:45 -04:00
parent fc786ec63c
commit ff033f2fcb
10 changed files with 253 additions and 12 deletions
@@ -0,0 +1,39 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: restrict-image-registries
annotations:
policies.kyverno.io/title: Restrict image registries
policies.kyverno.io/category: Supply chain
policies.kyverno.io/severity: high
# CIS 5.5.1: image provenance. This is a concrete admission control that
# supports the broader provenance objective but is not the full CIS test.
policies.kyverno.io/cis-control: "5.5.1 supplemental"
spec:
validationFailureAction: Enforce
background: false
failurePolicy: Fail
rules:
- name: images-from-approved-registries
match:
any:
- resources:
kinds:
- Pod
namespaceSelector:
matchLabels:
security-baseline/open: "true"
validate:
message: Images must come from ghcr.io, quay.io, or docker.io/library.
foreach:
- list: request.object.spec.containers[]
anyPattern:
- image: ghcr.io/*
- image: quay.io/*
- image: docker.io/library/*
- list: request.object.spec.initContainers[]
anyPattern:
- image: ghcr.io/*
- image: quay.io/*
- image: docker.io/library/*