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

Cosign container and binaries #20

Merged
merged 12 commits into from
Jun 27, 2022
Merged

Conversation

thepwagner
Copy link
Contributor

Use cosign+fulcio to sign the containers and binaries generated from the release process.

I've tested this in https://github.com/thepwagner/hansel , and this PR include the "receipts" from that experimentation. I'll be sure to squash.

You can verify the container:

$ COSIGN_EXPERIMENTAL=1 cosign verify ghcr.io/thepwagner/hansel:0.0.9 | jq

You can verify the blobs:

$ curl -sOL https://github.com/thepwagner/hansel/releases/download/v0.0.9/hansel_0.0.9_linux_amd64.tar.gz
$ tar xvf hansel_0.0.9_linux_amd64.tar.gz
LICENSE
README.md
hansel

$ curl -sOL https://github.com/thepwagner/hansel/releases/download/v0.0.9/hansel_0.0.9_linux_amd64-keyless.sig
$ curl -sOL https://github.com/thepwagner/hansel/releases/download/v0.0.9/hansel_0.0.9_linux_amd64-keyless.pem
$ COSIGN_EXPERIMENTAL=1 cosign verify-blob --signature hansel_0.0.9_linux_amd64-keyless.sig --certificate hansel_0.0.9_linux_amd64-keyless.pem --enforce-sct hansel
$ base64 -d hansel_0.0.9_linux_amd64-keyless.pem | openssl x509 -text
  • You should see the cosign verify-blob state Verified OK for the signature.
  • From the openssl output, you should se:
    • The key was issued by O = sigstore.dev, CN = sigstore-intermediate
    • The certificate was only valid for a 10 minute window while the workflow ran
    • A bunch of x509 extensions linking the certificate to the triggering Actions workflow+event.

I see the following in the logs:
```
error during command execution: signing /home/runner/work/hansel/hansel/dist/hansel_darwin_amd64_v1/hansel: getting key from Fulcio: verifying SCT: creating cached local store: resource temporarily unavailabl
```

Theories from "local store" is that is a conflict/race that limited
parallelism will fix.
Alternatively, could be a server-side throttle that limited paralellism
may fix.

This is probably the last stop before giving up on blob signing and just
trying to get container signing working.
@thepwagner thepwagner self-assigned this Jun 24, 2022
@thepwagner thepwagner requested review from a team and cdenyar and removed request for a team June 24, 2022 14:09
Copy link
Member

@Owen-Cummings Owen-Cummings left a comment

Choose a reason for hiding this comment

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

LGTM! :shipit:

@thepwagner thepwagner merged commit ae381e0 into main Jun 27, 2022
@thepwagner thepwagner deleted the cosign-container-and-binaries branch June 27, 2022 15:07
@thepwagner
Copy link
Contributor Author

This shipped in https://github.com/Shopify/hansel/releases/tag/v0.0.4

$ COSIGN_EXPERIMENTAL=1 ./cosign verify ghcr.io/shopify/hansel:0.0.4

Verification for ghcr.io/shopify/hansel:0.0.4 --
The following checks were performed on each of these signatures:
  - The cosign claims were validated
  - Existence of the claims in the transparency log was verified offline
  - Any certificates were verified against the Fulcio roots.

[{"critical":{"identity":{"docker-reference":"ghcr.io/shopify/hansel"},"image":{"docker-manifest-digest":"sha256:3dd2d9fea757f4ce163674a681c8795fcb64dbc29d3490f3f2f135fd52f5e242"},"type":"cosign container image signature"},"optional":{"Bundle":{"SignedEntryTimestamp":"MEUCIQChAiDufT3tSpnITpNB/t8u0Ap/i77eZSVH/Caf4kehRQIgZUfdc2tyJeEnWvA3ge6zJQZq+ZKd8vvU6eeyEn5ktAc=","Payload":{"body":"eyJhcGlWZXJzaW9uIjoiMC4wLjEiLCJraW5kIjoiaGFzaGVkcmVrb3JkIiwic3BlYyI6eyJkYXRhIjp7Imhhc2giOnsiYWxnb3JpdGhtIjoic2hhMjU2IiwidmFsdWUiOiJlZDkxMWJjNGU5Y2JhMzljMzdjODQ1YmQyMDc3NjQxMTBiYWYwNzJkNzk0Y2VmNDZkYzIwMDg1NTdmNWQ3NWEwIn19LCJzaWduYXR1cmUiOnsiY29udGVudCI6Ik1FVUNJUUQvcmNiZy9IYU1LYzdDeVNpcDJRZEJ6Rkw3MmZTcmp3L20xTDhtRVFQQmdRSWdIUW5IVThRd2N3enMzSkNFWFBLNXBEU3Nldk9ic0piWTU4RllkYlJlQ3BBPSIsInB1YmxpY0tleSI6eyJ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1ObEU1U2pSU1ltNU5aRk5OVlhjMmVVVjFVbWREQ2sxQ1ltZEhaVkpDUm05U2JIWjVSR1ZHZURSRE1XSjFSa0ZDWlhsamEyZERjRk55VEdaeWJrWktNWEpxVDJSdlNYcEVlVkZoVkdaaVNVeExZa1IwYzJzS1JtYzlQUW90TFMwdExVVk9SQ0JEUlZKVVNVWkpRMEZVUlMwdExTMHRDZz09In19fX0=","integratedTime":1656342862,"logIndex":2780710,"logID":"c0d23d6ad406973f9559f3ba2d1ca01f84147d8ffc5b8445c224f98b9591801d"}},"Issuer":"https://token.actions.githubusercontent.com","Subject":"https://github.com/Shopify/hansel/.github/workflows/release.yaml@refs/tags/v0.0.4"}},{"critical":{"identity":{"docker-reference":"ghcr.io/shopify/hansel"},"image":{"docker-manifest-digest":"sha256:3dd2d9fea757f4ce163674a681c8795fcb64dbc29d3490f3f2f135fd52f5e242"},"type":"cosign container image signature"},"optional":{"Bundle":{"SignedEntryTimestamp":"MEUCIQDuwzGYoTBWzoISx9hQh+Fpgi6S6xtG4eMhempGccBVxgIgHpk1U4EARM+59rJFlYwIJUzb4tQ5CrEOd0gWM+++LnM=","Payload":{"body":"eyJhcGlWZXJzaW9uIjoiMC4wLjEiLCJraW5kIjoiaGFzaGVkcmVrb3JkIiwic3BlYyI6eyJkYXRhIjp7Imhhc2giOnsiYWxnb3JpdGhtIjoic2hhMjU2IiwidmFsdWUiOiJlZDkxMWJjNGU5Y2JhMzljMzdjODQ1YmQyMDc3NjQxMTBiYWYwNzJkNzk0Y2VmNDZkYzIwMDg1NTdmNWQ3NWEwIn19LCJzaWduYXR1cmUiOnsiY29udGVudCI6Ik1FUUNJQnFJdWc1ajVGNkFLV056RGpkeDFmMG5yTVIxZHJsV2RVS3F1eXhrQ2o3b0FpQTNmMVBFZTF6a0VLaXQxVXE5Y3hPUG1YVnhNSi9SSXV3d1NIczN2RGNCTFE9PSIsInB1YmxpY0tleSI6eyJjb250ZW50IjoiTFMwdExTMUNSVWRKVGlCRF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xUlJFSlhNbWh6TkhoT2JXeE9WVVZVUkVsUWExUkRjRU5TVFN0dWRrOVhkVk5yTVdsSmFGRTBNVWxEVVhkVlZYZHlaRGhaZG5OYU5rNXFhRE15VmtVS1VsQlpQUW90TFMwdExVVk9SQ0JEUlZKVVNVWkpRMEZVUlMwdExTMHRDZz09In19fX0=","integratedTime":1656342866,"logIndex":2780711,"logID":"c0d23d6ad406973f9559f3ba2d1ca01f84147d8ffc5b8445c224f98b9591801d"}},"Issuer":"https://token.actions.githubusercontent.com","Subject":"https://github.com/Shopify/hansel/.github/workflows/release.yaml@refs/tags/v0.0.4"}}]

$ cosign verify-blob --certificate hansel_0.0.4_linux_amd64-keyless.pem --signature hansel_0.0.4_linux_amd64-keyless.sig hansel
Verified OK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants