From 8dbc5f70a51aa17fa1ec9c2a34361d0b5d3ccae5 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Wed, 6 May 2020 16:02:21 -0600 Subject: Update dependencies and get rid of placeholder hacks in CA code With the latest commit on smallstep/certificates, placeholders in config are no longer needed. --- modules/caddypki/ca.go | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) (limited to 'modules/caddypki') diff --git a/modules/caddypki/ca.go b/modules/caddypki/ca.go index 610e7f6..641f006 100644 --- a/modules/caddypki/ca.go +++ b/modules/caddypki/ca.go @@ -176,23 +176,6 @@ func (ca CA) IntermediateKey() interface{} { // NewAuthority returns a new Smallstep-powered signing authority for this CA. func (ca CA) NewAuthority(authorityConfig AuthorityConfig) (*authority.Authority, error) { - cfg := &authority.Config{ - // TODO: eliminate these placeholders / needless values - // see https://github.com/smallstep/certificates/issues/218 - Address: "placeholder_Address:1", - Root: []string{"placeholder_Root"}, - IntermediateCert: "placeholder_IntermediateCert", - IntermediateKey: "placeholder_IntermediateKey", - DNSNames: []string{"placeholder_DNSNames"}, - - AuthorityConfig: authorityConfig.AuthConfig, - DB: authorityConfig.DB, - } - // TODO: this also seems unnecessary, see above issue - if cfg.AuthorityConfig == nil { - cfg.AuthorityConfig = new(authority.AuthConfig) - } - // get the root certificate and the issuer cert+key rootCert := ca.RootCertificate() var issuerCert *x509.Certificate @@ -209,7 +192,11 @@ func (ca CA) NewAuthority(authorityConfig AuthorityConfig) (*authority.Authority issuerKey = ca.IntermediateKey() } - auth, err := authority.New(cfg, + auth, err := authority.NewEmbedded( + authority.WithConfig(&authority.Config{ + AuthorityConfig: authorityConfig.AuthConfig, + DB: authorityConfig.DB, + }), authority.WithX509Signer(issuerCert, issuerKey.(crypto.Signer)), authority.WithX509RootCerts(rootCert), ) -- cgit v1.2.3