Skip to content

Commit ad2de16

Browse files
committed
Merge branch 'master' into herman/allow-deny
2 parents def9438 + d61cd98 commit ad2de16

File tree

11 files changed

+1159
-4
lines changed

11 files changed

+1159
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
88
### Added
99
- Added support for certificate renewals after expiry using the claim `allowRenewalAfterExpiry`.
1010
- Added support for `extraNames` in X.509 templates.
11+
- Added RA support using a Vault instance as the CA.
1112
- Added support for automatic configuration of linked RAs.
1213
### Changed
1314
- Made SCEP CA URL paths dynamic

authority/config/config.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ type Config struct {
7171
TLS *TLSOptions `json:"tls,omitempty"`
7272
Password string `json:"password,omitempty"`
7373
Templates *templates.Templates `json:"templates,omitempty"`
74+
CommonName string `json:"commonName,omitempty"`
7475
}
7576

7677
// ASN1DN contains ASN1.DN attributes that are used in Subject and Issuer
@@ -177,6 +178,9 @@ func (c *Config) Init() {
177178
if c.AuthorityConfig == nil {
178179
c.AuthorityConfig = &AuthConfig{}
179180
}
181+
if c.CommonName == "" {
182+
c.CommonName = "Step Online CA"
183+
}
180184
c.AuthorityConfig.init()
181185
}
182186

authority/tls.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ func (a *Authority) GetTLSCertificate() (*tls.Certificate, error) {
591591
}
592592

593593
// Create initial certificate request.
594-
cr, err := x509util.CreateCertificateRequest("Step Online CA", sans, signer)
594+
cr, err := x509util.CreateCertificateRequest(a.config.CommonName, sans, signer)
595595
if err != nil {
596596
return fatal(err)
597597
}

ca/adminClient.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,13 @@ func (c *AdminClient) generateAdminToken(aud *url.URL) (string, error) {
9191
return "", err
9292
}
9393

94+
// Drop any query string parameter from the token audience
95+
aud = &url.URL{
96+
Scheme: aud.Scheme,
97+
Host: aud.Host,
98+
Path: aud.Path,
99+
}
100+
94101
now := time.Now()
95102
tokOptions := []token.Options{
96103
token.WithJWTID(jwtID),

cas/apiv1/options.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package apiv1
33
import (
44
"crypto"
55
"crypto/x509"
6+
"encoding/json"
67

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

1718
// CertificateAuthority reference:
18-
// In StepCAS the value is the CA url, e.g. "https://ca.smallstep.com:9000".
19+
// In StepCAS the value is the CA url, e.g., "https://ca.smallstep.com:9000".
1920
// In CloudCAS the format is "projects/*/locations/*/certificateAuthorities/*".
21+
// In VaultCAS the value is the url, e.g., "https://vault.smallstep.com".
2022
CertificateAuthority string `json:"certificateAuthority,omitempty"`
2123

2224
// CertificateAuthorityFingerprint is the root fingerprint used to
@@ -69,6 +71,9 @@ type Options struct {
6971
CaPool string `json:"-"`
7072
CaPoolTier string `json:"-"`
7173
GCSBucket string `json:"-"`
74+
75+
// Generic structure to configure any CAS
76+
Config json.RawMessage `json:"config,omitempty"`
7277
}
7378

7479
// CertificateIssuer contains the properties used to use the StepCAS certificate

cas/apiv1/services.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ const (
4545
CloudCAS = "cloudcas"
4646
// StepCAS is a CertificateAuthorityService using another step-ca instance.
4747
StepCAS = "stepcas"
48+
// VaultCAS is a CertificateAuthorityService using Hasicorp Vault PKI.
49+
VaultCAS = "vaultcas"
4850
)
4951

5052
// String returns a string from the type. It will always return the lower case

0 commit comments

Comments
 (0)