Skip to content

Docker: sign images with cosign, publish manually after the release from the GPG-signed tarballs - #9764

Open
ShahanaFarooqui wants to merge 4 commits into
ElementsProject:masterfrom
ShahanaFarooqui:signed-docker-images
Open

ShahanaFarooqui wants to merge 4 commits into
ElementsProject:masterfrom
ShahanaFarooqui:signed-docker-images

Conversation

@ShahanaFarooqui

Copy link
Copy Markdown
Collaborator

Closes #9607.

Until now the Docker images were the one release artifact with no signature path: compiled by CI from source and pushed, with nothing a user could check them against. This PR changes how they are built, when they are published, and adds a signature on what is published.

A new image built from the signed release tarballs

  • elementsproject/lightningd:v<VERSION>-signed does not compile. For each platform (amd64, arm64, armv7) it installs the reproducibly built Ubuntu 22.04 tarball from the GitHub release, clightning-v<VERSION>-Ubuntu-22.04-<arch>.tar.xz.
  • Before unpacking, the Dockerfile fetches the release's SHA256SUMS manifest and its .asc, and tools/verify-release-tarball.sh checks the signatures against every key in contrib/keys and the tarball against its manifest line. Two good signatures are required by default; any bad signature fails the build.
  • The binaries are not stripped, so every file under /usr/local in the image is byte for byte the one in the tarball the maintainers signed. That is what makes the image checkable after the fact.
  • docker build --build-arg LIGHTNINGD_FROM=release --build-arg VERSION=v<VERSION> . builds it locally. The default source mode and the existing v<VERSION> and v<VERSION>-vls images are unchanged.

Publishing moves to a manual workflow, run after the release

  • A new workflow_dispatch workflow, "Publish Docker images 🐳", replaces the Docker jobs in release.yml. The release captain runs it from the checklist once the GitHub release is public, with the version and push-latest.
  • It publishes all three images per release: v<VERSION> and v<VERSION>-vls from the tagged source as before, plus v<VERSION>-signed. Release candidates get the same three.
  • It builds from the tag it labels, whichever branch it is dispatched from, and refuses to build -signed for a tag whose Dockerfile predates it.
  • tools/build-release.sh docker is removed. It pushed to elementsproject/lightningd from a laptop with personal credentials: source-built only (no -vls, no -signed), no cosign signature, and latest tagged unconditionally, even for an rc. One run of it would break the promise that every published image verifies against the workflow identity, so it cannot stay as a fallback. --sudo and --no-push applied to nothing else and go with it.

Why manual, after the release

Inside the release run the manifests carry only the CI key's signature, the images would go out before anyone looked at the release, and the tarballs would come from workflow artifacts that expire after 90 days. Publishing afterwards checks the maintainers' co-signatures and can re-publish any release.

Every published image is signed with cosign

  • The publish job signs each image's digest keyless, under the workflow's GitHub OIDC identity. The signature is attached to the image on Docker Hub as an OCI referrer and recorded in the Rekor transparency log. No new secrets.
  • Users verify two different things, documented in the new "Verifying the Docker image" section of the installation guide: the cosign signature says who built and pushed the image and covers every layer; for -signed, a file-by-file hash comparison against the GPG-signed tarball says what is inside, with trust rooted in the maintainers' keys.

Why a -signed suffix (for now)

The tarball-based image differs from today's lightningd in more than provenance (see below), and the signed-tarball build has never been exercised in a release. Publishing it under a new tag lets it run for a few releases without changing what elementsproject/lightningd:v<VERSION> users get. Once it has proven out, the plan is to make it the plain lightningd (and -vls) image, keep the -signed tags for one transition release, then drop the suffix.

Decisions taken

  • Trust set is any key in contrib/keys; a bad signature from any key fails the build.
  • The tarball is built with compat enabled and dynamic linking, unlike the source image (--enable-static --disable-compat). These become the image's defaults when -signed replaces lightningd.
  • The Ubuntu 22.04 tarball, not 24.04 or 26.04: the image's base is debian:bookworm-slim with glibc 2.36, and a binary only runs on a glibc at least as new as the one it was built against (22.04: 2.35, 24.04: 2.39, 26.04: 2.43). When 22.04 leaves the repro matrix, the base image and CLN_RELEASE_PLATFORM move together.
  • No -vls-signed: VLS is compiled from a pinned tag with nothing signed to check.
  • The -signed image is 285 MB uncompressed vs 206 MB, the price of not stripping.

Tested

On my fork against the published v26.12rc1 (run): all three platforms verified two signatures and the tarball, cosign verify passes against the workflow identity, and all 250 files of the tarball are in the published image with identical hashes. The source-built variants through the new workflow are unchanged in substance but not yet run end to end.

🤖 Generated with Claude Code

ShahanaFarooqui and others added 4 commits November 24, 2026 19:17
With --build-arg LIGHTNINGD_FROM=release the image installs the
reproducibly built Ubuntu 22.04 tarball of ${VERSION} from the GitHub
release instead of compiling, after tools/verify-release-tarball.sh
has checked it against the SHA256SUMS manifest, the manifest's
signatures and the keys in contrib/keys.  The script reads gpg's
status lines, since `gpg --verify` fails whenever a co-signer's key is
unknown.  The binaries are not stripped, so they stay byte-identical
to the signed tarball.  The default source mode is unchanged.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Docker images leave the release action.  The new "Publish Docker
images 🐳" workflow is run from the checklist once the release is
public: <version> and <version>-vls are built from the tagged source
as before, the new <version>-signed installs the GPG-signed release
tarball (LIGHTNINGD_FROM=release), requiring two good signatures by
default.  Running after the release is public means the manifests
carry the maintainers' signatures, nothing is published before the
release was checked, and any release can be re-published, since the
tarballs come from the release page rather than expiring artifacts.

docker-build.yml and docker-publish.yml take a `variants` input, build
from the tag they label, and refuse -signed for a tag whose Dockerfile
predates it.  latest is pushed only when asked.

Changelog-Added: Docker: `elementsproject/lightningd:v<VERSION>-signed` images install the GPG-signed reproducible release tarballs instead of compiling from source.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Keyless, under the publish workflow's GitHub OIDC identity.  The
signature is attached to the image on Docker Hub as an OCI referrer
and recorded in Rekor; the publish job and its caller get
id-token: write, no new secrets.  The installation guide documents
verifying the signature and, for -signed images, the contents against
the GPG-signed tarball.

Changelog-Added: Docker: published images are signed with cosign; the installation guide describes how to verify them.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
The "Publish Docker images 🐳" workflow is the only publish path now.
This target pushed unsigned, source-built images under the official
name with an unconditional latest tag.  --sudo and --no-push applied
to nothing else, so they go with it.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build release Docker images from the GPG-signed release tarballs

1 participant