You are browsing documentation for an older version. See the latest documentation here.

Verify Build Provenance for Signed Kong Images

Kong produces build provenance for docker container images, which can be verified using cosign / slsa-verifier with attestations published to a Docker Hub repository.

This guide provides steps to verify build provenance for signed Kong Gateway Enterprise Docker container images in two different ways:

  • A minimal example, used to verify an image without leveraging any annotations
  • A complete example, leveraging optional annotations for increased trust

For the minimal example, you only need a Docker manifest digest and a GitHub repo name.

The Docker manifest digest is required for build provenance verification. The manifest digest can be different from the platform specific image digest for a specific distribution.

For the complete example, you need the same details as the minimal example, as well as any of the optional annotations you wish to verify:

ShorthandDescriptionExample Value
<repo>GitHub repositorykong-ee
<workflow name>GitHub workflow namePackage & Release
<workflow trigger>GitHub workflow triggerworkflow_dispatch

Because Kong uses GitHub Actions to build and release, Kong also uses GitHub’s OIDC identity to generate build provenance for container images, which is why many of these details are GitHub-related.

Examples

Prerequisites

For both examples, you need to:

  1. Ensure cosign / slsa-verifier is installed.

  2. Ensure regctl is installed.

  3. Collect the necessary image details.

  4. Parse the <manifest_digest> for the image using regctl.

    1. regctl manifest digest <image>:<tag>
  5. Set the COSIGN_REPOSITORY environment variable:

    1. export COSIGN_REPOSITORY=kong/notary

The GitHub owner is case-sensitive (Kong/kong-ee vs kong/kong-ee).

Minimal example

Using Cosign

Run the cosign verify-attestation ... command:

  1. cosign verify-attestation \
  2. <image>:<tag>@sha256:<manifest_digest> \
  3. --type='slsaprovenance' \
  4. --certificate-oidc-issuer='https://token.actions.githubusercontent.com' \
  5. --certificate-identity-regexp='^https://github.com/slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@refs/tags/v[0-9]+.[0-9]+.[0-9]+$'

Here’s the same example using sample values instead of placeholders:

  1. cosign verify-attestation \
  2. 'kong/kong-gateway:3.6.0.0-ubuntu@sha256:2f4d417efee8b4c26649d8171dd0d26e0ca16213ba37b7a6b807c98a4fd413e8' \
  3. --type='slsaprovenance' \
  4. --certificate-oidc-issuer='https://token.actions.githubusercontent.com' \
  5. --certificate-identity-regexp='^https://github.com/slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@refs/tags/v[0-9]+.[0-9]+.[0-9]+$'

The command will exit with 0 when the cosign verification is completed:

  1. ...
  2. echo $?
  3. 0

Using slsa-verifier

Run the slsa-verifier verify-image ... command:

  1. slsa-verifier verify-image \
  2. <image>:<tag>@sha256:<manifest_digest> \
  3. --print-provenance \
  4. --source-uri 'github.com/Kong/<repo>'

Here’s the same example using sample values instead of placeholders:

  1. slsa-verifier verify-image \
  2. 'kong/kong-gateway:3.6.0.0-ubuntu@sha256:2f4d417efee8b4c26649d8171dd0d26e0ca16213ba37b7a6b807c98a4fd413e8' \
  3. --print-provenance \
  4. --source-uri 'github.com/Kong/kong-ee'

The command will print “Verified SLSA provenance” if successful:

  1. ...
  2. PASSED: Verified SLSA provenance

Complete example

Using Cosign

Run the cosign verify-attestation ... command:

  1. cosign verify-attestation \
  2. <image>:<tag>@sha256:<manifest_digest> \
  3. --type='slsaprovenance' \
  4. --certificate-oidc-issuer='https://token.actions.githubusercontent.com' \
  5. --certificate-identity-regexp='^https://github.com/slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@refs/tags/v[0-9]+.[0-9]+.[0-9]+$' \
  6. --certificate-github-workflow-repository='Kong/<repo>' \
  7. --certificate-github-workflow-name='<workflow name>'

Here’s the same example using sample values instead of placeholders:

  1. cosign verify-attestation \
  2. 'kong/kong-gateway:3.6.0.0-ubuntu@sha256:2f4d417efee8b4c26649d8171dd0d26e0ca16213ba37b7a6b807c98a4fd413e8' \
  3. --type='slsaprovenance' \
  4. --certificate-oidc-issuer='https://token.actions.githubusercontent.com' \
  5. --certificate-identity-regexp='^https://github.com/slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@refs/tags/v[0-9]+.[0-9]+.[0-9]+$' \
  6. --certificate-github-workflow-repository='Kong/kong-ee' \
  7. --certificate-github-workflow-name='Package & Release'

Using slsa-verifier

Run the slsa-verifier verify-image ... command:

  1. slsa-verifier verify-image \
  2. <image>:<tag>@sha256:<manifest_digest> \
  3. --print-provenance \
  4. --source-uri 'github.com/Kong/<repo>' \
  5. --build-workflow-input official="true"

Here’s the same example using sample values instead of placeholders:

  1. slsa-verifier verify-image \
  2. 'kong/kong-gateway:3.6.0.0-ubuntu@sha256:2f4d417efee8b4c26649d8171dd0d26e0ca16213ba37b7a6b807c98a4fd413e8' \
  3. --print-provenance \
  4. --source-uri 'github.com/Kong/kong-ee' \
  5. --build-workflow-input official="true"