Verify signatures & provenance
Every image on registry.kaloracloud.eu is signed with the Kalora cosign key and carries signed attestations: SPDX SBOM, OpenVEX and SLSA v1 provenance, plus a CSAF 2.0 advisory when the digest has findings. Formats and CRA mapping: CRA & NIS2 feeds.
You need cosign v2, crane, jq, and optionally oras v1.2+.
Public key
Section titled “Public key”Always get the key from the registry, and check it against the published checksum:
curl -fsSLO https://registry.kaloracloud.eu/cosign.pubcurl -fsSLO https://registry.kaloracloud.eu/cosign.pub.sha256
sha256sum -c cosign.pub.sha256 # macOS: shasum -a 256 -c cosign.pub.sha256cosign.pub: OKcosign.pub.sha256 holds a single <hash> cosign.pub line. Pass that file to -c, not the key itself. If the check fails, don’t use the key:
cosign.pub: FAILEDsha256sum: WARNING: 1 computed checksum did NOT matchKalora signs with a keyed pair and does not upload to Rekor, so pass --insecure-ignore-tlog=true. The signature is still checked against the key.
Verify the signature
Section titled “Verify the signature”Signatures are bound to the digest. Tags are mutable, so resolve the digest first, then verify and deploy that digest:
IMAGE=registry.kaloracloud.eu/kalora/python-hardenedDIGEST=$(crane digest "${IMAGE}:3.12")
cosign verify --key cosign.pub --insecure-ignore-tlog=true "${IMAGE}@${DIGEST}"Example output for the current python-hardened image:
$ cosign verify --key cosign.pub --insecure-ignore-tlog=true \ registry.kaloracloud.eu/kalora/python-hardened@sha256:a68b17c92979d47c1322204f666dc0954d42395a189347960fc84b66a3b27c34
Verification for registry.kaloracloud.eu/kalora/python-hardened@sha256:a68b17c9... --The following checks were performed on each of these signatures: - The cosign claims were validated - The signatures were verified against the specified public keyVerify attestations
Section titled “Verify attestations”| Attestation | --type |
predicateType |
|---|---|---|
| SPDX SBOM | spdxjson |
https://spdx.dev/Document |
| OpenVEX | openvex |
https://openvex.dev/ns |
| CSAF 2.0 | https://csaf.io/schema/csaf/2.0 |
https://csaf.io/schema/csaf/2.0 |
| SLSA v1 provenance | slsaprovenance1 |
https://slsa.dev/provenance/v1 |
Each command prints DSSE envelopes. The predicate is base64-encoded in .payload:
verify_att() { cosign verify-attestation --key cosign.pub --insecure-ignore-tlog=true \ --type "$1" "${IMAGE}@${DIGEST}" \ | jq '.payload | @base64d | fromjson | .predicate'}
verify_att spdxjson > sbom.spdx.jsonverify_att openvex | jq '.statements[] | {cve: .vulnerability.name, status, justification}'verify_att https://csaf.io/schema/csaf/2.0 > csaf.json # only on digests with findingsverify_att slsaprovenance1 | jq '{buildType: .buildDefinition.buildType, builder: .runDetails.builder.id}'The provenance has buildType https://kaloracloud.eu/slsa/buildtypes/argo-apko/v1 and builder.id https://kaloracloud.eu/argo-workflows/image-factory-pipeline. The first entry in resolvedDependencies is the source commit.
ORAS referrers
Section titled “ORAS referrers”The CycloneDX SBOM and the HTML security report are OCI referrers, not cosign attestations:
oras discover "${IMAGE}@${DIGEST}" --format tree
ref() { oras discover "${IMAGE}@${DIGEST}" --artifact-type "$1" --format json | jq -r '.referrers[0].digest // .manifests[0].digest'; }oras pull "${IMAGE}@$(ref application/vnd.cyclonedx+json)" -o ./cyclonedxoras pull "${IMAGE}@$(ref application/vnd.kalora.security-report+html)" -o ./reportEnforce at admission
Section titled “Enforce at admission”Paste the contents of https://registry.kaloracloud.eu/cosign.pub where marked.
Kyverno
Section titled “Kyverno”apiVersion: kyverno.io/v1kind: ClusterPolicymetadata: name: verify-kalora-imagesspec: validationFailureAction: Enforce background: false webhookTimeoutSeconds: 30 rules: - name: verify-kalora-signature match: any: - resources: kinds: [Pod] verifyImages: - imageReferences: - "registry.kaloracloud.eu/kalora/*" mutateDigest: true verifyDigest: true required: true attestors: - entries: - keys: publicKeys: |- -----BEGIN PUBLIC KEY----- <contents of cosign.pub> -----END PUBLIC KEY----- rekor: ignoreTlog: true ctlog: ignoreSCT: true attestations: - type: https://slsa.dev/provenance/v1 attestors: - entries: - keys: publicKeys: |- -----BEGIN PUBLIC KEY----- <contents of cosign.pub> -----END PUBLIC KEY----- rekor: ignoreTlog: true ctlog: ignoreSCT: true conditions: - all: - key: "{{ runDetails.builder.id }}" operator: Equals value: "https://kaloracloud.eu/argo-workflows/image-factory-pipeline"Sigstore policy-controller
Section titled “Sigstore policy-controller”apiVersion: policy.sigstore.dev/v1beta1kind: ClusterImagePolicymetadata: name: kalora-imagesspec: images: - glob: "registry.kaloracloud.eu/kalora/**" authorities: - name: kalora-key key: hashAlgorithm: sha256 data: | -----BEGIN PUBLIC KEY----- <contents of cosign.pub> -----END PUBLIC KEY----- # No ctlog: Kalora signatures are not in Rekor. attestations: - name: slsa-provenance predicateType: slsaprovenance1 - name: spdx-sbom predicateType: spdxjsonOpt namespaces in with kubectl label namespace my-app policy.sigstore.dev/include=true.
OPA Gatekeeper
Section titled “OPA Gatekeeper”Gatekeeper evaluates Rego, not signatures. Use it to allow only Kalora repositories and require digest pins, then add Ratify as a Gatekeeper external data provider with a cosign verifier and the Kalora public key for the signature check.
apiVersion: templates.gatekeeper.sh/v1kind: ConstraintTemplatemetadata: name: k8skaloraimagesspec: crd: spec: names: kind: K8sKaloraImages validation: openAPIV3Schema: type: object properties: repos: type: array items: type: string targets: - target: admission.k8s.gatekeeper.sh rego: | package k8skaloraimages
import rego.v1
containers contains c if { some c in input.review.object.spec.containers } containers contains c if { some c in input.review.object.spec.initContainers } containers contains c if { some c in input.review.object.spec.ephemeralContainers }
allowed(image) if { some repo in input.parameters.repos startswith(image, repo) }
violation contains {"msg": msg} if { some c in containers not allowed(c.image) msg := sprintf("%v: %v is not from an allowed repository", [c.name, c.image]) }
violation contains {"msg": msg} if { some c in containers not contains(c.image, "@sha256:") msg := sprintf("%v: %v must be pinned by digest", [c.name, c.image]) }---apiVersion: constraints.gatekeeper.sh/v1beta1kind: K8sKaloraImagesmetadata: name: kalora-images-by-digestspec: match: kinds: - apiGroups: [""] kinds: [Pod] namespaces: [my-app] parameters: repos: - registry.kaloracloud.eu/kalora/ - registry.kaloracloud.eu/private/Test pod
Section titled “Test pod”apiVersion: v1kind: Podmetadata: name: kalora-python-check namespace: my-appspec: restartPolicy: Never securityContext: runAsNonRoot: true containers: - name: python image: registry.kaloracloud.eu/kalora/python-hardened@sha256:a68b17c92979d47c1322204f666dc0954d42395a189347960fc84b66a3b27c34 command: ["python", "-c", "print('verified')"] resources: requests: cpu: "50m" memory: "64Mi" limits: cpu: "200m" memory: "128Mi" securityContext: allowPrivilegeEscalation: false capabilities: drop: ["ALL"]Troubleshooting
Section titled “Troubleshooting”Tag vs digest. If you verify a tag, cosign resolves it at that moment, and the tag may point somewhere else by the time you deploy. Verify and deploy by digest. In Kyverno, mutateDigest: true pins the digest for you.
Private images. The kalora project is public. The private project needs credentials for cosign as well as for pulls:
cosign login registry.kaloracloud.eu -u <user> -p <token> # or docker loginWithout credentials you get 401 Unauthorized. Admission controllers need the pull secret too (Kyverno: imageRegistryCredentials.secrets).
Failed verification.
| Error | Cause |
|---|---|
no matching signatures: invalid signature when validating ASN.1 encoded signature |
Wrong key, or the image was not signed by Kalora |
no signatures found |
Unsigned digest, e.g. your own image built FROM a Kalora base. Verify the base digest, and sign your own image yourself |
| transparency log / bundle not found | Missing --insecure-ignore-tlog=true |
none of the attestations matched the predicate type: ... |
Wrong --type. CSAF needs the full URI |
All of these exit non-zero, so cosign verify can gate CI directly.