mirror of
https://github.com/mjl-/mox.git
synced 2024-12-26 08:23:48 +03:00
do not try to get a tls cert for autoconfig.<domain> at startup if there is no listener with autoconfig enabled
reduces needless logging in setups that don't use autoconfig.
This commit is contained in:
parent
cbe418ec59
commit
35af7e30a6
1 changed files with 25 additions and 19 deletions
18
http/web.go
18
http/web.go
|
@ -821,14 +821,22 @@ func portServes(l config.Listener) map[int]*serve {
|
||||||
}
|
}
|
||||||
|
|
||||||
if l.TLS != nil && l.TLS.ACME != "" {
|
if l.TLS != nil && l.TLS.ACME != "" {
|
||||||
hosts := map[dns.Domain]struct{}{
|
m := mox.Conf.Static.ACME[l.TLS.ACME].Manager
|
||||||
mox.Conf.Static.HostnameDomain: {},
|
if ensureManagerHosts[m] == nil {
|
||||||
|
ensureManagerHosts[m] = map[dns.Domain]struct{}{}
|
||||||
}
|
}
|
||||||
|
hosts := ensureManagerHosts[m]
|
||||||
|
hosts[mox.Conf.Static.HostnameDomain] = struct{}{}
|
||||||
|
|
||||||
if l.HostnameDomain.ASCII != "" {
|
if l.HostnameDomain.ASCII != "" {
|
||||||
hosts[l.HostnameDomain] = struct{}{}
|
hosts[l.HostnameDomain] = struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// All domains are served on all listeners. Gather autoconfig hostnames to ensure
|
// All domains are served on all listeners. Gather autoconfig hostnames to ensure
|
||||||
// presence of TLS certificates for.
|
// presence of TLS certificates. Fetching a certificate on-demand may be too slow
|
||||||
|
// for the timeouts of clients doing autoconfig.
|
||||||
|
|
||||||
|
if l.AutoconfigHTTPS.Enabled && !l.AutoconfigHTTPS.NonTLS {
|
||||||
for _, name := range mox.Conf.Domains() {
|
for _, name := range mox.Conf.Domains() {
|
||||||
if dom, err := dns.ParseDomain(name); err != nil {
|
if dom, err := dns.ParseDomain(name); err != nil {
|
||||||
pkglog.Errorx("parsing domain from config", err)
|
pkglog.Errorx("parsing domain from config", err)
|
||||||
|
@ -844,9 +852,7 @@ func portServes(l config.Listener) map[int]*serve {
|
||||||
hosts[autoconfdom] = struct{}{}
|
hosts[autoconfdom] = struct{}{}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
m := mox.Conf.Static.ACME[l.TLS.ACME].Manager
|
|
||||||
ensureManagerHosts[m] = hosts
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, srv := range portServe {
|
for _, srv := range portServe {
|
||||||
|
|
Loading…
Reference in a new issue