Repository navigation
Create a resuable verify package for image release verification - #837
Conversation
5ed2982 to
7ec1baf
Compare
|
/retest |
|
/retitle Create a resuable verify package for image release verification |
7ec1baf to
f2a7915
Compare
|
/hold |
a8f7bc1 to
8ff8d9f
Compare
|
Created new test cases in |
|
/unhold |
8ff8d9f to
d444be4
Compare
d444be4 to
8a3b061
Compare
8a3b061 to
892e7fb
Compare
Both the oc client application and the CVO do image release verification. Image release verification was recently added to the oc client and at that time any code required was simply copied from the CVO were it was originally developed. This change moves the code required for image release verification, the CVO package verify, from the CVO into library-go for reuse by CVO and the oc client application and applies any required changes to make it reusabe by both.
892e7fb to
c43c2cb
Compare
wking
left a comment
There was a problem hiding this comment.
$ git --no-pager -C cluster-version-operator log -1 --oneline
34010292 (HEAD -> master, wking/master, origin/release-4.7, origin/release-4.6, origin/master, origin/HEAD) Merge pull request #439 from wking/fix-component-regexp-docs
$ git --no-pager -C library-go log -1 --oneline
c43c2cb20 (HEAD, origin/pr/837) Create a resuable verify package for image release verification
$ diff -ru cluster-version-operator/pkg/verify library-go/pkg/verify
...nothing serious.../lgtm
/approve
|
/close In case this will help Prow notice #868. |
|
@wking: Closed this PR. DetailsIn response to this:
Instructions 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. |
|
/reopen |
|
@wking: Reopened this PR. DetailsIn response to this:
Instructions 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. |
|
/approve |
|
golang/x dep is ok /approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: deads2k, jottofar, wking 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 |
This function calls the callback for each signature, it doesn't return a list. Fixes a godoc from the original implementation in c43c2cb (Create a resuable verify package for image release verification, 2020-07-16, openshift#837).
Typo slipped in when the file was created in c43c2cb (Create a resuable verify package for image release verification, 2020-07-16, openshift#837).
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
Both the oc client application and the CVO do image release verification. Image release verification was recently added to the oc client and at that time any code required was simply copied from the CVO were it was originally developed. This change moves the code required for image release verification, the CVO package verify, from the CVO into library-go for reuse by CVO and the oc client application and applies any required changes to make it reusable by both.