@marcel91200 / caddy Mirror · read-only / commits / ac96455a
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 13, 09:15 UTC

admin: fix certificate renewal for admin (#5169)

certmagic.New takes a template and returns pointer to the new config. GetConfigForCert later must return a pointer to the new config not the template. fixes #5162

bit committed Nov 23, 2022 at 18:48 UTC ac96455a9a6ac34eb8ea95339838038e725f5bee
1 file changed +4 -2
admin.go
+4 -2
@@ -572,12 +572,13 @@ func replaceRemoteAdminServer(ctx Context, cfg *Config) error {
572 }
573
574 func (ident *IdentityConfig) certmagicConfig(logger *zap.Logger, makeCache bool) *certmagic.Config {
575 + var cmCfg *certmagic.Config
576 if ident == nil {
577 // user might not have configured identity; that's OK, we can still make a
578 // certmagic config, although it'll be mostly useless for remote management
579 ident = new(IdentityConfig)
580 }
580 - cmCfg := &certmagic.Config{
581 + template := certmagic.Config{
582 Storage: DefaultStorage, // do not act as part of a cluster (this is for the server's local identity)
583 Logger: logger,
584 Issuers: ident.issuers,
@@ -589,7 +590,8 @@ func (ident *IdentityConfig) certmagicConfig(logger *zap.Logger, makeCache bool)
590 },
591 })
592 }
592 - return certmagic.New(identityCertCache, *cmCfg)
593 + cmCfg = certmagic.New(identityCertCache, template)
594 + return cmCfg
595 }
596
597 // IdentityCredentials returns this instance's configured, managed identity credentials