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

From: Dan Mahoney (Ports) <freebsd_at_gushi.org>
Date: Thu, 18 May 2023 03:53:56 UTC
First, don’t obscure your domain when you’re trying to show DNS lookups, it really doesn’t help people trying to help you.  If you need more help and feel shy, feel free to contact me offlist.

Second, the “mail loops back to me” error means something handed you a piece of mail, ostensibly because your system is the lowest MX host, but your system doesn’t know it’s the termination point for it.

What do you have in /etc/mail/local-host-names?  Are you using the stock freebsd.mc or sendmail.mc or whatever came with the system?  The stock file has:

define(`confCW_FILE', `-o /etc/mail/local-host-names’), but in long-ago sendmail this file was called sendmail.cw.

All variants of domains you accept mail for should be in /etc/mail/local-host-names, and if you want to map separately for each domain, you need to set up a virtusertable.

-Dan
(Dayjob: A DNS company you’ve heard of.  Also, been running sendmail in production for 20 years).

> On May 17, 2023, at 8:12 PM, vagabond <vagabond@blackfoot.net> wrote:
> 
>> Do you have a "sendmail -bd" running?
> 
> Yes.
> 
> I tried turning on -d8.10 and got the following output at startup,
> which I can't interpret...
> 
> ;; res_nquerydomain(ns.mydomain.com, <Nil>, 1, 28)
> ;; res_query(ns.mydomain.com, 1, 28)
> ;; res_nmkquery(QUERY, ns.mydomain.com, IN, AAAA)
> ;; res_send()
> ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 31693
> ;; flags: rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
> ;;      ns.mydomain.com, type = AAAA, class = IN
> ;; Querying server (# 1) address = 127.0.0.1
> ;; new DG socket
> ;; got answer:
> ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 31693
> ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
> ;;      ns.mydomain.com, type = AAAA, class = IN
> mydomain.com.        10M IN SOA      ns.mydomain.com. root.mydomain.com. (
>                                        2023051706      ; serial
>                                        4H              ; refresh
>                                        1H              ; retry
>                                        1H              ; expiry
>                                        10M )           ; minimum
> 
> ;; rcode = (NOERROR), counts = an:0 ns:1 ar:0
> ;; res_nquerydomain(ns.mydomain.com, mydomain.com, 1, 28)
> ;; res_query(ns.mydomain.com.mydomain.com, 1, 28)
> ;; res_nmkquery(QUERY, ns.mydomain.com.mydomain.com, IN, AAAA)
> ;; res_send()
> ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 44741
> ;; flags: rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
> ;;      ns.mydomain.com.mydomain.com, type = AAAA, class = IN
> ;; Querying server (# 1) address = 127.0.0.1
> ;; new DG socket
> ;; got answer:
> ;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 44741
> ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
> ;;      ns.mydomain.com.mydomain.com, type = AAAA, class = IN
> mydomain.com.        10M IN SOA      ns.mydomain.com. root.mydomain.com. (
>                                        2023051706      ; serial
>                                        4H              ; refresh
>                                        1H              ; retry
>                                        1H              ; expiry
>                                        10M )           ; minimum
> 
> ;; rcode = (NXDOMAIN), counts = an:0 ns:1 ar:0
> res_nsearch failed (-1)
> _res.options = 800012c3, HasWildcardMX = 0
> 
> I don't understand the 0 answers and NXDOMAIN at all
> It's not clear to me where all that is coming from, as strings like res_send()
> don't seem to appear in the source.
> 
> Also, that only prints at startup; apparently it doesn't go through the domain.c code
> for delivery to a localhost, even though I get that error message back.
> 
> Can anyone tell me / point me to how to build sendmail from the code in
> /usr/src/contrib/sendmail ?
> 
> Thanks,
> 
> Gary
>