-
Notifications
You must be signed in to change notification settings - Fork 139
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
feat: adds cert-utility. #1870
base: main
Are you sure you want to change the base?
feat: adds cert-utility. #1870
Conversation
5f05997
to
1f2eb04
Compare
2471698
to
450b214
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1870 +/- ##
==========================================
- Coverage 57.93% 51.02% -6.91%
==========================================
Files 50 73 +23
Lines 3119 5634 +2515
==========================================
+ Hits 1807 2875 +1068
- Misses 1154 2497 +1343
- Partials 158 262 +104 ☔ View full report in Codecov by Sentry. |
2fbc59f
to
aa6d7aa
Compare
61d9f68
to
8193f47
Compare
i think this is ready for 👀 now. just a couple of notes.
i think that about covers it, i have some basic readme/documentation above as well. |
Thanks @ianhundere, I’ll take a look at this later this week. |
563de59
to
78b06b6
Compare
2cbf902
to
49b38dc
Compare
a nudge for 👀 |
pkg/certmaker/certmaker.go
Outdated
"go.step.sm/crypto/kms/awskms" | ||
"go.step.sm/crypto/kms/azurekms" | ||
"go.step.sm/crypto/kms/cloudkms" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing you use these deps b/c we don't expose enough of them in sigstore/sigstore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doh, you're right / i'll implement the sigstore library for kms signing, but continue to use smallstep/crypto for certificate generation (e.g. feeding it cert templates etc).
@bobcallaway thanks for the fb especially w/ the
createCmd.Flags().StringVar(&kmsType, "kms-type", "", "KMS provider type (awskms, gcpkms, azurekms)")
createCmd.Flags().StringVar(&kmsTenantID, "azure-tenant-id", "", "Azure KMS tenant ID")
createCmd.Flags().StringVar(&kmsCredsFile, "gcp-credentials-file", "", "Path to credentials file for GCP KMS")
createCmd.Flags().StringVar(&kmsRegion, "aws-region", "", "AWS KMS region")
AWS_REGION
AZURE_TENANT_ID
GCP_CREDENTIALS_FILE
i'll implement the same fb w/ tsa. ps also updated the readme/docs above. let me know if i should include that in some shape way or form in the repo itself. |
8bc9cb7
to
c664639
Compare
Signed-off-by: ianhundere <[email protected]>
…ignore. Signed-off-by: ianhundere <[email protected]>
Signed-off-by: ianhundere <[email protected]>
96b69b9
to
c76001a
Compare
…ore consistent w/ tsa cert-utility. Signed-off-by: ianhundere <[email protected]>
…escriptive. Signed-off-by: ianhundere <[email protected]>
… consistent w/ flags. Signed-off-by: ianhundere <[email protected]>
…e flag to gcp-credentials-file. Signed-off-by: ianhundere <[email protected]>
Signed-off-by: ianhundere <[email protected]>
a73d460
to
2d28296
Compare
… support, and adds testify back. Signed-off-by: ianhundere <[email protected]>
3d9f577
to
2d76af7
Compare
closes #1869
Summary
currently, there is no standard method for creating cert chains for fulcio or tsa. the community has used an assortment of open source scripts/tools, but i thought it would be nice to have a small cloud agnostic go app to create/sign (via awskms, gcpkms, or azurekms) certificates. the smallstep crypto library is fairly comprehensive in its kms/cert capabilities.
@haydentherapper / @bobcallaway gave the go ahead in proceeding w/ this work.
Release Note
Documentation
Overview
This tool creates root, intermediate (optional), and leaf certificates for Fulcio (compliant to Fulcio's certificate requirements):
Requirements
Local Development
Clone and build the project locally:
Usage
The tool can be configured using either command-line flags or environment variables.
Command-Line Interface
Available flags:
--kms-type
: KMS provider type (awskms, gcpkms, azurekms)--root-key-id
: KMS key identifier for root certificate--leaf-key-id
: KMS key identifier for leaf certificate--aws-region
: AWS region (required for AWS KMS)--azure-tenant-id
: Azure KMS tenant ID--gcp-credentials-file
: Path to credentials file (for Google Cloud KMS)--root-template
: Path to root certificate template--leaf-template
: Path to leaf certificate template--root-cert
: Output path for root certificate (default: root.pem)--leaf-cert
: Output path for leaf certificate (default: leaf.pem)--intermediate-key-id
: KMS key identifier for intermediate certificate--intermediate-template
: Path to intermediate certificate template--intermediate-cert
: Output path for intermediate certificateEnvironment Variables
KMS_TYPE
: KMS provider type ("awskms", "gcpkms", "azurekms")ROOT_KEY_ID
: Key identifier for root certificateKMS_INTERMEDIATE_KEY_ID
: Key identifier for intermediate certificateLEAF_KEY_ID
: Key identifier for leaf certificateAWS_REGION
: AWS Region (required for AWS KMS)AZURE_TENANT_ID
: Azure tenant IDGCP_CREDENTIALS_FILE
: Path to credentials file (for Google Cloud KMS)Certificate Templates
The tool uses JSON templates to define certificate properties:
root-template.json
: Defines root CA certificate propertiesintermediate-template.json
: Defines intermediate CA certificate properties (when using --intermediate-key-id)leaf-template.json
: Defines leaf certificate propertiesTemplates are located in
pkg/certmaker/templates/
.Note: Templates use standard JSON format with code signing extensions.
Provider-Specific Configuration Examples
AWS KMS
Google Cloud KMS
Azure KMS
Example Certificate Outputs
Fulcio Leaf Certificate
Fulcio Intermediate CA Certificate
Fulcio Root CA Certificate
Certificate: Data: Version: 3 (0x2) Serial Number: 1733012038 (0x674baa46) Signature Algorithm: ecdsa-with-SHA256 Issuer: C=US, O=Sigstore, OU=Fulcio Root CA, CN=https://fulcio.com Validity Not Before: Jan 1 00:00:00 2024 GMT Not After : Jan 1 00:00:00 2034 GMT Subject: C=US, O=Sigstore, OU=Fulcio Root CA, CN=https://fulcio.com Subject Public Key Info: Public Key Algorithm: id-ecPublicKey Public-Key: (256 bit) pub: 04:73:77:29:2b:48:de:da:82:53:60:36:ac:9e:b7: e1:78:3e:e1:d6:58:f1:7e:fa:b2:2a:28:c5:c8:d4: 25:c6:e8:5c:d1:63:a8:22:3e:a6:7b:bb:3b:d7:f3: 98:c8:25:52:12:2a:c1:fb:9b:56:af:97:77:a4:48: 89:be:49:bc:63 ASN1 OID: prime256v1 NIST CURVE: P-256 X509v3 extensions: X509v3 Key Usage: critical Certificate Sign, CRL Sign X509v3 Basic Constraints: critical CA:TRUE, pathlen:1 X509v3 Subject Key Identifier: BB:84:41:46:F0:A6:90:38:C0:73:1E:11:F4:58:7C:44:9B:C6:45:89 Signature Algorithm: ecdsa-with-SHA256 Signature Value: 30:45:02:21:00:d5:82:3b:01:64:9f:f3:f3:b1:d6:44:43:1f: 78:2d:7f:b8:c9:e9:0e:7e:34:9f:8c:55:33:09:14:2a:16:c5: b2:02:20:04:a5:a2:49:ee:3b:22:4c:f5:5b:b3:9b:ff:b4:40: dc:f6:a3:11:00:05:a3:14:d5:77:72:f6:f9:44:f1:e9:27
Running the Tool
Example with AWS KMS:
Example with Azure KMS: