[SOLVED] sendmail Trying to Connect to Wrong Relay Host
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
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.
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/
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.
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.