Skip to content

Commit

Permalink
Merge pull request #894 from smallstep/ahmet2mir-feat/vault
Browse files Browse the repository at this point in the history
Vault CAS
  • Loading branch information
maraino authored Apr 19, 2022
2 parents b99692f + fe9c3cf commit d61cd98
Show file tree
Hide file tree
Showing 10 changed files with 1,152 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Added
- Added support for certificate renewals after expiry using the claim `allowRenewalAfterExpiry`.
- Added support for `extraNames` in X.509 templates.
- Added RA support using a Vault instance as the CA.
- Added support for automatic configuration of linked RAs.
### Changed
- Made SCEP CA URL paths dynamic
Expand Down
4 changes: 4 additions & 0 deletions authority/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ type Config struct {
TLS *TLSOptions `json:"tls,omitempty"`
Password string `json:"password,omitempty"`
Templates *templates.Templates `json:"templates,omitempty"`
CommonName string `json:"commonName,omitempty"`
}

// ASN1DN contains ASN1.DN attributes that are used in Subject and Issuer
Expand Down Expand Up @@ -173,6 +174,9 @@ func (c *Config) Init() {
if c.AuthorityConfig == nil {
c.AuthorityConfig = &AuthConfig{}
}
if c.CommonName == "" {
c.CommonName = "Step Online CA"
}
c.AuthorityConfig.init()
}

Expand Down
2 changes: 1 addition & 1 deletion authority/tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ func (a *Authority) GetTLSCertificate() (*tls.Certificate, error) {
}

// Create initial certificate request.
cr, err := x509util.CreateCertificateRequest("Step Online CA", sans, signer)
cr, err := x509util.CreateCertificateRequest(a.config.CommonName, sans, signer)
if err != nil {
return fatal(err)
}
Expand Down
7 changes: 6 additions & 1 deletion cas/apiv1/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package apiv1
import (
"crypto"
"crypto/x509"
"encoding/json"

"github.com/pkg/errors"
"github.com/smallstep/certificates/kms"
Expand All @@ -15,8 +16,9 @@ type Options struct {
Type string `json:"type"`

// CertificateAuthority reference:
// In StepCAS the value is the CA url, e.g. "https://ca.smallstep.com:9000".
// In StepCAS the value is the CA url, e.g., "https://ca.smallstep.com:9000".
// In CloudCAS the format is "projects/*/locations/*/certificateAuthorities/*".
// In VaultCAS the value is the url, e.g., "https://vault.smallstep.com".
CertificateAuthority string `json:"certificateAuthority,omitempty"`

// CertificateAuthorityFingerprint is the root fingerprint used to
Expand Down Expand Up @@ -69,6 +71,9 @@ type Options struct {
CaPool string `json:"-"`
CaPoolTier string `json:"-"`
GCSBucket string `json:"-"`

// Generic structure to configure any CAS
Config json.RawMessage `json:"config,omitempty"`
}

// CertificateIssuer contains the properties used to use the StepCAS certificate
Expand Down
2 changes: 2 additions & 0 deletions cas/apiv1/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ const (
CloudCAS = "cloudcas"
// StepCAS is a CertificateAuthorityService using another step-ca instance.
StepCAS = "stepcas"
// VaultCAS is a CertificateAuthorityService using Hasicorp Vault PKI.
VaultCAS = "vaultcas"
)

// String returns a string from the type. It will always return the lower case
Expand Down
Loading

0 comments on commit d61cd98

Please sign in to comment.