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

Verify default bundles downloaded from mirror.openshift.com #3605

Merged
merged 3 commits into from
May 5, 2023

Conversation

anjannath
Copy link
Member

Fixes #3493

@anjannath anjannath force-pushed the issue_3493 branch 2 times, most recently from a156222 to a0ffa1c Compare April 20, 2023 05:15
Copy link
Contributor

@cfergeau cfergeau left a comment

Choose a reason for hiding this comment

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

A few comments, but looks good. Nice to be able to remove all these hashes we have to update for every releases!!

return "", fmt.Errorf("Invalid signature: %w", err)
}
logging.Debugf("Got valid signature from key id: %s", id.PrimaryKey.KeyIdString())
return trimEachLine(string(clearTextMsg)), nil
Copy link
Contributor

Choose a reason for hiding this comment

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

return canonicalizedMsgText, nil maybe?

Copy link
Member Author

Choose a reason for hiding this comment

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

canonicalizedMsgText will have \r\n line endings
it feels a bit easier to deal with lines ending in \n especially in the unit test

pkg/crc/constants/keys.go Outdated Show resolved Hide resolved
pkg/crc/machine/bundle/metadata.go Show resolved Hide resolved
pkg/crc/machine/bundle/metadata.go Show resolved Hide resolved
it adds GetVerifiedClearsignedMsgV3() which returns clear text  msg
and no error if the signature is valid for the supplied pubkey

this uses the golang.org/x/crypto/openpgp library as the maintained
fork of it that is previously used doesn't support the old v3 signs
the other fork of x/crypto at github.com/keybase/go-crypto has less
active contributions
this adds getVerifiedDefaultBundleHash() which downloads the signed
sha256sum.txt file from mirror.openshift.com and verifies that it's
signed with the redhat release key2, then from the verified  hashes
it returns the hash for the default bundle
this removes the hardcoded hashes for each bundle and instead
directly gets the bundle hash from the sha256sum.txt.sig file
at mirror.openshift.com by using the helper from the previous
commit which returns gpg verified hash for the default bundle
@anjannath
Copy link
Member Author

/test e2e-crc

@openshift-ci openshift-ci bot added the lgtm label May 5, 2023
@praveenkumar praveenkumar merged commit 73a6cbc into crc-org:main May 5, 2023
@openshift-ci
Copy link

openshift-ci bot commented May 5, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: praveenkumar

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved label May 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

verify signature of bundles downloaded from mirror.openshift.com
4 participants