-
Notifications
You must be signed in to change notification settings - Fork 71
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
Sign container images #501
Conversation
We need to pass the signer an external identity token, if not the cli will ask the user to follow the OIDC flow from the browser:
This PR enables that: kubernetes-sigs/release-sdk#42 |
Do you plan to use Github as an identity provider ? |
Hey @ameukam sorry, I missed your message last week. No, since we will run everything in GCP the identity will come from GCP service accounts. The idea is that the service account that runs the promoter will impersonate a service account that will eventually do the signing. I'm thinking that we should have two accounts: One for the actual signing of the artifacts and one that we can impersonate while we run the tests. I still have to decipher which service accounts are working in the promoter and then we need to set permissions and roles for all of them. |
e588d4d
to
df609be
Compare
Before comparing pre and after snapshots, remove the signature layers to ensure images match. Signed-off-by: Adolfo García Veytia (Puerco) <adolfo.garcia@uservers.net>
In order to ensure the same blobs in all images, we now sign one image of a set of mirrors and replicate the signature to the rest. This avoids signing multiple times, ensure one operation in the transparency log and identical blobs (and therefore digests) whe signing promoted images. Signed-off-by: Adolfo García Veytia (Puerco) <adolfo.garcia@uservers.net>
/test pull-cip-e2e |
This commit modifies the signature copy to crane and ensures we have the SA token ready if we need to pass it to crane. Signed-off-by: Adolfo García Veytia (Puerco) <adolfo.garcia@uservers.net>
/test pull-cip-verify |
Add OCIManifestSchema1 from GGCR to supported media types to ensure we copy existing images. Signed-off-by: Adolfo García Veytia (Puerco) <adolfo.garcia@uservers.net>
I tracked a problem where the staging images were getting wiped out when adding the k8s-org signatures to a problem in cosign. Fixed it here: sigstore/cosign#1616. Before that PR merges and we pull the commit into our deps, the promoter will copy the signatures from staging but will delete them when re-signing. |
At some point, attaching signatures will be performed via OCI reference types or other mechanism. Therefore, we will not be "promoting" the sig/sbom layers, ie copying them by listing them in the manifest. The promoter will verify any signed images, if sigs are found and valid, the signatures will be copied to the newly promoted images before signing them with the K8s-wide signature. Signed-off-by: Adolfo García Veytia (Puerco) <adolfo.garcia@uservers.net>
Signed-off-by: Adolfo García Veytia (Puerco) <adolfo.garcia@uservers.net>
This commit creates a new option `--signer-account` which defines the service account that the promoter will use to sign promoted images. Signed-off-by: Adolfo García Veytia <adolfo.garcia@uservers.net>
This commit adds a new `--sign` flag to `kpromo cip` that allows to enable disable signing of container images. Signed-off-by: Adolfo García Veytia <adolfo.garcia@uservers.net>
Signed-off-by: Adolfo García Veytia <adolfo.garcia@uservers.net>
/hold cancel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! I'll not block in my two findings.
) | ||
srcRef, err := name.ParseReference(sourceRefStr) | ||
if err != nil { | ||
return fmt.Errorf("parsing reference %q: %w", sourceRefStr, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non-blocking nit: either use consistently errors.Wrap
or wrapping with %w
.
gopts.WithCredentialsFile(opts.SignerInitCredentials), | ||
} | ||
} | ||
ctx := context.Background() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non-blocking nit: consider using a context with timeout here.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: puerco, saschagrunert The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind feature
What this PR does / why we need it:
This PR introduces digital signing into the promoter. The signing flow is enabled by default and will use the default kubernetes service account (krel-trust@k8s-artifacts-prod.iam.gserviceaccount.com).
Signing is controlled by two new flags in
kpromo cip
:Image signing involves four steps which begin after promotion. After promoting, kpromo will look for signatures attached to images in the original registry and copy them to the destination registries. It will generate tokens for the signer account to invoke the keyless signing flow. Once the tokens are available, it will sign one of the images and copy the resulting combined signature to the rest of the mirrors (if any).
Which issue(s) this PR fixes:
Part of: kubernetes/release#2383
Special notes for your reviewer:
/assign @justaugustus
Stephen I think this is ready, please take a look when you can!
Does this PR introduce a user-facing change?