mirror of
https://github.com/caddyserver/caddy.git
synced 2026-08-31 15:51:09 +00:00
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.
This commit is contained in:
parent
07c6076ea0
commit
8dbc5f70a5
3 changed files with 67 additions and 64 deletions
|
|
@ -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),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue