Skip to content

Commit

Permalink
Add Fulcio intermediate CA certificate to intermediate pool
Browse files Browse the repository at this point in the history
This certificate will be necessary for chain building from a leaf
certificate to a root once a new version of Fulcio is rolled out. For
OCI, the chain is stored in an annotation. This intermediate is
currently only needed for verify-blob when looking up the certificate
from Rekor.

For the V3 TUF Root, the intermediate will be bundled, so that it is
easily discoverable and revokable. For now, we'll simply bundle it with
Cosign. Note that intermediates are considered untrusted, so it's fine
if the intermediate is not in TUF currently, as the root that issued the
intermediate certificate is in TUF.

Signed-off-by: Hayden Blauzvern <[email protected]>
  • Loading branch information
haydentherapper committed Apr 18, 2022
1 parent f89d691 commit ba2fea1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 8 additions & 0 deletions cmd/cosign/cli/fulcio/fulcioroots/fulcioroots.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ var fulcioTargetStr = `fulcio.crt.pem`
// This is the v1 migrated root.
var fulcioV1TargetStr = `fulcio_v1.crt.pem`

// The untrusted intermediate CA certificate, used for chain building
var fulcioIntermediateV1Path = "fulcio_intermediate_v1.crt.pem"

const (
altRoot = "SIGSTORE_ROOT_FILE"
)
Expand Down Expand Up @@ -116,6 +119,11 @@ func initRoots() (*x509.CertPool, *x509.CertPool, error) {
}
}
}
intPEM, err := os.ReadFile(fulcioIntermediateV1Path)
if err != nil {
return nil, nil, errors.Wrap(err, "error reading intermediate cert PEM file")
}
intermediatePool.AppendCertsFromPEM(intPEM)
}
return rootPool, intermediatePool, nil
}
3 changes: 1 addition & 2 deletions cmd/cosign/cli/fulcio/fulcioroots/fulcioroots_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ func TestGetFulcioRoots(t *testing.T) {
if _, err := tmpCertFile.Write(chain); err != nil {
t.Fatalf("failed to write cert file: %v", err)
}
os.Setenv("SIGSTORE_ROOT_FILE", tmpCertFile.Name())
defer os.Unsetenv("SIGSTORE_ROOT_FILE")
t.Setenv("SIGSTORE_ROOT_FILE", tmpCertFile.Name())

rootCertPool := Get()
// ignore deprecation error because certificates do not contain from SystemCertPool
Expand Down

0 comments on commit ba2fea1

Please sign in to comment.