FR: Sign container images and build artifacts #2434

Open
opened 2026-10-31 17:14:57 +00:00 by macthecadillac · 7 comments

What new feature do you want to see? What problem does it solve?

Hi, thanks for amazing work here. I currently deploy continuwuity on my home server. To the best of my knowledge, the prebuilt binaries and containers are not signed (DCT, cosign, or GPG), and this breaks the chain of trust. To maintain this chain of trust, I need to have a Forgejo action that checks out the repo, verifies the signature of a tag/commit, and rebuilds the container from scratch. It would be nice if you guys could set up a pipeline to automatically sign the containers and the binaries in the releases page so I don't have to duplicate this work that is already done by the bot.

Further reading

No response

Additional context

No response

### What new feature do you want to see? What problem does it solve? Hi, thanks for amazing work here. I currently deploy continuwuity on my home server. To the best of my knowledge, the prebuilt binaries and containers are not signed (DCT, cosign, or GPG), and this breaks the chain of trust. To maintain this chain of trust, I need to have a Forgejo action that checks out the repo, verifies the signature of a tag/commit, and rebuilds the container from scratch. It would be nice if you guys could set up a pipeline to automatically sign the containers and the binaries in the releases page so I don't have to duplicate this work that is already done by the bot. ### Further reading _No response_ ### Additional context _No response_
Member

Since this project isn't homed on GitHub or GitLab.com, the method of signing with Cosign & OIDC workload identities (bound to an ephemeral key) that works well for those forges is not attainable here. That said, as long as the project is willing to generate and store a persistent key (either as a CI/CD secret or with a hyperscaler's KMS, OVHcloud KMS, OpenBao/HashiCorp Vault, etc.), and add some CI steps to generate binary/container signatures then push those to release assets & container registries, this doesn't seem out of the question entirely.

FWIW, the following packaging formats already have signatures of some form in place:

  • Debian/Ubuntu (Forgejo-native; Forgejo maintains its own key)
  • RPM (Terra [for Fedora et al] and the openSUSE Build Service [for SUSE] repository in use each maintain and publish their own keys)
  • FreeBSD (pkg-compatible repository provided by a community member)
Since this project isn't homed on GitHub or GitLab.com, the method of signing with Cosign & OIDC workload identities (bound to an ephemeral key) that works well for those forges is not attainable here. That said, as long as the project is willing to generate and store a persistent key (either as a CI/CD secret or with a hyperscaler's KMS, OVHcloud KMS, OpenBao/HashiCorp Vault, etc.), and add some CI steps to generate binary/container signatures then push those to release assets & container registries, this doesn't seem out of the question entirely. FWIW, the following packaging formats already have signatures of some form in place: - Debian/Ubuntu (Forgejo-native; Forgejo maintains its own key) - RPM (Terra [for Fedora et al] and the openSUSE Build Service [for SUSE] repository in use each maintain and publish their own keys) - FreeBSD (`pkg`-compatible [repository](https://forgejo.ellis.link/katie/continuwuity-bsd/src/branch/main/docs/freebsd) provided by a community member)
Member

I've been dealing with OpenBao at my work recently, I don't think its fitting for this project. Quite a complex piece of software, and not really useful for the kind of signing we'd need imo.

I am leaning towards generating a gpg key, certifying it with the maintainers' keys, storing it as a secret, and using that with gpg signatures. I believe docker images can be signed directly, and binaries can have a .gpg signature file attached as part of the release artifacts

I've been dealing with OpenBao at my work recently, I don't think its fitting for this project. Quite a complex piece of software, and not really useful for the kind of signing we'd need imo. I am leaning towards generating a gpg key, certifying it with the maintainers' keys, storing it as a secret, and using that with gpg signatures. I believe docker images can be signed directly, and binaries can have a .gpg signature file attached as part of the release artifacts
Author

OCI containers can be signed with GPG -- that's what Red Hat does with their images, and I've been doing that myself for quite some time. I suppose the maintainer can generate a signing subkey that can be used directly by Forgejo?

