feat(docker): pin the Docker apt key by checksum #454

Merged
Defame1297 merged 2 commits from feat/448-docker-keyring-checksum into main 2026-11-28 08:22:24 +00:00
Owner

What and why

Closes #448

The Docker APT key was downloaded with get_url and no checksum, so whatever the URL served was trusted as the keyring for the Docker source. The key is now checked against a new input, docker_keyring_checksum, which defaults to the sha256 of Docker's current key (fingerprint 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88). It follows the tailscale role. The hash is fixed on purpose: if Docker rotates or re-armors the key, the install fails until a person has checked the new key and updated the hash. Consumers who override docker_gpg_url must now set docker_keyring_checksum as well. The fragment, the README and the argument spec say so.

  • defaults/main.yml, tasks/install.yml, meta/argument_specs.yml, README.md: the new input and checksum: on the key task.
  • Molecule default: the stub repo's key is generated on each run, so converge and the verify plays that apply the role compute its sha256 at runtime. A new refusal play (tasks/refuse_checksum.yml) runs the role with a wrong checksum and a separate keyring path, then asserts that Install Docker APT GPG key fails with a checksum mismatch.
  • changelogs/fragments/448-docker-keyring-checksum.yml: minor_changes.

Verified

  • I fetched https://download.docker.com/linux/ubuntu/gpg and checked that its sha256 matches the default. gpg --show-keys shows fingerprint 9DC8…CD88, Docker Release (CE deb).
  • pre-commit run --all-files passes.
  • ansible-test sanity passes (pre-push hook).
  • I read the ansible-core get_url source: a mismatch fails with "did not match", and a file already at dest that differs is downloaded again and checked.

Not verified

  • I have not run the docker Molecule scenario, including the new refusal test. Molecule runs only in CI.
  • No test downloads the live key, so the default hash is held only by the manual check above and by review.

  • I confirm third-party material is recorded in NOTICE and REUSE.toml, or there is none.

Assisted-by: Claude Code

## What and why Closes #448 The Docker APT key was downloaded with `get_url` and no checksum, so whatever the URL served was trusted as the keyring for the Docker source. The key is now checked against a new input, `docker_keyring_checksum`, which defaults to the sha256 of Docker's current key (fingerprint `9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88`). It follows the `tailscale` role. The hash is fixed on purpose: if Docker rotates or re-armors the key, the install fails until a person has checked the new key and updated the hash. Consumers who override `docker_gpg_url` must now set `docker_keyring_checksum` as well. The fragment, the README and the argument spec say so. - `defaults/main.yml`, `tasks/install.yml`, `meta/argument_specs.yml`, `README.md`: the new input and `checksum:` on the key task. - Molecule `default`: the stub repo's key is generated on each run, so converge and the verify plays that apply the role compute its sha256 at runtime. A new refusal play (`tasks/refuse_checksum.yml`) runs the role with a wrong checksum and a separate keyring path, then asserts that `Install Docker APT GPG key` fails with a checksum mismatch. - `changelogs/fragments/448-docker-keyring-checksum.yml`: `minor_changes`. ## Verified - I fetched `https://download.docker.com/linux/ubuntu/gpg` and checked that its sha256 matches the default. `gpg --show-keys` shows fingerprint `9DC8…CD88`, Docker Release (CE deb). - `pre-commit run --all-files` passes. - `ansible-test sanity` passes (pre-push hook). - I read the ansible-core `get_url` source: a mismatch fails with "did not match", and a file already at `dest` that differs is downloaded again and checked. ## Not verified - I have not run the docker Molecule scenario, including the new refusal test. Molecule runs only in CI. - No test downloads the live key, so the default hash is held only by the manual check above and by review. --- - [x] I confirm third-party material is recorded in `NOTICE` and `REUSE.toml`, or there is none. Assisted-by: Claude Code
Claude added 2 commits 2026-11-27 22:29:21 +00:00
The key that signs the Docker repository was trusted as whatever the URL served. It is now checked
against a pinned sha256, so a changed key stops the install until a person has verified it.

Assisted-by: Claude Code
docs(docker): say the keyring checksum follows an overridden key URL
Build / build (pull_request) Successful in 28s
Lint / lint (pull_request) Successful in 3m37s
Molecule / molecule (pull_request) Successful in 7m29s
a185a301db
Set docker_keyring_checksum together with docker_gpg_url, and state that
the checksum is the hex digest without the sha256: prefix.

Assisted-by: Claude Code
Defame1297 merged commit a2ab13a6e1 into main 2026-11-28 08:22:24 +00:00
Defame1297 deleted branch feat/448-docker-keyring-checksum 2026-11-28 08:22:24 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mortis/Kamino#454