Podman Image Signing & Verification Policy Prompt
Set up container image signing with sigstore or GPG and enforce verification at pull time through policy.json and registries.d so unsigned images are rejected.
- Target user
- Security and platform engineers hardening a container supply chain
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a senior supply-chain security engineer who knows that signing images without enforcing verification changes nothing. I will provide some or all of: - The registries in use, which ones host my own images, and which are third-party - How images are built and pushed today, and from where (CI system, workstation) - Current `/etc/containers/policy.json` (or the rootless `~/.config/containers/policy.json`) and anything under `registries.d/` - Key material available: an existing GPG key, a cosign keypair, or a preference for keyless sigstore with an OIDC identity - Whether hosts run rootless, rootful, or both, and whether the same policy must apply on CI runners and production hosts Your job: 1. **State the current enforcement level** — read the existing policy and say plainly what it does today. A default of `insecureAcceptAnything` means no verification at all; say so rather than describing the file neutrally. Identify whether rootless users are covered, since they read a policy from their own config directory. 2. **Pick the signing approach** — compare sigstore signatures (cosign-compatible, keyless with OIDC identity or with a key pair) against classic GPG signatures, on the axes of key custody, revocation, CI ergonomics, and registry support. Recommend one and say what infrastructure it assumes. 3. **Establish where signatures live** — explain the two storage models: signatures attached in the registry as sigstore artifacts, versus a separate signature store configured through `registries.d` with `lookaside`/`lookaside-staging` entries. Give the `registries.d` YAML for my registries and state which model each registry actually supports, because this is the most common setup failure. 4. **Sign at push time** — give the concrete signing commands: `podman push --sign-by-sigstore=<param-file>` or `--sign-by-sigstore-private-key=` with the passphrase supplied non-interactively, or `--sign-by=<gpg-key>` for the GPG path, plus the cosign equivalent if signing happens outside Podman. Include how to keep the private key out of the image, the repo, and the CI log. 5. **Write the enforcement policy** — produce a complete `policy.json` with a restrictive default of `reject`, per-transport and per-scope entries using `sigstoreSigned` (with `keyPath`/`keyData` or `fulcio`+`rekor` identity constraints) or `signedBy` for GPG, and explicit `signedIdentity` matching so an attacker cannot present a validly signed image under a different repository name. Explain the `signedIdentity` clause, since omitting it is the subtle hole. 6. **Scope third-party images realistically** — decide per external registry whether to require signatures, pin by digest, or mirror into an internal registry and sign on ingest. Do not pretend upstream images are all signed; give the pragmatic path for the ones that are not. 7. **Deploy and verify** — show how to distribute the policy and keys to hosts (config management, and both the system and per-user policy paths), then prove enforcement: pull a signed image and see it succeed, pull an unsigned or tampered image and see it rejected, and capture the exact error text so operators recognize it. Include `skopeo` commands for inspecting signatures without pulling. 8. **Plan key lifecycle and break-glass** — cover key rotation with an overlap window where both keys are accepted, revocation handling, and a documented, audited procedure for the case where a critical deploy is blocked by policy, so the fallback is not "someone edits policy.json on the box". Output as: (a) current enforcement assessment, (b) signing approach with rationale, (c) `registries.d` configuration, (d) signing commands for the build pipeline, (e) complete `policy.json`, (f) third-party image handling, (g) deployment and verification steps with expected failure output, (h) key rotation and break-glass procedure. A restrictive default policy will block pulls the moment it lands, including on hosts mid-deploy. Sequence the rollout so signing and signature distribution are proven before enforcement is switched on, and state that ordering explicitly.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Why this prompt works
The premise of this prompt is stated in its first line: signing images without enforcing verification changes nothing. Plenty of organisations sign in CI, feel better, and run a policy.json whose default is insecureAcceptAnything — a configuration that accepts anything from anywhere. Forcing the model to read the existing policy and say plainly what it does today, rather than describing the file neutrally, is what converts a vague supply-chain initiative into a finding someone has to act on.
Step three exists because the most common practical failure is not cryptographic, it is topological. Signatures either live attached in the registry as sigstore artifacts or in a separate lookaside store configured through registries.d, and not every registry supports both. Setups fail at exactly this seam — the signing side works, verification cannot find the signature, and the error is opaque. Requiring the registries.d YAML alongside a statement of which model each registry actually supports front-loads the incompatibility instead of discovering it during rollout.
The signedIdentity requirement and the break-glass procedure address the two ends of the same problem. Without explicit identity matching, the policy verifies that an image was signed rather than that this image belongs where it claims to, which is the hole an attacker walks through. Without a documented, audited fallback, the first blocked production deploy ends with someone editing policy.json on the box at 2am and never reverting it — enforcement that was defeated by its own strictness rather than by any attacker.
Related prompts
-
Podman Registry Mirror and Auth Configuration Prompt
Configure registries.conf mirrors, short-name resolution, and auth.json credential storage so Podman pulls from the right registry with the right credentials on every host.
-
Container Registry Authentication & Access Hardening Review Prompt
Review a container registry and its pull/push credentials for anonymous access, long-lived tokens, and over-broad scopes, and produce a hardened authentication, image-pull-secret, and access-control design.
-
Container Image Vulnerability Scan Triage Prompt
Turn noisy Trivy/Grype container image scan output into a prioritized, actionable remediation plan — separating reachable, fixable CVEs from base-image noise and false positives.
-
Docker to Podman Team Migration Plan Prompt
Produce a phased Docker-to-Podman migration plan covering socket compatibility, CI impact, rootless gaps, and the developer workflow changes a team will actually hit.
More Podman prompts & error guides
Browse every Podman prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.