Closed peer-jslater closed 8 months ago
--certificate-chain
. The linked PR is to support multiple trusted roots and to differentiate between roots and chain building CA certificates. In the example you gave, the existing --certificate-chain
flag should be sufficient. - https://docs.sigstore.dev/verifying/verify/#verify-image-with-user-provided-trusted-chain--certificate
flag along with --certificate-chain
. That will extract the key after verification.--key
on signing, that took priority over contacting the CA to get a cert. If you want a cert for a provided key, you need to add --issue-certificate
. However, given you are spinning a Fulcio instance already, do you need to be generated your own keys, or can you simply configure the client to talk to your local instance of Fulcio with --fulcio-url
? Basically just drop --key
from the sign command, or drop --fulcio-url
if you want to just use a key. (See https://blog.sigstore.dev/adopting-sigstore-incrementally-1b56a69b8c15/ for more info)--key
it generates ephemeral keys.
COSIGN_PASSWORD="" cosign sign --certificate ~/certs/ca_files/without_metadata/leaf.pem --certificate-chain ~/certs/ca_files/without_metadata/intermediate.pem --fulcio-url http://localhost:5555 --rekor-url http://localhost:3000 $IMAGE_DIGEST
Edit: I've also tried adding --issue-certificate to the end of the signing command and it still only signing using ephemeral keys.
If you want to get a certificate for a managed key, you need both --key
and --issue-certificate
. Without --key
, an ephemeral key is used. Note that is the recommended way to use Sigstore, as removing key management is one of the goals of the project.
A token can be fetched out of band and provided with --identity-token
- https://docs.sigstore.dev/signing/overview/#identity-tokens
So far, the best workflow was:
--ca=fileca
and specify the intermediate ca cert there. This way the root trusts the certificate. cosign sign
--fulcio-url http://localhost:5555
--rekor-url http://localhost:3000
$IMAGE_DIGEST
This does generate ephemeral keys but the intermediate certificate is included in the signature as the chain. So that's good.
cosign verify
$IMAGE_DIGEST
--certificate-identity='email you signed with'
--certificate-oidc-issuer='https://oauth2.sigstore.dev/auth'
--certificate-chain=path/to/intermediate.crt
Thanks for your help. I'll be adding the identity token you mentioned.
One thing to mention is that certificate-chain
should contain the full CA certificate chain, starting with intermediates and ending with the root. Otherwise the trust chain is built up from the intermediate.
Lemme know if you have any other questions!
Background
We have an external root CA. It has a root certificate. Let's say the root CA signs an intermediate cert. Then that intermediate cert is used to sign a leaf cert. This leaf cert is specifically for the signing process.
I want to sign a docker image using the leaf cert's private key. And I want to verify the docker image signature using the root CA's public key. The idea being that the root certificate is distributed to the users with minimal effort and the leaf cert is given to the sigstore tools but can be revoked if needed without having to issue a new root cert.
I've read as much as I could find on this. And I'm still very confused. Below is my process so far. The problem is that I have to supply the (cosign imported) public key for the LEAF cert instead of the root cert. Ideally, I wouldn't even have to import root cert to cosign since that requires access to the root cert's private key.
Approach
(done according to: Setting up a fulcio instance) (I also need to:
$Env:FULCIO_METRICS_PORT=2113
since it conflicts with rekor)Verification succeeds but my main question is point 1 below. Output:
Questions
cosign verify --ca-roots root-ca.crt.pem --rekor-url http://localhost:3000 $IMAGE_DIGEST
? Is this only supported once https://github.com/sigstore/cosign/issues/3462 gets in?--key
for sign. Could a link to import keys be added in the sign-and-attach-a-certificate-and-certificate-chain section? (I'm asking because certificates don't seem very well supported yet and a full guide on them would be ideal but I don't know how to best change the documentation as I'm new to certs and signing).