-
Notifications
You must be signed in to change notification settings - Fork 242
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
verify signature of bundles downloaded from mirror.openshift.com #3493
Comments
The bundles released in https://developers.redhat.com/content-gateway/rest/mirror2/pub/openshift-v4/clients/crc/bundles/openshift/4.12.0/ will be GPG-signed in the future, similarly to what is done for https://developers.redhat.com/content-gateway/rest/mirror2/pub/openshift-v4/clients/crc/2.13.1/ (signed sha256sum.txt). |
there are two signature files in the mirror for sha256sum.txt:
So we have to first download either of these files and match the sha256sum of the downloaded bundle to the one from the signed sha256sum.txt.gpg or sha256sum.txt.sig file when i use the
|
Yeah, the check is a bit annoying, I don't know why there is this indirection instead of directly signing each file :) crc already has some gpg signature checking code when downloading bundles from quay. |
Ah and you are correct, these are not detached gpg signatures for the sha256sum.txt file, but sha256sum.txt content followed by a signature. |
yeah, and the library we are using currently for checking signature on the bundles from quay doesn't have helpers for verifying non-detached signatures, https://pkg.go.dev/github.com/ProtonMail/go-crypto@v0.0.0-20230131201316-b9d3a0f1b21b/openpgp |
I tried to use the Since the signtaure is clearsign i tried to use the https://pkg.go.dev/github.com/ProtonMail/go-crypto@v0.0.0-20230214155104-81033d7f4442/openpgp/clearsign#Block.VerifySignature but this is not working for the signed files on mirror i did some testing with keys generated locally and its working for that (https://github.com/anjannath/go-crypto-openpgp-test/blob/1f1c3a83c4c9dad4f1909aab80e7b22dbc741eda/verify.go#L13), now am not sure why its not working on the files from mirror i've also asked for detached sign of the individual bundles. |
|
one possible workaround is to perform the signing ourselves with keys we control (which'd produce a v4 signature) we can perform the signing as part of the bundle generation process longer term if the bundles are published on quay this'll not be needed as we can already verify bundles pulled from quay. |
Maybe it's just me, but I consider a crc signature to be weaker/not as good as a RH signature, ideally we'd have everything signed and verifiable with the RH key. |
yeah, agreed not as good as a RH signature, i haven't given up on that yet, tried to use the golang.org/x/crypto/openpgp which has V3 signature support still (its not maintained but gets security updates.. ) now with that library hitting another issue, small reproducer: https://go.dev/play/p/6p9h0Z0BSIm?v=1.19 |
the issue was that the signed msg was not in expected format, the library doesn't transform the decoded signed msg to the needed format.
and the gopenpgp lib has two helpers that does the transformation, once those transformations are applied to the signed msg, |
Currently we manually update the bundle hashes, which is error prone. two things needs to happen when bundle version is updated:
OPENSHIFT_VERSION
in theMakefile
needs to be updated and the hashes in the following file needs to be updated.crc/pkg/crc/machine/bundle/constants.go
Lines 8 to 30 in 8c4fdb5
this was suggested in: #3486 (review)
The text was updated successfully, but these errors were encountered: