diff options
author | Matthew Holt <[email protected]> | 2020-03-20 20:25:46 -0600 |
---|---|---|
committer | Matthew Holt <[email protected]> | 2020-03-20 20:25:46 -0600 |
commit | d692d503a3d327d54c82bceab48bb1de07bb3c3d (patch) | |
tree | 82d4442c9188b361fdf20b90a453e6d65a96a80b /modules/caddytls/automation.go | |
parent | 3c1def243020a3897121d4c5badf07ed45d2397d (diff) | |
download | caddy-d692d503a3d327d54c82bceab48bb1de07bb3c3d.tar.gz caddy-d692d503a3d327d54c82bceab48bb1de07bb3c3d.zip |
tls/http: Fix auto-HTTPS logic w/rt default issuers (fixes #3164)
The comments in the code should explain the new logic thoroughly.
The basic problem for the issue was that we were overriding a catch-all
automation policy's explicitly-configured issuer with our own, for names
that we thought looked like public names. In other words, one could
configure an internal issuer for all names, but then our auto HTTPS
would create a new policy for public-looking names that uses the
default ACME issuer, because we assume public<==>ACME and
nonpublic<==>Internal, but that is not always the case. The new logic
still assumes nonpublic<==>Internal (on catch-all policies only), but
no longer assumes that public-looking names always use an ACME issuer.
Also fix a bug where HTTPPort and HTTPSPort from the HTTP app weren't
being carried through to ACME issuers properly. It required a bit of
refactoring.
Diffstat (limited to 'modules/caddytls/automation.go')
-rw-r--r-- | modules/caddytls/automation.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/modules/caddytls/automation.go b/modules/caddytls/automation.go index e91811d30..9476445c3 100644 --- a/modules/caddytls/automation.go +++ b/modules/caddytls/automation.go @@ -115,8 +115,8 @@ type AutomationPolicy struct { storage certmagic.Storage } -// provision converts ap into a CertMagic config. -func (ap *AutomationPolicy) provision(tlsApp *TLS) error { +// Provision sets up ap and builds its underlying CertMagic config. +func (ap *AutomationPolicy) Provision(tlsApp *TLS) error { // policy-specific storage implementation if ap.StorageRaw != nil { val, err := tlsApp.ctx.LoadModule(ap, "StorageRaw") @@ -157,8 +157,8 @@ func (ap *AutomationPolicy) provision(tlsApp *TLS) error { // none the subjects do not qualify for a public certificate, // set the issuer to internal so that these names can all // get certificates; critically, we can only do this if an - // issuer is not explictly configured AND if the list of - // subjects is non-empty + // issuer is not explictly configured (IssuerRaw, vs. just + // Issuer) AND if the list of subjects is non-empty if ap.IssuerRaw == nil && len(ap.Subjects) > 0 { var anyPublic bool for _, s := range ap.Subjects { @@ -174,7 +174,7 @@ func (ap *AutomationPolicy) provision(tlsApp *TLS) error { } } - // load and provision the issuer module + // load and provision any explicitly-configured issuer module if ap.IssuerRaw != nil { val, err := tlsApp.ctx.LoadModule(ap, "IssuerRaw") if err != nil { |