For reference, here is my own Forgejo workflow that does exactly that:

  build-and-push:
    name: Build and push image
    needs: check-version
    if: needs.check-version.outputs.should_build == 'true'
    runs-on: rhel-10
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Write signing key files
        run: |
          printf '%s' "${{ secrets.CONTAINER_SIGNING_PRIVATE_KEY }}" > signing.key
          printf '%s' "${{ secrets.CONTAINER_SIGNING_PRIVATE_KEY_PASSWORD }}" > signing.pass

     ...
    
      - name: Build image
        env:
          VERSION: ${{ needs.check-version.outputs.version }}
          MAJOR_MINOR: ${{ needs.check-version.outputs.major_minor }}
          MAJOR: ${{ needs.check-version.outputs.major }}
        run: |
          podman build \
            --rewrite-timestamp \
            --source-date-epoch $(git log -1 --format=%ct -- continuwuity/) \
            --build-arg CONTINUWUITY_VERSION="${VERSION}" \
            --tag "${TARGET_IMAGE}:${VERSION}" \
            --tag "${TARGET_IMAGE}:${MAJOR_MINOR}" \
            --tag "${TARGET_IMAGE}:${MAJOR}" \
            --tag "${TARGET_IMAGE}:latest" \
            --file continuwuity/Containerfile \
            .

      ...
      
      - name: Push latest tag
        run: |
          NEW_ID=$(podman inspect --format='{{.Id}}' "${TARGET_IMAGE}:latest")
          OLD_ID=$(podman inspect --format='{{.Id}}' old-image-latest:reference 2>/dev/null || echo "")
          if [ "$NEW_ID" = "$OLD_ID" ]; then
            echo "Latest image unchanged; skipping push."
          else
            podman push \
              --sign-by-sigstore-private-key signing.key \
              --sign-passphrase-file signing.pass \
              "${TARGET_IMAGE}:latest"
          fi
OCI containers can be signed with GPG -- that's what Red Hat does with their images, and I've been doing that myself for quite some time. I suppose the maintainer can generate a signing subkey that can be used directly by Forgejo? For reference, here is my own Forgejo workflow that does exactly that: ```yaml build-and-push: name: Build and push image needs: check-version if: needs.check-version.outputs.should_build == 'true' runs-on: rhel-10 steps: - name: Checkout repository uses: actions/checkout@v4 with: fetch-depth: 0 - name: Write signing key files run: | printf '%s' "${{ secrets.CONTAINER_SIGNING_PRIVATE_KEY }}" > signing.key printf '%s' "${{ secrets.CONTAINER_SIGNING_PRIVATE_KEY_PASSWORD }}" > signing.pass ... - name: Build image env: VERSION: ${{ needs.check-version.outputs.version }} MAJOR_MINOR: ${{ needs.check-version.outputs.major_minor }} MAJOR: ${{ needs.check-version.outputs.major }} run: | podman build \ --rewrite-timestamp \ --source-date-epoch $(git log -1 --format=%ct -- continuwuity/) \ --build-arg CONTINUWUITY_VERSION="${VERSION}" \ --tag "${TARGET_IMAGE}:${VERSION}" \ --tag "${TARGET_IMAGE}:${MAJOR_MINOR}" \ --tag "${TARGET_IMAGE}:${MAJOR}" \ --tag "${TARGET_IMAGE}:latest" \ --file continuwuity/Containerfile \ . ... - name: Push latest tag run: | NEW_ID=$(podman inspect --format='{{.Id}}' "${TARGET_IMAGE}:latest") OLD_ID=$(podman inspect --format='{{.Id}}' old-image-latest:reference 2>/dev/null || echo "") if [ "$NEW_ID" = "$OLD_ID" ]; then echo "Latest image unchanged; skipping push." else podman push \ --sign-by-sigstore-private-key signing.key \ --sign-passphrase-file signing.pass \ "${TARGET_IMAGE}:latest" fi ```
Author

My solution is a bit of a makeshift one -- it works, but it creates a bit of noise in the container registry. Since I'm the only one using my repository, it really doesn't matter. I believe Red Hat does it a slightly different way to keep their container registry clean.

My solution is a bit of a makeshift one -- it works, but it creates a bit of noise in the container registry. Since I'm the only one using my repository, it really doesn't matter. I believe Red Hat does it a slightly different way to keep their container registry clean.
Member

@silversys wrote in #2434 (comment):

I've been dealing with OpenBao at my work recently, I don't think its fitting for this project. Quite a complex piece of software, and not really useful for the kind of signing we'd need imo.

I am leaning towards generating a gpg key, certifying it with the maintainers' keys, storing it as a secret, and using that with gpg signatures. I believe docker images can be signed directly, and binaries can have a .gpg signature file attached as part of the release artifacts

