Re: sendmail error, "MX list for mydomain.com points back to server.mydomain.com"

From: Dan Mahoney (Ports) <freebsd_at_gushi.org>
Date: Fri, 19 May 2023 02:44:21 UTC
Do you see it?  It’s subtle.  

Your system is asking your own 127.0.0.1 DNS for the AAAA for ns.dreamchaser.org (because sendmail attempts ipv6 before it attempts ipv4)

You forgot a trailing . in your NS records.  Your DNS kicks back that “hey, I don’t know about ns.dreamchaser.org” so it gives you an SOA record. (answer = 0, authority = 1)

is doing lookups for ns.dreamchaser.org.dreamchaser.org because of that.

Post your zone file?

Also, pro tip, If you say “I’m running this query and everything comes back as expected” please do include the OUTPUT of those queries.  You don’t know what you’re looking for.

Here’s what I think it happening:  (Have a reference here: https://docstore.mik.ua/orelly/other/Sendmail_3rd/1565928393_sendmail3-chp-9-sect-2.html)

Your system is looking at its own rdns/fdns, and discovering that its hostname is ns.dreamchaser.org.dreamchaser.org (probably because your primary IP is not present in /etc/hosts).  It attempts to deliver to itself, and finds that mail SHOULD come to it (since your misconfiguration says your MX is ns.dreamchaser.org.dreamchaser.org AND that’s what you resolve to, but ns.dreamchaser.org.dreamchaser.org isn’t in /etc/mail/local-host-names.

Recommendations:

* Put your primary addresses in /etc/hosts — there are numerous documented cases of sendmail ignoring /etc/hosts but it *might* help clue it in to your proper hostname at least.
* Fix your forward and reverse DNS
* (and in fact, stop faking it out.  Fix it at your hosting provider.  if your hosting provider is taking this long, find another one)

-Dan

> On May 18, 2023, at 6:36 PM, vagabond <vagabond@blackfoot.net> wrote:
> 
> I turned a bunch of debug flags on and ran sendmail in the foreground,
> and I see the following output:
> 
> sm_gethostbyname(ns.dreamchaser.org, 28)...
> ;; res_nquerydomain(ns.dreamchaser.org, <Nil>, 1, 28)
> ;; res_query(ns.dreamchaser.org, 1, 28)
> ;; res_nmkquery(QUERY, ns.dreamchaser.org, IN, AAAA)
> ;; res_send()
> ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 19039
> ;; flags: rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
> ;;      ns.dreamchaser.org, type = AAAA, class = IN
> ;; Querying server (# 1) address = 127.0.0.1
> ;; new DG socket
> ;; got answer:
> ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 19039
> ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
> ;;      ns.dreamchaser.org, type = AAAA, class = IN
> dreamchaser.org.        10M IN SOA      ns.dreamchaser.org. root.dreamchaser.org. (
>                                        2023051708      ; serial
>                                        4H              ; refresh
>                                        1H              ; retry
>                                        1H              ; expiry
>                                        10M )           ; minimum
> 
> ;; rcode = (NOERROR), counts = an:0 ns:1 ar:0
> ;; res_nquerydomain(ns.dreamchaser.org, dreamchaser.org, 1, 28)
> ;; res_query(ns.dreamchaser.org.dreamchaser.org, 1, 28)
> ;; res_nmkquery(QUERY, ns.dreamchaser.org.dreamchaser.org, IN, AAAA)
> ;; res_send()
> ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 45481
> ;; flags: rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
> ;;      ns.dreamchaser.org.dreamchaser.org, type = AAAA, class = IN
> ;; Querying server (# 1) address = 127.0.0.1
> ;; new DG socket
> ;; got answer:
> ;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 45481
> 
> It's not clear to me what's going on; I don't see any of those function
> calls like res_nquerydomain in the code.
> Can someone tell me what those are?
> 
> And does the above point a finger anywhere in particular?
> 
> hostname is "ns.dreamchaser.org", set in rc.conf
> 
> dig @127.0.0.1 ns.dreamchaser.org
> dig ns.dreamchaser.org
> nslookup dreamchaser.org
> nslookup ns.dreamchaser.org
> 
> all successfully return the appropriate ip.
> 
> Thanks,
> 
> Gary