[Bug 271735] mail/sendmail chokes when MX and NS are on same system

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 30 May 2023 20:12:27 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=271735

            Bug ID: 271735
           Summary: mail/sendmail chokes when MX and NS are on same system
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: dinoex@FreeBSD.org
          Reporter: freebsd@dreamchaser.org
          Assignee: dinoex@FreeBSD.org
             Flags: maintainer-feedback?(dinoex@FreeBSD.org)

Created attachment 242504
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=242504&action=edit
tar file with Notes_sendmail_New_12_4.txt and setup_sendmail_bug.sh

If a system is the primary nameserver and the MX host for a domain, sendmail
chokes and refuses to deliver mail with the message

"MX list for <domain> points back to <nameserver>.<domain>"

This is a regression from the sendmail which came stock with the 12.3 release;
it began appearing after an upgrade.  It is present with the stock sendmail
(8.16.1) and the ports version (8.17.1)

I believe this happens whether IPv6 is enabled or not; I run IPv4 only.

When sendmail is started as:
  sendmail -d0.8 -d8.99 -v -X /var/log/sendmail_debug.log -L sm_dbg -bD
before processing any requests, sendmail attempts to do an AAAA lookup of
ns.domain.com.domain.com.  I'm not sure if this is the root of the problem or
not.

This was tested on a virgin 12.4-RELEASE system with bind918 package installed
and the sendmail installed with the system.

named was configured as the primary nameserver for fake-domain.com, and
/etc/hosts, /etc/resolv.conf, and rc.conf were configured accordingly.

Two files are attached:

Notes_sendmail_New_12_4.txt
setup_sendmail_bug.sh

The contents of setup_sendmail_bug.sh are included in
Notes_sendmail_New_12_4.txt

To reproduce:

1. Bring up a fresh 12.4-RELEASE, configured as indicated in
Notes_sendmail_New_12_4.txt:
  Hostname:  ns.fake-domain.com
  Additional things to install: (not sure if these are necessary)
    ports
    src tree
  GPT partition scheme, use whole disk
  IPv4 activated
    DHCP network assignment
  IPv6 not activated
  Resolver - ok as is for initial start, needed to get bind918
  UTC -- no, US mountain west
  Other services: none
  Hardening options: none
  additional account:
    user1 UserOne

2. Install bind918 package
3. rndc-confgen -a
4. copy over setup_sendmail_bug.sh and execute it
5. service sendmail stop
6. unplug network cable (not strictly necessary)
7. service named start
8. sendmail -d0.8 -d8.99 -v -X /var/log/sendmail_debug.log -L sm_dbg -bD
   note the initial queries for ns.fake-domain.com.fake-domain.com
9. log in on another vty as user1
10.  mail -s 'user1 to user1' user1
user1 to user1
.
11.  mail -s 'user1 to user1@localhost' user1@localhost
user1 to user1@localhost
.
12.  mail -s 'user1 to user1@fake-domain.com' user1@fake-domain.com
user1 to user1@fake-domain.com
.
13. view /var/mail/user1
      observe that the first two messages are delivered fine;
      but the third fails because of the "MX list for fake-domain.com points
back to ns.fake-domain.com" error.
14. The error should also be output on the original root login terminal.

-- 
You are receiving this mail because:
You are the assignee for the bug.