Bug 1294870 - can't send email to domain with mx pointing to cname from ipv6 enabled server
can't send email to domain with mx pointing to cname from ipv6 enabled server
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: sendmail (Show other bugs)
7.2
Unspecified Unspecified
unspecified Severity medium
: rc
: ---
Assigned To: Jaroslav Škarvada
Roman Žilka
: FastFix, Patch
Depends On:
Blocks: 1400961
  Show dependency treegraph
 
Reported: 2015-12-30 14:20 EST by Joe Pruett
Modified: 2017-08-01 08:42 EDT (History)
5 users (show)

See Also:
Fixed In Version: sendmail-8.14.7-5.el7
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-08-01 08:42:36 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
fix sm_gethostby* routines to deal with cnames better (2.01 KB, patch)
2015-12-30 17:37 EST, Joe Pruett
no flags Details | Diff
Backported fix (2.02 KB, patch)
2016-01-04 04:57 EST, Jaroslav Škarvada
no flags Details | Diff

  None (edit)
Description Joe Pruett 2015-12-30 14:20:58 EST
Description of problem:
an ipv6 enabled server running sendmail has trouble sending to sites that have bad dns where their mx record points to a cname. i think it may only crop up with messages that get queued, or perhaps are being relayed from another ipv6 server.

Version-Release number of selected component (if applicable):
sendmail-8.14.7-4.el7.x86_64

How reproducible:
first you have to have a domain with mx pointing to a cname. i don't want to shame the domains i've been having issues with, but it can be easily created in a test environment. make sure server has ipv6 enabled, not sure if explicit ClientPortOptions need to be set for family=inet6, but i do have that as well. try to send email to the broken domain and you should see it get stuck in the queue with an error of "makeconnection: cannot bind socket [IPv6:XXXX::XXXX]: Address family not supported by protocol"

Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:
i have found people seeing this issue back a few years (http://serverfault.com/questions/482035/sendmail-issue-with-ipv6), so it seems to be a pretty old bug. and i see others talking about the underlying issue with gethostbyname and RES_USE_INET6 and cnames causing confusion (https://sourceware.org/bugzilla/show_bug.cgi?id=3425), which seems to be the root cause of this.

debugging sendmail via -d61.99 will show some odd results from the gethostbyname lookup when cnames are involved.

the workaround is to create local mailertable mappings for the broken domains.
Comment 2 Joe Pruett 2015-12-30 17:37 EST
Created attachment 1110655 [details]
fix sm_gethostby* routines to deal with cnames better

i grabbed the latest copy of sendmail and found that it had fixed the problem. i was able to make a smallish patch to fix just this issue in the sm_gethostby* functions. if gethostbyname returns addresses that aren't in the right address family, it rejects them, which then causes higher levels to retry correctly.

i'm attaching the patch, hoping it can go into an official release.
Comment 3 Jaroslav Škarvada 2016-01-04 04:57 EST
Created attachment 1111426 [details]
Backported fix

Thanks for the backported patch. I only changed its header to apply.
Comment 4 Joe Pruett 2016-01-04 11:34:07 EST
how long might it take to show up in an official build?
Comment 5 Jaroslav Škarvada 2016-01-04 12:49:04 EST
(In reply to Joe Pruett from comment #4)
> how long might it take to show up in an official build?

I am unable to say, it depends on PM, QA, and other factors. You can speed the process up by escalation through the support channel. Currently it's ready from the engineering point of view.
Comment 8 Roman Žilka 2017-05-31 10:44:22 EDT
QA: Verified.

********************
******************** sendmail-8.14.7-4.el7 (faulty):
********************

# grep CLIENT_OPTIONS /etc/mail/sendmail.mc
CLIENT_OPTIONS(`Family=inet,Addr=127.0.0.1')dnl
CLIENT_OPTIONS(`Family=inet6,Addr=::1')dnl
# nslookup -type=mx dummydomain.cz
Server:         127.0.0.1
Address:        127.0.0.1#53

dummydomain.cz       mail exchanger = 10 cnamemyself.dummydomain.cz.

# nslookup cnamemyself.dummydomain.cz
Server:         127.0.0.1
Address:        127.0.0.1#53

cnamemyself.dummydomain.cz   canonical name = myself.dummydomain.cz.
Name:   myself.dummydomain.cz
Address: 127.0.0.1

# echo QA|mail root@dummydomain.cz
# sleep 100
# grep dummydomain /var/log/maillog 
May 31 10:08:46 localhost sendmail[11375]: v4VE7PfU011375: to=root@dummydomain.cz, ctladdr=root (0/0), delay=00:01:21, xdelay=00:01:21, mailer=relay, pri=30225, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (v4VE7PQA011376 Message accepted for delivery)
May 31 10:08:46 localhost sendmail[11380]: v4VE7PQA011376: to=<root@dummydomain.cz>, ctladdr=<root@localhost.localdomain> (0/0), delay=00:00:01, xdelay=00:00:00, mailer=esmtp, pri=120543, relay=cnamemyself.dummydomain.cz. [127.0.0.1], dsn=4.0.0, stat=Deferred: Address family not supported by protocol
# mailq
                /var/spool/mqueue (1 request)
-----Q-ID----- --Size-- -----Q-Time----- ------------Sender/Recipient-----------
v4VE7PQA011376        3 Wed May 31 10:08 <root@localhost.localdomain>
                 (makeconnection: cannot bind socket [IPv6:::1]: Address famil)
                                         <root@dummydomain.cz>
                Total requests: 1
# 

********************
******************** sendmail-8.14.7-5.el7 (fixed):
********************

# grep CLIENT_OPTIONS /etc/mail/sendmail.mc
CLIENT_OPTIONS(`Family=inet,Addr=127.0.0.1')dnl
CLIENT_OPTIONS(`Family=inet6,Addr=::1')dnl
# nslookup -type=mx dummydomain.cz
Server:         127.0.0.1
Address:        127.0.0.1#53

dummydomain.cz       mail exchanger = 10 cnamemyself.dummydomain.cz.

# nslookup cnamemyself.dummydomain.cz
Server:         127.0.0.1
Address:        127.0.0.1#53

cnamemyself.dummydomain.cz   canonical name = myself.dummydomain.cz.
Name:   myself.dummydomain.cz
Address: 127.0.0.1

# echo QA|mail root@dummydomain.cz
# sleep 100
# grep dummydomain /var/log/maillog 
May 31 10:01:08 localhost sendmail[11370]: v4VDxmKa011370: to=root@dummydomain.cz, ctladdr=root (0/0), delay=00:01:20, xdelay=00:01:20, mailer=relay, pri=30225, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (v4VDxmdd011371 Message accepted for delivery)
May 31 10:01:08 localhost sendmail[11403]: v4VDxmdd011371: SYSERR(root): cnamemyself.dummydomain.cz. config error: mail loops back to me (MX problem?)
May 31 10:01:08 localhost sendmail[11403]: v4VDxmdd011371: to=<root@dummydomain.cz>, ctladdr=<root@localhost.localdomain> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=120543, relay=cnamemyself.dummydomain.cz. [127.0.0.1], dsn=5.3.5, stat=Local configuration error
# mailq
/var/spool/mqueue is empty
                Total requests: 0
#
Comment 9 errata-xmlrpc 2017-08-01 08:42:36 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:2197

Note You need to log in before you can comment on or make changes to this bug.