Skip to content

Commit

Permalink
Fix bug with Vault CA provider where updating
Browse files Browse the repository at this point in the history
RootPKIPath but not IntermediatePKIPath would
not update leaf signing certs with the new root.
  • Loading branch information
Chris S. Kim committed Jul 13, 2023
1 parent 57bb6f3 commit b2dad88
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
7 changes: 5 additions & 2 deletions agent/connect/ca/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,11 @@ type PrimaryProvider interface {
// provider.
//
// Depending on the provider and its configuration, GenerateCAChain may return
// a single root certificate or a chain of certs. The provider should return an
// existing CA chain if one exists or generate a new one and return it.
// a single root certificate or a chain of certs.
// The first certificate must be the primary CA used to sign intermediates for
// secondary datacenters, and the last certificate must be the trusted CA.
// The provider should return an existing CA chain if one exists or generate a
// new one and return it.
GenerateCAChain() (string, error)

// SignIntermediate will validate the CSR to ensure the trust domain in the
Expand Down
8 changes: 4 additions & 4 deletions agent/structs/connect_ca.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (
)

const (
DefaultLeafCertTTL = "15min"
DefaultIntermediateCertTTL = "1h" // ~ 1 year = 365 * 24h
DefaultLeafCertTTL = "72h"
DefaultIntermediateCertTTL = "8760h" // ~ 1 year = 365 * 24h
DefaultRootCertTTL = "87600h" // ~ 10 years = 365 * 24h * 10
)

Expand Down Expand Up @@ -433,12 +433,12 @@ type CommonCAProviderConfig struct {
PrivateKeyBits int
}

var MinLeafCertTTL = time.Minute
var MinLeafCertTTL = time.Hour
var MaxLeafCertTTL = 365 * 24 * time.Hour

// intermediateCertRenewInterval is the interval at which the expiration
// of the intermediate cert is checked and renewed if necessary.
var IntermediateCertRenewInterval = 30 * time.Minute
var IntermediateCertRenewInterval = time.Hour

func (c CommonCAProviderConfig) Validate() error {
if c.SkipValidate {
Expand Down

0 comments on commit b2dad88

Please sign in to comment.