Operating System - HP-UX
1748265 Members
3838 Online
108760 Solutions
New Discussion юеВ

Re: sendmail using dns and /etc/hosts

 
Phua Cheng Ching
Occasional Contributor

sendmail using dns and /etc/hosts

I need to send mail to mailservers whose MX records can be resolved
by DNS and some which are not. Those which are not , i have configured
the FQDN in the /etc/hosts .


I have amended the nsswitch.conf as follow :

hosts files [NotFound=continue] dns

However the sendmail seems to always query the DNS first when i attempt
to send to mailservers with domain name in etc/hosts. The sendmail will eventually
go thru after some timeout from the DNS query.

I am a newbie in this area. Please help to advice on how i can configure
the sendmail in such a scenario, so as to minimize the time for delivery

thanks

regards
7 REPLIES 7
Jeff Schussele
Honored Contributor

Re: sendmail using dns and /etc/hosts

Hi Phua,

Sendmail has increasingly "hardened" in recent times & rightfully so.
By default it will always resolve forwards & backwards via DNS. So no-MX sites will be problematic. I'm not so sure this is a bad thing. I say live with the *delay* & encourage your destination domains to register MX records.

My 2 cents,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Fabrice Meynard
Frequent Advisor

Re: sendmail using dns and /etc/hosts

Hello,

I already had the same problem. The only solution I had at this time was to modify in /etc/nsswitch.conf the line :
hosts: files dns
No options between files and dns.

Fabrice
Christopher Caldwell
Honored Contributor

Re: sendmail using dns and /etc/hosts

Leave it all in DNS and set the
TryNullMXList
option (should be the default on stock HP sendmail):

# Try hosts with no MX records (option TryNullMXList): #
# #
# Sendmail always tries to lookup MX records for the destination host #
# and deliver to the Mail Exchanger with the best precedence (lowest #
# number). If there are no MX records listed for the host or we are #
# the best Mail Exchanger in the list (lowest number), then we have a #
# "null MX list". In such a case, sendmail will report a configuration #
# error unless the option "TryNullMXList" is set. If this option is set #
# then sendmail will try to deliver directly to the destination host. #
# To disable this feature and have sendmail just return the mail with an #
# error, comment out the line: #
# #
# O TryNullMXList
Phua Cheng Ching
Occasional Contributor

Re: sendmail using dns and /etc/hosts

I am currently working on mmsc service whereby delay is crucial . There are some partners who do not use DNS, hence we cannot resolve their Mx records thru DNS.


while brousing for sendmail() over the web, there are no clear indication on how this can be implemented. There are instructions of
using hosts files "only" , but not when used with DNS.

Hello Christopher ,

I do not quite get what you mean , with this parameter, does it attempt to look at the host file first then at the DNS.

Jeff Schussele
Honored Contributor

Re: sendmail using dns and /etc/hosts

Hi (again) Phua,

No, what he means is that IF the destination does NOT have an MX record, then the system would return the mail to sender with an error IF

O TryNullMXList=T

is commented out.
If it's not commented it WILL attempt to deliver directly to the specified host.
BUT this will not avoid the delay CAUSED by the destination domain not having an MX record. THAT'S the root of this problem. Sendmail is STILL going to check & I would NOT subvert that check for any reason. You'll quickly become the spammers favorite relay of choice in no time flat.

Are they aware that the sendmail RFC specifically states that domains that wish to send/receive mail on the Internet MUST have MX records, have a postmaster designated to receive mail addressed to such & all the other *requirements* that the RFC spells out?

I think that IF they need the mail that quick they ought to take the proper, required steps on their end to solve the problem THEY are causing.

You can change the lookup order in /etc/nsswitch.conf to files THEN DNS, but I don't think that's going to solve the delay.

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Steven E. Protter
Exalted Contributor

Re: sendmail using dns and /etc/hosts

aol actually resolves the fully qualified domain name of the sender, before it accepts mail.

yahoo accepts the mail but won't deliver it if the dns lookup doesn't work.

To properly have mail get delivered, you need to be dns first.

If you have a corporate stmp or mail realy box, the DS[IP addy of that server] in /etc/sendmail.cf maybe its /etc/mail/sendmail.cf Linux/HP-UX brain lock.

you can get your mail to go, but before I got ANY mail off my HP-Ux boxes, I had to be DNS first on /etc/nsswitch.conf

Steve
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
W.C. Epperson
Trusted Contributor

Re: sendmail using dns and /etc/hosts

Jeff:
I don't know about the "sendmail" RFC, but the SMTP RFC (2821) says: "In other words, names that can be resolved to MX RRs or A RRs (as discussed in section 5) are permitted, as are CNAME RRs whose targets can be resolved, in turn, to MX or A RRs."

Could you elaborate on the requirement for MX for Internet mail delivery?

"I have great faith in fools; self-confidence, my friends call it." --Poe