Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 14, 05:15 UTC
caddyhttp: Always provision ACME issuers (fix terms agree error)
Matthew Holt committed
Mar 23, 2020 at 12:21 UTC
4c43bf8cc8dbdaa42f3eb1fc7936afdefe3d4bbf
1 file changed
+6
-7
modules/caddyhttp/autohttps.go
+6
-7
@@ -551,7 +551,6 @@ func (app *App) createAutomationPolicies(ctx caddy.Context, publicNames, interna
551
// config values. If any changes are made, acmeIssuer is
552
// reprovisioned. acmeIssuer must not be nil.
553
func (app *App) fillInACMEIssuer(acmeIssuer *caddytls.ACMEIssuer) error {
554
- var anyChanges bool
554
if app.HTTPPort > 0 || app.HTTPSPort > 0 {
555
if acmeIssuer.Challenges == nil {
556
acmeIssuer.Challenges = new(caddytls.ChallengesConfig)
@@ -564,7 +563,6 @@ func (app *App) fillInACMEIssuer(acmeIssuer *caddytls.ACMEIssuer) error {
563
// don't overwrite existing explicit config
564
if acmeIssuer.Challenges.HTTP.AlternatePort == 0 {
565
acmeIssuer.Challenges.HTTP.AlternatePort = app.HTTPPort
567
- anyChanges = true
566
}
567
}
568
if app.HTTPSPort > 0 {
@@ -574,13 +572,14 @@ func (app *App) fillInACMEIssuer(acmeIssuer *caddytls.ACMEIssuer) error {
572
// don't overwrite existing explicit config
573
if acmeIssuer.Challenges.TLSALPN.AlternatePort == 0 {
574
acmeIssuer.Challenges.TLSALPN.AlternatePort = app.HTTPSPort
577
- anyChanges = true
575
}
576
}
580
- if anyChanges {
581
- return acmeIssuer.Provision(app.ctx)
582
- }
583
- return nil
577
+ // we must provision all ACME issuers, even if nothing
578
+ // was changed, because we don't know if they are new
579
+ // and haven't been provisioned yet; if an ACME issuer
580
+ // never gets provisioned, its Agree field stays false,
581
+ // which leads to, um, problems later on
582
+ return acmeIssuer.Provision(app.ctx)
583
}
584
585
// automaticHTTPSPhase2 begins certificate management for