Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Independent container updates #1080

Open
wants to merge 82 commits into
base: main
Choose a base branch
from
Open

Conversation

almet
Copy link
Member

@almet almet commented Feb 11, 2025

This pull request introduces "independent container updates", meaning that the container images will be able to be updated without issuing a new release, allowing for greater security. You can read more about the rationale at #1006.

Signatures are meant to be done with an hardware key (yubikey), for which the public key will be packaged alongside the shipped code.

On container installation, the container signatures are stored locally and checked against a known public key just before doing the conversion of the documents. Behind the curtain, it uses cosign, which enables us to have auditable signatures (so if somebody is to impersonate us, they would need to do so in public).

Graphical interface

The graphical interface has been updated to ask users if they want Dangerzone to check for container updates and apply them on their behalf. The updater_check setting is now deprecated and replaced by updater_icu_check.

image

Command-line interface

It adds a dangerzone-image CLI providing tooling to check for remote new images, verification of the attestations and signatures, also with the ability to create and use archives, for air-gapped environments.

$ dangerzone-image --help

  attest-provenance  Look up the image attestation to see if the image...
  get-manifest       Retrieves a remote manifest for a given image and...
  list-remote-tags   List the tags available for a given image.
  load-archive       Upgrade the local image to the one in the archive.
  prepare-archive    Prepare an archive to upgrade the dangerzone image...
  upgrade            Upgrade the image to the latest signed version.
  verify-local       Verify the local image signature against a public...

It is fixing the following issues:

Current progress

Before being ready to be shipped, we still need to:

almet and others added 6 commits February 11, 2025 18:13
It contains utilities to interact with OCI registries, like getting the list of
published tags and getting the content of a manifest. It does so
via the use of the Docker Registry API v2 [0].

The script has been added to the `dev_scripts`, and is also installed on
the system under `dangerzone-image`.

[0]  https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry
Signatures are stored in the OCI Manifest v2 registry [0], and are
expected to follow the Cosign Signature Specification [0]

The following CLI utilities are provided with `dangerzone-image`:

For checking new container images, upgrading them and downloading them:

- `upgrade` allows to upgrade the current installed image to the
  last one available on the OCI registry, downloading and storing the
  signatures in the process.
- `verify-local` allows the verify the currently installed image against
  downloaded signatures and public key.

To prepare and install archives on air-gapped environments:

- `prepare-archive` helps to prepare an archive to install on another
  machine
- `load-archive` helps upgrade the local image to the archive given
  in argument.

Signatures are stored locally using the format provided by `cosign
download signature`, and the Rekor log index is used to ensure the
requested-to-install container image is fresher than the one already
present on the system.

[0] https://github.com/sigstore/cosign/blob/main/specs/SIGNATURE_SPEC.md
The hash list provided on the Github releases page is now bundled in the
`reproduce-image.py` script, and the proper hashes are checked after
download.
A new `dangerzone-image attest-provenance` script is now available,
making it possible to verify the attestations of an image published on
the github container registry.

Container images are now build nightly and uploaded to the container
registry.
almet added 29 commits February 25, 2025 15:44
This is done to avoid forgetting windows specific arguments when calling `subprocess.run`.
This function does all the needed checks before returning `True`, making it a good external API.

Under the hood, the registry now has an `is_new_remote_image_available`
which is just for checking the presence of a new image, but doesn't do
any verirications on it, and there is also a new `check_signatures_and_logindex` that ensures that these two are valid.
The code making the actual requests and checks now lives in the
`updater.releases` module. The code should be easier to read and to
reason about.

Tests have been updated to reflect this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants