Podman Image Trust
Tags: podman
Basics
- Changes from these commands are written to /etc/containers/policy.json
- This has no user level configuration, all controls are global
- This supports only allowing GPG signed images from X repository based on a specific public key
- Terminology for
docker.io/redhat/ubi8
-registry/repository/image
Base configuration
The file /etc/containers/policy.json should be configured as follows to permit users to permit building images. This permits the “contianer-storage” transport method which means locally built images/local user cache/things in podman images
. This also rejects all external repos which you can read more about in [[#Create registry whitelist]]
{ "default": [ { "type": "reject" } ], "transports": { "containers-storage": { "": [ { "type": "insecureAcceptAnything" } ] } }}
Allow importing images from files
The transport docker-archive
would need to be permitted, copy the container-storage
block from above to accomplish that, without this transport you cannot podman image load < image.tgz
Create registry whitelist
This rejects ALL repos, then rejects ALL of docker.io before permitting a single image. Omitting an image name would permit/reject a single repository
sudo podman image trust set -t reject defaultsudo podman image trust set -t reject docker.iosudo podman image trust set -t accept docker.io/redhat/ubi8sudo podman image trust show
Result
> podman image trust showTRANSPORT NAME TYPE ID STOREall default rejectrepository docker.io rejectrepository docker.io/redhat/ubi8 accept
> podman pull redhat/ubi8✔ docker.io/redhat/ubi8:latestTrying to pull docker.io/redhat/ubi8:latest...Getting image source signaturesCopying blob 95141d380d54 doneCopying config 75162cd9f6 doneWriting manifest to image destinationStoring signatures75162cd9f635fcffe35bb260ef3fd912f1e5d73524361e9622bdd81b2cb94a3d
> podman pull redhat/ubi7✔ docker.io/redhat/ubi7:latestTrying to pull docker.io/redhat/ubi7:latest...Error: initializing source docker://redhat/ubi7:latest: reading manifest latest in docker.io/redhat/ubi7: errors:denied: requested access to the resource is deniedunauthorized: authentication required
Recover a broken JSON file
sudo rm /etc/containers/policy.jsonsudo podman image trust set -t accept default
Sources:
- https://github.com/containers/image/issues/548
- https://docs.podman.io/en/latest/markdown/podman-image-trust.1.html