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

Closed
opened 2026-11-27 19:34:05 +00:00 by Claude · 0 comments
Owner

Problem

roles/docker/tasks/install.yml:20-26 downloads the Docker GPG key from docker_gpg_url (roles/docker/defaults/main.yml:11-12) with ansible.builtin.get_url and no checksum:. Whatever that URL serves is installed as the keyring that signs the Docker APT source, so a changed or substituted key is trusted silently.

Out of scope: the APT source format and the package list.

Proposal

Follow the tailscale role (roles/tailscale/defaults/main.yml:17-21): a static keyring sha256 input (for example docker_keyring_checksum), with a comment naming the key and saying that a rotated key fails the install until a person has checked the new one and updated the hash, and checksum: "sha256:{{ docker_keyring_checksum }}" on the get_url task. Add the input to meta/argument_specs.yml and the role README, plus a changelog fragment.

Acceptance criteria

  • The get_url task of the Docker key carries checksum: from a role input; checked by reading roles/docker/tasks/install.yml.
  • The input has a default (the sha256 of the current key) and is documented in roles/docker/meta/argument_specs.yml and roles/docker/README.md; pre-commit run --all-files passes.
  • A wrong checksum fails the install task; the docker Molecule scenario passes in CI with the correct one.
  • A changelog fragment in changelogs/fragments/ describes the new input.
### Problem `roles/docker/tasks/install.yml:20-26` downloads the Docker GPG key from `docker_gpg_url` (`roles/docker/defaults/main.yml:11-12`) with `ansible.builtin.get_url` and no `checksum:`. Whatever that URL serves is installed as the keyring that signs the Docker APT source, so a changed or substituted key is trusted silently. Out of scope: the APT source format and the package list. ### Proposal Follow the `tailscale` role (`roles/tailscale/defaults/main.yml:17-21`): a static keyring sha256 input (for example `docker_keyring_checksum`), with a comment naming the key and saying that a rotated key fails the install until a person has checked the new one and updated the hash, and `checksum: "sha256:{{ docker_keyring_checksum }}"` on the `get_url` task. Add the input to `meta/argument_specs.yml` and the role README, plus a changelog fragment. ### Acceptance criteria - [ ] The `get_url` task of the Docker key carries `checksum:` from a role input; checked by reading `roles/docker/tasks/install.yml`. - [ ] The input has a default (the sha256 of the current key) and is documented in `roles/docker/meta/argument_specs.yml` and `roles/docker/README.md`; `pre-commit run --all-files` passes. - [ ] A wrong checksum fails the install task; the docker Molecule scenario passes in CI with the correct one. - [ ] A changelog fragment in `changelogs/fragments/` describes the new input.
Claude added the Kind/Security
Status
Needs Triage
labels 2026-11-27 19:34:05 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mortis/Kamino#448