LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-09-2016, 03:29 PM   #1
wmakowski
Member
 
Registered: Oct 2003
Location: Ohio
Distribution: Fedora 25, 26, RHL 5.2
Posts: 560

Rep: Reputation: 56
sendmail Trying to Connect to Wrong Relay Host


I'm running into a problem with sendmail connecting to the correct SMART_HOST. Based on debug information and mailer logs it looks like sendmail is adding a . to the end of localhost.localdomain making it try and resolve localhost.localdomain. instead of just localhost.localdomain

Here is a sample log entry from journalctl. Notice the extra . after localhost.localdomain. and how it actually resolves to 198.105.254.130.
Code:
sendmail[8677]: u79DgHUq005945: makeconnection (localhost.localdomain. [198.105.254.130]) failed: Connection timed out
Here is some output from the mailer log.
Code:
08522 >>>    ----- Transcript of session follows -----
08522 >>> <wfm692@hotmail.com>... Deferred: Connection timed out with localhost.localdomain.
08522 >>> Warning: message still undelivered after 4 hours
08522 >>> Will keep trying until message is 5 days old
My sendmail.mc has the following entries...
Code:
    define(`SMART_HOST', `[localhost.localdomain]')dnl 
    define(`RELAY_MAILER_ARGS', `TCP $h 10025')dnl 
    define(`ESMTP_MAILER_ARGS', `TCP $h 10025')dnl      
    FEATURE(`authinfo', `hash /etc/mail/authinfo.db')dnl
Yes, I have used m4 to create my sendmail.cf. This configuration normally allows me to create a SSL connection to port 465 on an AT&T smtp server via stunnel and authenticate to send email.

/etc/hosts looks good to me
Code:
127.0.0.1		localhost.localdomain localhost
::1		localhost6.localdomain6 localhost6
This has been working for around 5+ years. I actually wrote a wiki article on how to do it at https://fedoraproject.org/wiki/Confi...ient_for_SMTPs

Thanks for taking a look. Any suggestions or questions are welcome.

Bill
 
Old 08-09-2016, 03:57 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Does your nsswitch.conf point to files before dns (or nis etc...)?

Is DNS (or NIS) resolving that IP when you do "host localhost.localdomain" with and without the final dot?

The final dot in DNS usually mans not to append search domains form /etc/resolv.conf but I've never seen this for localhost entries.

This link suggests a similar issue that was resolved so I'm wondering if doing what is suggested here resolves it for you?
https://forums.freebsd.org/threads/49359/
 
Old 08-09-2016, 04:27 PM   #3
wmakowski
Member
 
Registered: Oct 2003
Location: Ohio
Distribution: Fedora 25, 26, RHL 5.2
Posts: 560

Original Poster
Rep: Reputation: 56
nsswitch.conf has this entry.
Code:
hosts:      files mdns4_minimal [NOTFOUND=return] dns myhostname
This is interesting. When using "host localhost.localdomain" I get the following.

Code:
[makowski@frodo ~]$ host localhost.localdomain
localhost.localdomain has address 198.105.254.130
localhost.localdomain has address 198.105.244.130
Host localhost.localdomain not found: 3(NXDOMAIN)
Host localhost.localdomain not found: 3(NXDOMAIN)
However ping or telnet to localhost.localdomain gets my computer which has a different ip. For example I can telnet to port 10025 which stunnel is listening on and hook up with the smtp server through port 465.

I tried the solution mentioned on freebsd.org by adding localhost.localdomain to /etc/mail/local-host-names and the problem persists.

I'm beginning to think this is a sendmail issue. I set up postfix and was able to relay mail that way. However, I would still like to figure out the sendmail bug.
 
Old 08-09-2016, 08:40 PM   #4
wmakowski
Member
 
Registered: Oct 2003
Location: Ohio
Distribution: Fedora 25, 26, RHL 5.2
Posts: 560

Original Poster
Rep: Reputation: 56
Found a solution.

I replaced
Code:
define(`SMART_HOST', `[localhost.localdomain]')dnl
with
Code:
define(`SMART_HOST', `[127.0.0.1]')dnl
in sendmail.mc and regenerated sendmail.cf.

Also created a corresponding entry in authinfo for authentication purposes.

One thing I don't quite understand is why sendmail was using DNS to resolve localhost.localdomain. I was also surprised to see a DNS entry for localhost.localdomain. I'm going to do some research, but if anyone has a quick answer that would be great.
 
Old 08-10-2016, 07:24 AM   #5
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
I've not seen that mdns4_minimal before. Maybe an Ubuntuism?

This link says that is used specifically for .local resolution.
http://askubuntu.com/questions/67718...r-how-to-fix-d
 
Old 08-10-2016, 08:06 PM   #6
wmakowski
Member
 
Registered: Oct 2003
Location: Ohio
Distribution: Fedora 25, 26, RHL 5.2
Posts: 560

Original Poster
Rep: Reputation: 56
I learned more about nss than I bargained for and found some additional information about how sendmail is resolving localhost.localdomain on my system. It turns out this is a DNS entry problem with my ISP's server. After changing over to Google Public DNS the DNS came back with an NXDOMAIN rather than 198.105.254.130. It then used myhostname within nsswitch.conf to return 127.0.0.1. Sendmail is back to working with the original configuration after changing the DNS. One thing I don't understand is why it did not find it with files. I thought files would look in /etc/hosts for a match. Perhaps nss ignores the entry in /etc/hosts and then catches it with myhostname by design. The documentation for nss-myhostname spells out how the localhost and localhost.localdomain are resolved.

MensaWater, mdns4_minimal deals with resolving .local domains in a small network with no DNS installed. For example foo.local might be one host and fubar.local another host. It does not handle localhost.localdomain only .local names. Multicast DNS is yet another way of finding a host. I'm using Fedora and nsswitch.conf comes pre-configured that way. It may even be on your box, try
Code:
getent hosts YOURHOSTNAME.local
If it is there you should get an IP address and .local domainname.

Last edited by wmakowski; 08-11-2016 at 08:28 AM.
 
Old 08-11-2016, 07:08 AM   #7
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by wmakowski View Post
Found a solution.

I replaced
Code:
define(`SMART_HOST', `[localhost.localdomain]')dnl
with
Code:
define(`SMART_HOST', `[127.0.0.1]')dnl
in sendmail.mc and regenerated sendmail.cf.
Looked at /etc/hosts for this entry for localhost.localdomain, or lack of it?
I had hella problems with non-standard editors on my DNS hosts (my boss) would edit this file
believing the hostname should be manipulated there.
Code:
127.0.1.1 localhost.localdomain
on a line by itself I believe fixed our problem.

Just sayin'.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sendmail to use Exchange 2003 (smart host) to relay mail Treikayan Linux - Newbie 1 07-14-2013 08:44 PM
sendmail issue with relay host lensem Linux - Software 3 05-20-2009 05:00 PM
sendmail relay to another host noir911 Linux - Server 3 10-28-2008 08:46 AM
relay mail to sendmail relay server??? lemay_jeff Linux - Newbie 0 07-06-2004 04:54 PM
PostFix with a SendMail Relay Host & SSH Wrappers jgrafals Linux - Software 0 02-13-2004 10:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration