How to set up container signing with cosign
This guide shows you how to set up Sigstore container signing for a BlueBuild custom image repository. This guide is useful when manually setting up a new repository, or regenerating keys for a pre-existing one. Setting up container signing is important for security and verifiability. This guide requires either cosign or skopeo, so make sure one of those is installed before proceeding. If you don’t already have either one of those installed, it is recommended you install cosign.
- Inside your repository, generate a new key pair. Do NOT put in a password when it asks you to, just press enter. The signing key will be used in GitHub Actions and will not work if it is encrypted.
- with cosign:
Terminal window # generates cosign.pub and cosign.keycosign generate-key-pair - with skopeo:
Terminal window # generates cosign.pub and cosign.privateskopeo generate-sigstore-key --output-prefix cosign
- with cosign:
- Add the private key to your GitHub repository secrets
- This can be done manually on GitHub:
- Open your repository’s settings.
- From the sidebar, pick “Secrets and Variables” and “Actions”.
- Create a new repository secret called
SIGNING_SECRETand for its value copy the contents of yourcosign.key/cosign.privatefile.
- This can also be done manually with the GitHub CLI, if that is installed:
Terminal window gh secret set SIGNING_SECRET < cosign.key # or cosign.private
- This can be done manually on GitHub:
- Commit the
cosign.pubfile into your git repository, so that it can be used for verification. The file should always be in the root of your repository.