From 840f3afb353e476cb1e23e91c11fd7cea7d7692e Mon Sep 17 00:00:00 2001 From: Mechiel Lukkien Date: Mon, 24 Jul 2023 09:23:41 +0200 Subject: [PATCH] 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! --- http/admin.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/http/admin.go b/http/admin.go index ab3a4d4..e5a5052 100644 --- a/http/admin.go +++ b/http/admin.go @@ -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