From 8affa12c39c9e877d27e07ed412074cd30369fe9 Mon Sep 17 00:00:00 2001 From: Mechiel Lukkien Date: Tue, 21 Feb 2023 23:06:11 +0100 Subject: [PATCH] prevent panic when starting with a mox.conf that references an ACME provider that isn't configured the error handling code attempts to collect all error messages it encounters, to print them all at the end, so you can fix them all before trying again. so we try to continue preparing the config after an error. in this case, we continued as if acme.Manager was properly set and nil-dereferenced it. for issue #2, from hismailbulut --- mox-/config.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mox-/config.go b/mox-/config.go index 1f15d9c..ffec949 100644 --- a/mox-/config.go +++ b/mox-/config.go @@ -431,10 +431,10 @@ func PrepareStaticConfig(ctx context.Context, configFile string, config *Config, addErrorf("listener %q: unknown ACME provider %q", name, l.TLS.ACME) } - // If only checking, we don't have an acme manager, so set an empty tls config to - // continue without errors. + // If only checking or with missing ACME definition, we don't have an acme manager, + // so set an empty tls config to continue. var tlsconfig *tls.Config - if checkOnly { + if checkOnly || acme.Manager == nil { tlsconfig = &tls.Config{} } else { tlsconfig = acme.Manager.TLSConfig.Clone()