To be clear, OpenBao is simply one external KMS-shaped place that could store a Cosign key. Like I said, persistent Cosign keys can live in something as simple as a CI/CD secret.

I would recommend against using GPG for a few reasons:

  • GnuPG, the most popular implementation, has loudly split from the IETF OpenPGP spec over essentially a hissy fit on the part of the GnuPG maintainer
  • GnuPG and similar tools have a considerable number of vulns (cf. gpg.fail from a CCC or two ago)
  • Cosign/Sigstore has strong support among container registries (Docker Hub, Harbor, etc.) and the ecosystem at large, and there is no such support for GPG/OpenPGP (see e.g. Docker's explicit instruction to use Cosign), particularly in consumer-side tooling.
  • Cosign also natively includes SBOM support, including w/i containers
  • Cosign supports in-toto attestations, while GPG/OpenPGP has no distinct analogue
  • While it's less applicable here on a self-hosted forge, the notion & usage of a public transparency log is a distinct feature of Cosign/Sigstore, and there's no such thing (at scale) for GPG/OpenPGP
  • IMO, relying directly on a mutable number & composition of human maintainers, and their PGP keys thereof, to establish trust in an artifact is, by and large, outmoded except for very specific use cases that are out of scope here
@silversys wrote in https://forgejo.ellis.link/continuwuation/continuwuity/issues/2434#issuecomment-39687: > I've been dealing with OpenBao at my work recently, I don't think its fitting for this project. Quite a complex piece of software, and not really useful for the kind of signing we'd need imo. > > I am leaning towards generating a gpg key, certifying it with the maintainers' keys, storing it as a secret, and using that with gpg signatures. I believe docker images can be signed directly, and binaries can have a .gpg signature file attached as part of the release artifacts To be clear, OpenBao is simply one external KMS-shaped place that could store a Cosign key. Like I said, persistent Cosign keys can live in something as simple as a CI/CD secret. I would recommend **against** using GPG for a few reasons: - GnuPG, the most popular implementation, has loudly split from the IETF OpenPGP spec over essentially a hissy fit on the part of the GnuPG maintainer - GnuPG and similar tools have a considerable number of vulns (cf. [gpg.fail](https://gpg.fail/) from a CCC or two ago) - Cosign/Sigstore has strong support among container registries (Docker Hub, Harbor, etc.) and the ecosystem at large, and there is no such support for GPG/OpenPGP (see e.g. [Docker's explicit instruction to use Cosign](https://docs.docker.com/dhi/explore/security-concepts/signatures/#sign-images)), particularly in consumer-side tooling. - Cosign also natively includes SBOM support, including [w/i containers](https://docs.sigstore.dev/cosign/signing/other_types/#sboms-software-bill-of-materials) - Cosign supports in-toto [attestations](https://docs.sigstore.dev/cosign/verifying/attestation/), while GPG/OpenPGP has no distinct analogue - While it's less applicable here on a self-hosted forge, the notion & usage of a public transparency log is a distinct feature of Cosign/Sigstore, and there's no such thing (at scale) for GPG/OpenPGP - IMO, relying directly on a mutable number & composition of human maintainers, and their PGP keys thereof, to establish trust in an artifact is, by and large, outmoded except for very specific use cases that are out of scope here
Member

that all sounds reasonable to me, you clearly know more about this than i do so I'll just leave y'all to it :3

that all sounds reasonable to me, you clearly know more about this than i do so I'll just leave y'all to it :3
Member

@macthecadillac wrote in #2434 (comment):

My solution is a bit of a makeshift one -- it works, but it creates a bit of noise in the container registry. Since I'm the only one using my repository, it really doesn't matter. I believe Red Hat does it a slightly different way to keep their container registry clean.

Red Hat, you'll find, does a weird hodgepodge of GPG and Sigstore that I haven't seen from any other vendor or player in this space.

@macthecadillac wrote in https://forgejo.ellis.link/continuwuation/continuwuity/issues/2434#issuecomment-39689: > My solution is a bit of a makeshift one -- it works, but it creates a bit of noise in the container registry. Since I'm the only one using my repository, it really doesn't matter. I believe Red Hat does it a slightly different way to keep their container registry clean. Red Hat, you'll find, [does a weird hodgepodge of GPG and Sigstore](https://access.redhat.com/articles/3116561) that I haven't seen from any other vendor or player in this space.
Sign in to join this conversation.
No milestone
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
continuwuation/continuwuity#2434
No description provided.