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

feat(ci): add cosign keyless verification via github OIDC #907

Conversation

bayou-brogrammer
Copy link
Contributor

This PR adds the keyless verification from cosign docs.

cosign keyless requires two inputs:

  • certificate-oidc-issuer
  • certificate-identity-regexp

For github, our template follows:

  • certificate-oidc-issuer => https://token.actions.githubusercontent.com
  • certificate-identity-regexp => https://github.com/${{ github.repository }}

@bayou-brogrammer bayou-brogrammer force-pushed the feat(ci)-keyless-verification branch from 396199d to ba10576 Compare February 14, 2024 16:47
.github/workflows/build.yml Outdated Show resolved Hide resolved
@castrojo castrojo enabled auto-merge February 16, 2024 03:02
- uses: sigstore/[email protected]
if: github.event_name != 'pull_request'

- name: Sign container image
- name: Sign the images
Copy link
Member

@p5 p5 Feb 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without the public and private keys, how will we set the OS configuration to allow images from this org?

Copy link
Member

@p5 p5 Feb 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now, we have configured the ublue certs as trusted in all images, but now we're not signing images using those certs, how will it work?

(I'm talking about this configuration - https://github.com/ublue-os/config/blob/main/files/usr/etc/containers/policy.json#L23-L31)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So i might be a bit out the loop on the entire process, but I thought we could now use our github to validate via cosign

cosign verify --certificate-oidc-issuer "https://token.actions.githubusercontent.com" --certificate-identity-regexp https://github.com/ublue-os/bluefin <TAG>

which will allow for the image to be verified against our OIDC signature

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

recently got my bluebuild image to sign with OIDC and the problem stems from that now the image is no longer signed with the same key, yet the policy.json still expects it to, so updating fails:

user@localhost ~ [1]> rpm-ostree update
Pulling manifest: ostree-image-signed:docker://ghcr.io/gerblesh/uhypr:latest
error: Creating importer: Failed to invoke skopeo proxy method OpenImage: remote error: cryptographic signature verification failed: invalid signature when validating ASN.1 encoded signature

we could try creating special tags and systemd units for rebasing/fixing the policy.json but I don't know what's the best way forward for this, and it would probably be ideal to keep workarounds like the ones I just mentioned to a minimum

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mentioned this in Discord, but appropriate to ask here...

What benefit(s) does signing with OIDC provide bluefin (or any ublue-os image)?

Unless I'm missing something, to trust the OIDC signed image, the policy,json still needs to provide some information to know how to validate the signatures... so one still can't do a direct rebase from upstream Silverblue to ostree-image-signed:docker://ghcr.io/example-org/oidc-signed-image:latest .

And it seems your example here where skopeo fails demonstrates this problem.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removing the configuration for the individual image allows a rebase. Signing with OIDC keyless means the signature changes every time and is verfied using github's provider. The default policy.json will work on rebase if you don't override the signature verification with pubkey auth

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cosign's docs for keyless signing are here: https://docs.sigstore.dev/signing/overview/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/containers/image/blob/main/docs/containers-policy.json.5.md#sigstoresigned explains how to specify OIDC verification in policy.json. There's also an option for subjectEmail, which will ensure the image is signed by the right account and not a random GitHub account.

@p5 p5 marked this pull request as draft April 7, 2024 21:56
auto-merge was automatically disabled April 7, 2024 21:56

Pull request was converted to draft

@p5
Copy link
Member

p5 commented Apr 7, 2024

Converted to draft to avoid accidental approval/merge before we have figured out how it will work.
I do not believe our current setup is broken, so there's no rush to switch over to OIDC at this moment.

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.

5 participants