|
| 1 | +# Image Verification |
| 2 | + |
| 3 | +The Tutorials container image is signed using [Sigstore's](https://sigstore.dev/) Cosign. The container image is signed using a cryptographic key pair that is private and stored internally. The public key is available in the official Spectro Cloud documentation repository at [**static/cosign.pub**](https://raw.githubusercontent.com/spectrocloud/librarium/master/static/cosign.pub). Use the public key to verify the authenticity of the container image. You can learn more about the container image signing process by reviewing the [Signing Containers](https://docs.sigstore.dev/signing/signing_with_containers) documentation page. |
| 4 | + |
| 5 | + |
| 6 | +> [!NOTE] |
| 7 | +> Cosign generates a key pair that uses the ECDSA-P256 algorithm for the signature and SHA256 for hashes. The keys are stored in PEM-encoded PKCS8 format. |
| 8 | +
|
| 9 | + |
| 10 | +Use the following command to verify the authenticity of the container image. Replace the image tag with the version you want to verify. |
| 11 | + |
| 12 | +```shell |
| 13 | +cosign verify --key https://raw.githubusercontent.com/spectrocloud/librarium/master/static/cosign.pub \ |
| 14 | +ghcr.io/spectrocloud/tutorials:1.1.1 |
| 15 | +``` |
| 16 | + |
| 17 | +If the container image is valid, the following output is displayed. The example output is formatted using `jq` to improve readability. |
| 18 | + |
| 19 | +```shell hideClipboard |
| 20 | +Verification for ghcr.io/spectrocloud/tutorials:1.1.1 -- |
| 21 | +The following checks were performed on each of these signatures: |
| 22 | + - The cosign claims were validated |
| 23 | + - Existence of the claims in the transparency log was verified offline |
| 24 | + - The signatures were verified against the specified public key |
| 25 | +[ |
| 26 | + { |
| 27 | + "critical": { |
| 28 | + "identity": { |
| 29 | + "docker-reference": "ghcr.io/spectrocloud/tutorials:1.1.1" |
| 30 | + }, |
| 31 | + "image": { |
| 32 | + "docker-manifest-digest": "sha256:285a95a8594883b3748138460182142f5a1b74f80761e2fecb1b86d3c9b9d191" |
| 33 | + }, |
| 34 | + "type": "cosign container image signature" |
| 35 | + }, |
| 36 | + "optional": { |
| 37 | + "Bundle": { |
| 38 | + "SignedEntryTimestamp": "MEYCIQCZ6FZzNB5wA9+W/lF57jx0qTaszZhg5FxJiBmgIFxPVwIhANnoQQ5gqjr1h93LCq1Td8BohqrxxIvfrXTnT1tYR4i7", |
| 39 | + "Payload": { |
| 40 | + "body": "eyJhcGlWZXJzaW9uIjoiMC4wLjEiLCJraW5kIjoiaGFzaGVkcmVrb3JkIiwic3BlYyI6eyJkYXRhIjp7Imhhc2giOnsiYWxnb3JpdGhtIjoic2hhMjU2IiwidmFsdWUiOiI0MzU0MzFjNjY1Y2Y2ZGZjYzM0NzI2YWRkNjAzMDVjYjZlMzhlNjVkZmJlMWQ0NWU2ZGVkM2IzNzg3NTYwY2MxIn19LCJzaWduYXR1cmUiOnsiY29udGVudCI6Ik1FVUNJUUM0TFFxYVFDclhOc0VzdkI0ZE84bmtZSWg0L3o5UzdScGVEdUZnUDJwbDJ3SWdOdEJsNElDaHBmT3RnVDBlNW5QTmRMYWt4RTJHcnFFK0tjV1JXSGZPTnpnPSIsInB1YmxpY0tleSI6eyJjb250ZW50IjoiTFMwdExTMUNSVWRKVGlCUVZVSk1TVU1nUzBWWkxTMHRMUzBLVFVacmQwVjNXVWhMYjFwSmVtb3dRMEZSV1VsTGIxcEplbW93UkVGUlkwUlJaMEZGV1VoeVl6SlhTVVV6WVhCTFRHMWplR3hHUmtoNVZsRkRVVnBYYUFveUsyRnNOVmN2Vmsxc1VISXpkVFJGV2k5V0wwZFBRbTAySzFrNVowWXpWWE16ZEhkMVpWaFpaMlJaWlVadk5XODNRbFZ1TnpCTlVGQjNQVDBLTFMwdExTMUZUa1FnVUZWQ1RFbERJRXRGV1MwdExTMHRDZz09In19fX0=", |
| 41 | + "integratedTime": 1702758491, |
| 42 | + "logIndex": 57230483, |
| 43 | + "logID": "c0d23d6ad406973f9559f3ba2d1ca01f84147d8ffc5b8445c224f98b9591801d" |
| 44 | + } |
| 45 | + }, |
| 46 | + "owner": "Spectro Cloud", |
| 47 | + "ref": "e597f70be238369ce4f0e5778492a155e23fec17", |
| 48 | + "repo": "spectrocloud/tutorials", |
| 49 | + "workflow": "Release" |
| 50 | + } |
| 51 | + } |
| 52 | +] |
| 53 | +``` |
| 54 | + |
| 55 | +> [!CAUTION] |
| 56 | +> Do not use the container image if the authenticity cannot be verified. Verify you downloaded the correct public key and that the container image is from `ghcr.io/spectrocloud/tutorials`. |
| 57 | +
|
| 58 | +If the container image is not valid, an error is displayed. The following example shows an error when the container image is not valid. |
| 59 | + |
| 60 | +```shell hideClipboard |
| 61 | +cosign verify --key https://raw.githubusercontent.com/spectrocloud/librarium/master/static/cosign.pub \ |
| 62 | +ghcr.io/spectrocloud/tutorials:1.1.66 |
| 63 | +``` |
| 64 | + |
| 65 | +```shell hideClipboard |
| 66 | +Error: no matching signatures: error verifying bundle: comparing public key PEMs, expected -----BEGIN PUBLIC KEY----- |
| 67 | +MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEheVfGYrVn2mIUQ4cxMJ6x09oXf82 |
| 68 | +zFEMG++p4q8Mf+y2gp7Ae4oUaXk6Q9V7aVjjltRVN6SQcoSASxf2H2EpgA== |
| 69 | +-----END PUBLIC KEY----- |
| 70 | +, got -----BEGIN PUBLIC KEY----- |
| 71 | +MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEYHrc2WIE3apKLmcxlFFHyVQCQZWh |
| 72 | +2+al5W/VMlPr3u4EZ/V/GOBm6+Y9gF3Us3twueXYgdYeFo5o7BUn70MPPw== |
| 73 | +-----END PUBLIC KEY----- |
| 74 | + |
| 75 | +main.go:69: error during command execution: no matching signatures: error verifying bundle: comparing public key PEMs, expected -----BEGIN PUBLIC KEY----- |
| 76 | +MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEheVfGYrVn2mIUQ4cxMJ6x09oXf82 |
| 77 | +zFEMG++p4q8Mf+y2gp7Ae4oUaXk6Q9V7aVjjltRVN6SQcoSASxf2H2EpgA== |
| 78 | +-----END PUBLIC KEY----- |
| 79 | +, got -----BEGIN PUBLIC KEY----- |
| 80 | +MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEYHrc2WIE3apKLmcxlFFHyVQCQZWh |
| 81 | +2+al5W/VMlPr3u4EZ/V/GOBm6+Y9gF3Us3twueXYgdYeFo5o7BUn70MPPw== |
| 82 | +-----END PUBLIC KEY----- |
| 83 | +``` |
0 commit comments