Lion Cipher Lab
Verify image signatures at admission with Kyverno: make the cluster refuse any image not signed by who you trust
- Cloud Security
- Advanced
- ~75 min
- Free · no account required
Why it matters
Signing an image proves who built it and that it has not been altered — but a signature that nobody is forced to check is a sticker on a box that no guard ever looks at. The gap this lab closes is the one between 'we sign our images' and 'our cluster will not run an image unless it is signed by us.' Picture the two failures it prevents. First: an attacker who has compromised a build account, a registry credential, or a developer laptop pushes their own image — malware wearing your repository's name — and a Deployment references it; if nothing verifies signatures, Kubernetes pulls it and runs…
What you'll learn
- installing Kyverno and turning on cosign-based image-signature verification at admission
- writing a Kyverno ImageValidatingPolicy that calls verifyImageSignatures against a pinned attestor
- pinning the SIGNER (keyless issuer+subject, or a public key) so 'signed' means 'signed by who I trust'
- the Audit-then-Deny rollout, and why an Audit-mode verify policy blocks absolutely nothing
- using validationConfigurations.mutateDigest to rewrite the admitted image to the digest you verified (closing the tag-mutation TOCTOU)
- scoping matchImageReferences with a glob that is neither too broad nor too narrow
- proving a signed image is admitted while an unsigned image AND a wrong-signer image are both rejected
- placing the three supply-chain controls: sign-in-CI vs verify-at-admission vs scan-for-vulns
Steps in this lab
- The sticker nobody checks — signing produces provenance, admission is what enforces it
- The vocabulary, and the fork in Kyverno's API you must know about
- Install the four tools and build a throwaway kind cluster
- Install Kyverno into the cluster and wait for it to be genuinely ready
- Make three real images to test with — one signed, one unsigned, one signed by the WRONG key
- Write the ImageValidatingPolicy — pinned to your key, in AUDIT first
- Prove it — Audit blocks nothing, then Deny admits the signed image and rejects the other two
- The judgment: five ways this goes wrong, and where verification stops