in domain dnscheck, also check for hostname of mail server resolving to a loopback ip

nowadays the quickstart will warn about this, but it may be missed/ignored. and
users that installed mox a few versions ago never got the warning. so now we
keep warning about it in the dns check.

based on feedback from Mendel on slack, thanks!
This commit is contained in:
Mechiel Lukkien 2023-07-24 09:23:41 +02:00
parent 2e5376d7eb
commit 840f3afb35
No known key found for this signature in database

View file

@ -536,6 +536,16 @@ func checkDomain(ctx context.Context, resolver dns.Resolver, dialer *net.Dialer,
}
r.IPRev.IPNames[ip] = addrs
}
// Linux machines are often initially set up with a loopback IP for the hostname in
// /etc/hosts, presumably because it isn't known if their external IPs are static.
// For mail servers, they should certainly be static. The quickstart would also
// have warned about this, but could have been missed/ignored.
for _, ip := range ips {
if ip.IsLoopback() {
addf(&r.IPRev.Errors, "Hostname %s resolves to loopback IP %s, this will likely prevent email delivery to local accounts from working. The loopback IP was probably configured in /etc/hosts at system installation time. Replace the loopback IP with your actual external IPs in /etc/hosts.", mox.Conf.Static.HostnameDomain, ip.String())
}
}
}()
// MX