Repository navigation
Verify a GPG signature on the release image digest from a root of trust within the payload - #170
Conversation
69d04cc to
780e451
Compare
|
/test e2e-aws |
cf9f6de to
ad61a26
Compare
7227456 to
83c0ffb
Compare
|
Simplified down to fix two problems:
Added another cvo_scenario test that showed different logic. |
|
/retest |
|
/retest |
|
Are we ok with API changes? If so #293 needs to be merged before this and I need to bump the API. |
All operators should use the message policy fallback to grab a final error message, if necessary.
Only bring '-v' in because that one we care about.
Use the existing Atomic image signing protocol to read detached signatures for images by digest from a remote location so that release images can be verified before they are executed. Add a Verifier interface to the CVO that abstracts checking for verified updates. On start, check the payload for a config map with the annotation release.openshift.io/verification-config-map set (value is ignored) and load the set of all public keys that must be verified along with the http or file store locations for detached signatures. Every key must be verified to accept the payload. A subsequent commit will leverage the Verifier to block downloading a new release image.
The verifier is loaded at startup and passed to the payload retriever, which then delegates to the verifier and returns an error if the digest is not authentic. If no verifier is configured, the default verifier is to reject the payload as inauthentic. Move the initialization of the sync worker to after the verifier is loaded so that we can pass the verifier into the payload retriever, which makes the New() method slightly smaller and separates out payload related actions from controller related actions.
For safety, all unverified images are considered untrusted and the CVO should not apply them. An admin may override this safe default with force (which would be mapped to oc adm upgrade --force). When this happens, we should communicate clearly which updates were verified and which were not. The CVO, unless configured otherwise, assumes everything is unverified. The payload retriever uses the verifier to check the incoming image - both tags or failed verification is reported to the user. If the admin then sets allowUnverifiedImages, the sync loop continues. Periodically in the background recheck any reconciling payload that is unverified against the verifier, just in case it was a temporary state.
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: abhinavdahiya, smarterclayton The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest |
|
@smarterclayton: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
|
Known flake, force merging. |
Adding a client-side guard like the server-side guard [1] from openshift/cluster-version-operator@55e3cb450f (verifier: Add public key verification of release image digests, 2019-04-19, openshift/cluster-version-operator#170). This isn't that big a deal, because the client-side guard exists, but it does save users the effort of pushing a by-tag pullspec into ClusterVersion and then having to circle back around to notice that the cluster-version operator is complaining about the verification failure. The warning on --force is because Clayton considers blocking this flow completely to be a breaking API change, and also considers that failing those folks early is more invasive than letting them continue to slip through here and have some subset of them potentially blow up later if: 1. You ask to update to a by-tag pullspec. 2. Cluster updates. 3. Someone clobbers the tag you used in the registry to point it at a different release. 3. Cluster continues on, blissfully unaware. 4. CVO gets rescheduled for whatever reason. 5. Cluster pulls a fresh registry image for the new pod, but it's by-tag, so you get the new content. 6. CVO thinks it's still in reconciling mode, because the pullspec hasn't changed. 7. World explodes as the new manifests get applied in a parallel, randomized order. Or maybe the new CVO defaults to starting in install mode or some such. But still, random release rollouts trigged by CVO pod restarts are more exitement than I'd wish on anyone, even folks who use --force. It would also be acceptable to have oc attempt to resolve the by-tag pullspec into a by-digest pullspec, but there's no guarantee that the host running 'oc' has access to the same registry that the in-cluster CRI-O will be pulling from, so getting consistent client-side resolution would be tricky. [1]: https://github.com/openshift/cluster-version-operator/blame/89cb270523675e27a2f54918431170946636f5d5/pkg/verify/verify.go#L203-L204
Adding a client-side guard like the server-side guard [1] from openshift/cluster-version-operator@55e3cb450f (verifier: Add public key verification of release image digests, 2019-04-19, openshift/cluster-version-operator#170). This isn't that big a deal, because the client-side guard exists, but it does save users the effort of pushing a by-tag pullspec into ClusterVersion and then having to circle back around to notice that the cluster-version operator is complaining about the verification failure. The warning on --force (instead of a hard failure) is because Clayton considers blocking this flow completely to be a breaking API change, and also considers that failing those folks early is more invasive than letting them continue to slip through here and have some subset of them potentially blow up later if: 1. You ask to update to a by-tag pullspec. 2. Cluster updates. 3. Someone clobbers the tag you used in the registry to point it at a different release. 4. Cluster continues on, blissfully unaware. 5. CVO gets rescheduled for whatever reason. 6. Cluster pulls a fresh registry image for the new pod, but it's by-tag, so you get the new content. 7. CVO thinks it's still in reconciling mode, because the pullspec hasn't changed. 8. World explodes as the new manifests get applied in a parallel, randomized order. Or maybe the new CVO defaults to starting in install mode or some such. But still, random release rollouts trigged by CVO pod restarts are more exitement than I'd wish on anyone, even folks who use --force. It would also be acceptable to have oc attempt to resolve the by-tag pullspec into a by-digest pullspec, but there's no guarantee that the host running 'oc' has access to the same registry that the in-cluster CRI-O will be pulling from, so getting consistent client-side resolution would be tricky. [1]: https://github.com/openshift/cluster-version-operator/blame/89cb270523675e27a2f54918431170946636f5d5/pkg/verify/verify.go#L203-L204
Adding a client-side guard like the server-side guard [1] from openshift/cluster-version-operator@55e3cb450f (verifier: Add public key verification of release image digests, 2019-04-19, openshift/cluster-version-operator#170). This isn't that big a deal, because the client-side guard exists, but it does save users the effort of pushing a by-tag pullspec into ClusterVersion and then having to circle back around to notice that the cluster-version operator is complaining about the verification failure. The warning on --force (instead of a hard failure) is because Clayton considers blocking this flow completely to be a breaking API change, and also considers that failing those folks early is more invasive than letting them continue to slip through here and have some subset of them potentially blow up later if: 1. You ask to update to a by-tag pullspec. 2. Cluster updates. 3. Someone clobbers the tag you used in the registry to point it at a different release. 4. Cluster continues on, blissfully unaware. 5. CVO gets rescheduled for whatever reason. 6. Cluster pulls a fresh registry image for the new pod, but it's by-tag, so you get the new content. 7. CVO thinks it's still in reconciling mode, because the pullspec hasn't changed. 8. World explodes as the new manifests get applied in a parallel, randomized order. Or maybe the new CVO defaults to starting in install mode or some such. But still, random release rollouts trigged by CVO pod restarts are more exitement than I'd wish on anyone, even folks who use --force. It would also be acceptable to have oc attempt to resolve the by-tag pullspec into a by-digest pullspec, but there's no guarantee that the host running 'oc' has access to the same registry that the in-cluster CRI-O will be pulling from, so getting consistent client-side resolution would be tricky. [1]: https://github.com/openshift/cluster-version-operator/blame/89cb270523675e27a2f54918431170946636f5d5/pkg/verify/verify.go#L203-L204
Commit f8eff25 (PR openshift#170) missed to update the doc string Signed-off-by: Lalatendu Mohanty <[email protected]>
These docs have not been adjusted since the properties landed in ab4ff93 (Update ClusterVersion to have a 'force' update flag and track verified, 2019-04-22, openshift#293). The initial cluster-version operator implementation only used them for signature checks, openshift/cluster-version-operator@f8eff25191 (sync: Report whether updates are verified and allow admin override, 2019-04-20, openshift/cluster-version-operator#170). At that time, RetrievePayload would always attempt to verify the proposed release image, including both signature validation and "does this look like a real release image?" checks. If that verification succeeded, it would set 'verified: true'. If that verification failed, it would look at 'force', and if 'force' was true, it would set 'verified: false' and proceed with the update, while if 'force' was false, it would reject the update. Despite the API docs, availableUpdates never came into this in the CVO code. The only availableUpdates guards are client-side in 'oc', and the API docs are discussion the ClusterVersion API, not 'oc adm upgrade's --force API. In openshift/oc@0501d04ff1 (upgrade: Separate flags for safety instead of abusing force, 2019-09-27, openshift/oc#109), oc's client-side guards split --allow-explicit-upgrade (for updating to something not in availableUpdates) and --allow-upgrade-with-warnings (for updating despite client-side guards against Progressing and Degraded ClusterVersion conditions) away from --force, but again, never part of the ClusterVersion force property's CVO-side handling. Since then, the CVO grew precondition handlers in openshift/cluster-version-operator@aceb5bc66f (pkg: add precondition handlers and perform these checks before accepting Update, 2019-08-26, openshift/cluster-version-operator#243). syncOnce ran all the precondition checks, which at that point was just the Upgradeable ClusterOperator and ClusterVersion condition check. If that check failed, but 'force' was true, it would proceed with the update, while if 'force' was false, it would reject the update. In neither case would 'verified' be altered, it continued to only track the signature and "does this look like a real release image?" checks. The idea at the time was that these would fall under the "normal protections" phrasing (overriden by force) and not the "other forms of consistency checking" phrasing (whatever those were supposed to be).
These docs have not been adjusted since the properties landed in ab4ff93 (Update ClusterVersion to have a 'force' update flag and track verified, 2019-04-22, openshift#293). The initial cluster-version operator implementation only used them for signature checks, openshift/cluster-version-operator@f8eff25191 (sync: Report whether updates are verified and allow admin override, 2019-04-20, openshift/cluster-version-operator#170). At that time, RetrievePayload would always attempt to verify the proposed release image, including both signature validation and "does this look like a real release image?" checks. If that verification succeeded, it would set 'verified: true'. If that verification failed, it would look at 'force', and if 'force' was true, it would set 'verified: false' and proceed with the update, while if 'force' was false, it would reject the update. Despite the API docs, availableUpdates never came into this in the CVO code. The only availableUpdates guards are client-side in 'oc', and the API docs are discussion the ClusterVersion API, not 'oc adm upgrade's --force API. In openshift/oc@0501d04ff1 (upgrade: Separate flags for safety instead of abusing force, 2019-09-27, openshift/oc#109), oc's client-side guards split --allow-explicit-upgrade (for updating to something not in availableUpdates) and --allow-upgrade-with-warnings (for updating despite client-side guards against Progressing and Degraded ClusterVersion conditions) away from --force, but again, never part of the ClusterVersion force property's CVO-side handling. Since then, the CVO grew precondition handlers in openshift/cluster-version-operator@aceb5bc66f (pkg: add precondition handlers and perform these checks before accepting Update, 2019-08-26, openshift/cluster-version-operator#243). syncOnce ran all the precondition checks, which at that point was just the Upgradeable ClusterOperator and ClusterVersion condition check. If that check failed, but 'force' was true, it would proceed with the update, while if 'force' was false, it would reject the update. In neither case would 'verified' be altered; it continued to only track the signature and "does this look like a real release image?" checks. The idea at the time was that these would fall under the "normal protections" phrasing (overriden by force) and not the "other forms of consistency checking" phrasing (whatever those were supposed to be).
These docs have not been adjusted since the properties landed in ab4ff93 (Update ClusterVersion to have a 'force' update flag and track verified, 2019-04-22, openshift#293). The initial cluster-version operator implementation only used them for signature checks, openshift/cluster-version-operator@f8eff25191 (sync: Report whether updates are verified and allow admin override, 2019-04-20, openshift/cluster-version-operator#170). At that time, RetrievePayload would always attempt to verify the proposed release image, including both signature validation and "does this look like a real release image?" checks. If that verification succeeded, it would set 'verified: true'. If that verification failed, it would look at 'force', and if 'force' was true, it would set 'verified: false' and proceed with the update, while if 'force' was false, it would reject the update. Despite the API docs, availableUpdates never came into this in the CVO code. The only availableUpdates guards are client-side in 'oc', and the API docs are discussion the ClusterVersion API, not 'oc adm upgrade's --force API. In openshift/oc@0501d04ff1 (upgrade: Separate flags for safety instead of abusing force, 2019-09-27, openshift/oc#109), oc's client-side guards split --allow-explicit-upgrade (for updating to something not in availableUpdates) and --allow-upgrade-with-warnings (for updating despite client-side guards against Progressing and Degraded ClusterVersion conditions) away from --force, but again, never part of the ClusterVersion force property's CVO-side handling. Since then, the CVO grew precondition handlers in openshift/cluster-version-operator@aceb5bc66f (pkg: add precondition handlers and perform these checks before accepting Update, 2019-08-26, openshift/cluster-version-operator#243). syncOnce ran all the precondition checks, which at that point was just the Upgradeable ClusterOperator and ClusterVersion condition check. If that check failed, but 'force' was true, it would proceed with the update, while if 'force' was false, it would reject the update. In neither case would 'verified' be altered; it continued to only track the signature and "does this look like a real release image?" checks. The idea at the time was that these would fall under the "normal protections" phrasing (overriden by force) and not the "other forms of consistency checking" phrasing (whatever those were supposed to be).
These docs have not been adjusted since the properties landed in ab4ff93 (Update ClusterVersion to have a 'force' update flag and track verified, 2019-04-22, openshift#293). The initial cluster-version operator implementation only used them for signature checks, openshift/cluster-version-operator@f8eff25191 (sync: Report whether updates are verified and allow admin override, 2019-04-20, openshift/cluster-version-operator#170). At that time, RetrievePayload would always attempt to verify the proposed release image, including both signature validation and "does this look like a real release image?" checks. If that verification succeeded, it would set 'verified: true'. If that verification failed, it would look at 'force', and if 'force' was true, it would set 'verified: false' and proceed with the update, while if 'force' was false, it would reject the update. Despite the API docs, availableUpdates never came into this in the CVO code. The only availableUpdates guards are client-side in 'oc', and the API docs are discussion the ClusterVersion API, not 'oc adm upgrade's --force API. In openshift/oc@0501d04ff1 (upgrade: Separate flags for safety instead of abusing force, 2019-09-27, openshift/oc#109), oc's client-side guards split --allow-explicit-upgrade (for updating to something not in availableUpdates) and --allow-upgrade-with-warnings (for updating despite client-side guards against Progressing and Degraded ClusterVersion conditions) away from --force, but again, never part of the ClusterVersion force property's CVO-side handling. Since then, the CVO grew precondition handlers in openshift/cluster-version-operator@aceb5bc66f (pkg: add precondition handlers and perform these checks before accepting Update, 2019-08-26, openshift/cluster-version-operator#243). syncOnce ran all the precondition checks, which at that point was just the Upgradeable ClusterOperator and ClusterVersion condition check. If that check failed, but 'force' was true, it would proceed with the update, while if 'force' was false, it would reject the update. In neither case would 'verified' be altered; it continued to only track the signature and "does this look like a real release image?" checks. The idea at the time was that these would fall under the "normal protections" phrasing (overriden by force) and not the "other forms of consistency checking" phrasing (whatever those were supposed to be).
These docs have not been adjusted since the properties landed in ab4ff93 (Update ClusterVersion to have a 'force' update flag and track verified, 2019-04-22, openshift#293). The initial cluster-version operator implementation only used them for signature checks, openshift/cluster-version-operator@f8eff25191 (sync: Report whether updates are verified and allow admin override, 2019-04-20, openshift/cluster-version-operator#170). At that time, RetrievePayload would always attempt to verify the proposed release image, including both signature validation and "does this look like a real release image?" checks. If that verification succeeded, it would set 'verified: true'. If that verification failed, it would look at 'force', and if 'force' was true, it would set 'verified: false' and proceed with the update, while if 'force' was false, it would reject the update. Despite the API docs, availableUpdates never came into this in the CVO code. The only availableUpdates guards are client-side in 'oc', and the API docs are discussion the ClusterVersion API, not 'oc adm upgrade's --force API. In openshift/oc@0501d04ff1 (upgrade: Separate flags for safety instead of abusing force, 2019-09-27, openshift/oc#109), oc's client-side guards split --allow-explicit-upgrade (for updating to something not in availableUpdates) and --allow-upgrade-with-warnings (for updating despite client-side guards against Progressing and Degraded ClusterVersion conditions) away from --force, but again, never part of the ClusterVersion force property's CVO-side handling. Since then, the CVO grew precondition handlers in openshift/cluster-version-operator@aceb5bc66f (pkg: add precondition handlers and perform these checks before accepting Update, 2019-08-26, openshift/cluster-version-operator#243). syncOnce ran all the precondition checks, which at that point was just the Upgradeable ClusterOperator and ClusterVersion condition check. If that check failed, but 'force' was true, it would proceed with the update, while if 'force' was false, it would reject the update. In neither case would 'verified' be altered; it continued to only track the signature and "does this look like a real release image?" checks. The idea at the time was that these would fall under the "normal protections" phrasing (overriden by force) and not the "other forms of consistency checking" phrasing (whatever those were supposed to be).
The 2007 RFC 4880 encouraged consumer support [1]:
Implementations SHOULD accept V3 signatures. Implementations SHOULD
generate V4 signatures.
The 2024 RFC 9580 tightens down against creating new v3 signatures,
and leaves it more open-ended about whether consuming v3 signatures is
a good idea [2]:
Implementations MUST NOT create version 3 signatures; they MAY
accept version 3 signatures.
Within OpenShift, the transition from v3 signatures to v4 signatures
happened somewhere during 2023:
$ for Y in $(seq 3 22); do oc image info -o json "quay.io/openshift-release-dev/ocp-release:4.${Y}.0-x86_64" | jq -r '.config.created + " " + .digest' | while read CREATED DIGEST; do echo -n "4.${Y}.0 ${CREATED} ${DIGEST} "; curl -s "https://mirror.openshift.com/pub/openshift-v4/signatures/openshift/release/${DIGEST/:/=}/signature-1" | gpg --list-packets | grep -A1 'signature packet'; done; done
4.3.0 2020-01-22T02:05:15Z sha256:3a516480dfd68e0f87f702b4d7bdd6f6a0acfdac5cd2e9767b838ceede34d70d :signature packet: algo 1, keyid 199E2F91FD431D51
version 3, created 1579666968, md5len 5, sigclass 0x00
4.4.0 2020-04-29T13:48:30Z sha256:96cb606d04e94de1954a50ddb965eb02b76e182478bef9225df0ad523cfa6b38 :signature packet: algo 1, keyid 199E2F91FD431D51
version 3, created 1588175151, md5len 5, sigclass 0x00
...
4.13.0 2023-05-16T10:09:04Z sha256:74b23ed4bbb593195a721373ed6693687a9b444c97065ce8ac653ba464375711 :signature packet: algo 1, keyid 199E2F91FD431D51
version 3, created 1684251879, md5len 5, sigclass 0x00
4.14.0 2023-10-26T14:31:15Z sha256:e2c70fca183e380c6121a1c847806f11e839482123277235a8579db472b9ccf2 :signature packet: algo 1, keyid 199E2F91FD431D51
version 4, created 1698363623, md5len 0, sigclass 0x00
...
4.22.0 2026-06-04T22:31:25Z sha256:283887f2860a745387608d106e70e5be2314df2497ee08c69e7bc669ca091340 :signature packet: algo 1, keyid 199E2F91FD431D51
version 4, created 1780635619, md5len 0, sigclass 0x00
So we can safely drop the v3 support here, without breaking anything
trying to parse remotely-modern release signatures.
I'm also dropping the v3 registry.access.redhat.com/rhel7:7.6
signature we'd been using since the initial package commit c43c2cb
(Create a resuable verify package for image release verification,
2020-07-16, openshift#837), descended in turn from
openshift/cluster-version-operator@55e3cb450f (verifier: Add public
key verification of release image digests, 2019-04-20,
openshift/cluster-version-operator#170):
$ gpg --list-packets < 'pkg/verify/testdata/signatures/sha256=e3f12513a4b22a2d7c0e7c9207f52128113758d9d68c7d06b11a0ac7672966f7/signature-1'
# off=0 ctb=a3 tag=8 hlen=1 plen=0 indeterminate
:compressed packet: algo=1
# off=2 ctb=90 tag=4 hlen=2 plen=13
:onepass_sig packet: keyid 199E2F91FD431D51
version 3, sigclass 0x00, digest 8, pubkey 1, last=1
# off=17 ctb=ad tag=11 hlen=3 plen=324
:literal data packet:
mode b (62), created 1554833664, name="_rpmsig-req-KOr4fw.bin",
raw data: 296 bytes
# off=344 ctb=89 tag=2 hlen=3 plen=533
:signature packet: algo 1, keyid 199E2F91FD431D51
version 3, created 1554833664, md5len 5, sigclass 0x00
digest algo 8, begin of digest 34 f2
data: [4095 bits]
$ gpg --decrypt <pkg/verify/testdata/signatures/sha256\=e3f12513a4b22a2d7c0e7c9207f52128113758d9d68c7d06b11a0ac7672966f7/signature-1 | jq .
gpg: Signature made Tue 09 Apr 2019 11:14:24 AM PDT
gpg: using RSA key 199E2F91FD431D51
gpg: Good signature from "Red Hat, Inc. (release key 2) <[email protected]>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: 567E 347A D004 4ADE 55BA 8A5F 199E 2F91 FD43 1D51
{
"critical": {
"image": {
"docker-manifest-digest": "sha256:e3f12513a4b22a2d7c0e7c9207f52128113758d9d68c7d06b11a0ac7672966f7"
},
"type": "atomic container signature",
"identity": {
"docker-reference": "registry.access.redhat.com/rhel7:7.6"
}
},
"optional": {
"creator": "Red Hat RCM Pub 0.35.0-final "
}
}
Instead, I'm using the OpenPGP v4 signature formatted 4.14.0
signature:
$ curl -s 'https://mirror.openshift.com/pub/openshift-v4/signatures/openshift/release/sha256=e2c70fca183e380c6121a1c847806f11e839482123277235a8579db472b9ccf2/signature-1' > 'pkg/verify/testdata/signatures/sha256=e2c70fca183e380c6121a1c847806f11e839482123277235a8579db472b9ccf2/signature-1'
I'm also dropping (this time without replacement) the old
release-controller signature we'd also been dragging around since
Clayton's 2019 commit:
$ gpg --list-packets pkg/verify/testdata/signatures/sha256=edd9824f0404f1a139688017e7001370e2f3fbc088b94da84506653b473fe140/signature-1
# off=0 ctb=c4 tag=4 hlen=2 plen=13 new-ctb
:onepass_sig packet: keyid 28B76E05B923888E
version 3, sigclass 0x00, digest 8, pubkey 1, last=1
# off=15 ctb=cb tag=11 hlen=2 plen=0 partial new-ctb
:literal data packet:
mode t (74), created 0, name="",
raw data: unknown length
$ gpg --decrypt pkg/verify/testdata/signatures/sha256=edd9824f0404f1a139688017e7001370e2f3fbc088b94da84506653b473fe140/signature-1
{
"critical": {
"type": "atomic container signature",
"image": {
"docker-manifest-digest": "sha256:edd9824f0404f1a139688017e7001370e2f3fbc088b94da84506653b473fe140"
},
"identity": {
"docker-reference": "registry.svc.ci.openshift.org/ocp/release:4.0.0-0.ci-2019-04-19-181452"
}
},
"optional": {
"creator": "openshift release-controller",
"timestamp": 1555943751
}
}gpg: Signature made Mon 22 Apr 2019 07:35:51 AM PDT
gpg: using RSA key 28B76E05B923888E
gpg: Can't check signature: No public key
We can test "valid signature for sha over http with multi-key keyring"
with the same signature we use to test the single-official-key tests.
And I don't see the point of running a "valid signature for sha over
http with custom gpg key" test, when we don't have any clusters that
actually care about that particular key. I'm keeping the simple key
for now, just because putting _some_ other key into the unified
keyring is necessary for the "with multi-key keyring" tests.
[1]: https://www.rfc-editor.org/info/rfc4880/#section-5.2
[2]: https://www.rfc-editor.org/info/rfc9580/#signature-packet
The 2007 RFC 4880 encouraged consumer support [1]:
Implementations SHOULD accept V3 signatures. Implementations SHOULD
generate V4 signatures.
The 2024 RFC 9580 tightens down against creating new v3 signatures,
and leaves it more open-ended about whether consuming v3 signatures is
a good idea [2]:
Implementations MUST NOT create version 3 signatures; they MAY
accept version 3 signatures.
Within OpenShift, the transition from v3 signatures to v4 signatures
happened somewhere during 2023:
$ for Y in $(seq 3 22); do oc image info -o json "quay.io/openshift-release-dev/ocp-release:4.${Y}.0-x86_64" | jq -r '.config.created + " " + .digest' | while read CREATED DIGEST; do echo -n "4.${Y}.0 ${CREATED} ${DIGEST} "; curl -s "https://mirror.openshift.com/pub/openshift-v4/signatures/openshift/release/${DIGEST/:/=}/signature-1" | gpg --list-packets | grep -A1 'signature packet'; done; done
4.3.0 2020-01-22T02:05:15Z sha256:3a516480dfd68e0f87f702b4d7bdd6f6a0acfdac5cd2e9767b838ceede34d70d :signature packet: algo 1, keyid 199E2F91FD431D51
version 3, created 1579666968, md5len 5, sigclass 0x00
4.4.0 2020-04-29T13:48:30Z sha256:96cb606d04e94de1954a50ddb965eb02b76e182478bef9225df0ad523cfa6b38 :signature packet: algo 1, keyid 199E2F91FD431D51
version 3, created 1588175151, md5len 5, sigclass 0x00
...
4.13.0 2023-05-16T10:09:04Z sha256:74b23ed4bbb593195a721373ed6693687a9b444c97065ce8ac653ba464375711 :signature packet: algo 1, keyid 199E2F91FD431D51
version 3, created 1684251879, md5len 5, sigclass 0x00
4.14.0 2023-10-26T14:31:15Z sha256:e2c70fca183e380c6121a1c847806f11e839482123277235a8579db472b9ccf2 :signature packet: algo 1, keyid 199E2F91FD431D51
version 4, created 1698363623, md5len 0, sigclass 0x00
...
4.22.0 2026-06-04T22:31:25Z sha256:283887f2860a745387608d106e70e5be2314df2497ee08c69e7bc669ca091340 :signature packet: algo 1, keyid 199E2F91FD431D51
version 4, created 1780635619, md5len 0, sigclass 0x00
So we can safely drop the v3 support here, without breaking anything
trying to parse remotely-modern release signatures.
I'm also dropping the v3 registry.access.redhat.com/rhel7:7.6
signature we'd been using since the initial package commit c43c2cb
(Create a resuable verify package for image release verification,
2020-07-16, openshift#837), descended in turn from
openshift/cluster-version-operator@55e3cb450f (verifier: Add public
key verification of release image digests, 2019-04-20,
openshift/cluster-version-operator#170):
$ gpg --list-packets < 'pkg/verify/testdata/signatures/sha256=e3f12513a4b22a2d7c0e7c9207f52128113758d9d68c7d06b11a0ac7672966f7/signature-1'
# off=0 ctb=a3 tag=8 hlen=1 plen=0 indeterminate
:compressed packet: algo=1
# off=2 ctb=90 tag=4 hlen=2 plen=13
:onepass_sig packet: keyid 199E2F91FD431D51
version 3, sigclass 0x00, digest 8, pubkey 1, last=1
# off=17 ctb=ad tag=11 hlen=3 plen=324
:literal data packet:
mode b (62), created 1554833664, name="_rpmsig-req-KOr4fw.bin",
raw data: 296 bytes
# off=344 ctb=89 tag=2 hlen=3 plen=533
:signature packet: algo 1, keyid 199E2F91FD431D51
version 3, created 1554833664, md5len 5, sigclass 0x00
digest algo 8, begin of digest 34 f2
data: [4095 bits]
$ gpg --decrypt <pkg/verify/testdata/signatures/sha256\=e3f12513a4b22a2d7c0e7c9207f52128113758d9d68c7d06b11a0ac7672966f7/signature-1 | jq .
gpg: Signature made Tue 09 Apr 2019 11:14:24 AM PDT
gpg: using RSA key 199E2F91FD431D51
gpg: Good signature from "Red Hat, Inc. (release key 2) <[email protected]>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: 567E 347A D004 4ADE 55BA 8A5F 199E 2F91 FD43 1D51
{
"critical": {
"image": {
"docker-manifest-digest": "sha256:e3f12513a4b22a2d7c0e7c9207f52128113758d9d68c7d06b11a0ac7672966f7"
},
"type": "atomic container signature",
"identity": {
"docker-reference": "registry.access.redhat.com/rhel7:7.6"
}
},
"optional": {
"creator": "Red Hat RCM Pub 0.35.0-final "
}
}
Instead, I'm using the OpenPGP v4 signature formatted 4.14.0
signature:
$ curl -s 'https://mirror.openshift.com/pub/openshift-v4/signatures/openshift/release/sha256=e2c70fca183e380c6121a1c847806f11e839482123277235a8579db472b9ccf2/signature-1' > 'pkg/verify/testdata/signatures/sha256=e2c70fca183e380c6121a1c847806f11e839482123277235a8579db472b9ccf2/signature-1'
I'm also dropping (this time without replacement) the old
release-controller signature we'd also been dragging around since
Clayton's 2019 commit:
$ gpg --list-packets pkg/verify/testdata/signatures/sha256=edd9824f0404f1a139688017e7001370e2f3fbc088b94da84506653b473fe140/signature-1
# off=0 ctb=c4 tag=4 hlen=2 plen=13 new-ctb
:onepass_sig packet: keyid 28B76E05B923888E
version 3, sigclass 0x00, digest 8, pubkey 1, last=1
# off=15 ctb=cb tag=11 hlen=2 plen=0 partial new-ctb
:literal data packet:
mode t (74), created 0, name="",
raw data: unknown length
$ gpg --decrypt pkg/verify/testdata/signatures/sha256=edd9824f0404f1a139688017e7001370e2f3fbc088b94da84506653b473fe140/signature-1
{
"critical": {
"type": "atomic container signature",
"image": {
"docker-manifest-digest": "sha256:edd9824f0404f1a139688017e7001370e2f3fbc088b94da84506653b473fe140"
},
"identity": {
"docker-reference": "registry.svc.ci.openshift.org/ocp/release:4.0.0-0.ci-2019-04-19-181452"
}
},
"optional": {
"creator": "openshift release-controller",
"timestamp": 1555943751
}
}gpg: Signature made Mon 22 Apr 2019 07:35:51 AM PDT
gpg: using RSA key 28B76E05B923888E
gpg: Can't check signature: No public key
We can test "valid signature for sha over http with multi-key keyring"
with the same signature we use to test the single-official-key tests.
And I don't see the point of running a "valid signature for sha over
http with custom gpg key" test, when we don't have any clusters that
actually care about that particular key. I'm keeping the simple key
for now, just because putting _some_ other key into the unified
keyring is necessary for the "with multi-key keyring" tests.
[1]: https://www.rfc-editor.org/info/rfc4880/#section-5.2
[2]: https://www.rfc-editor.org/info/rfc9580/#signature-packet
Implement:
allowUnverifiedImagesIn CI, the payload would have a signing key public key mixed in to the payload (OKD, OCP CI). In OCP, we would mix in an official signing public key and the location of one or more stores to read from.
Questions identified during prototyping:
oc adm release info --verify, which it should (prevents the payload from being unreachable or inconsistent). However, we'd have to wire through the pull secret into the container that runs oc.--forcemakes me feel better, especially when we do automated updates. I would rather have all of our testing using a signature rather than only what end users see.TODO: