Operating System - HP-UX
1833017 Members
2172 Online
110048 Solutions
New Discussion

Re: sendmail refuses to relay with no DNS

 
SOLVED
Go to solution
A. Daniel King_1
Super Advisor

sendmail refuses to relay with no DNS

Hi, folks.

sendmail refuses to relay for me. I'm behind a firewall, and I've confirmed that mail can be routed through the SMTP relay. "sendmail -bp" confirms that "(host map: lookup (hostname.com): deferred".

I've checked sendmail.cf, service.switch. There is no nsswitch.conf.

In sendmail.cf I've unremarked:

O ServiceSwitchFile=/etc/mail/service.switch

And added:

DS x.x.x.x

Where x.x.x.x is the IP address. In service.switch, I've removed all references to dns. I've stopped sendmail and restarted it.

Any help would be appreciated! Please let me know if I've not included enough detail.
Command-Line Junkie
11 REPLIES 11
Vincent Fleming
Honored Contributor

Re: sendmail refuses to relay with no DNS

Make sure that the SNMP relay your getting the mail from is in the hosts file.

You can also use your /etc/mail/access file to specify that relaying mail from that host is OK. Just fill out the file like this:

hostname RELAY
1.2.3.4 RELAY

however it works for you.

Then hash it with:

makemap hash /etc/mail/access < /etc/mail/access

and it should allow the relay.

I hope this helps.

Good luck!

No matter where you go, there you are.
someone_4
Honored Contributor

Re: sendmail refuses to relay with no DNS

Hi,
you will need to set your relay in /etc/hosts if you dont want to use dns.

can you ping the relay?
what happends if you do

echo test | sendmail -v someone@yahoo.com


Also check
/etc/nsswitch.conf
and make sure you are using files for hosts.

Richard

A. Daniel King_1
Super Advisor

Re: sendmail refuses to relay with no DNS

Thanks, guys, but this hasn't quite worked yet.

I don't have a nsswitch.conf, and I get the following:

$echo test | sendmail -v someone@yahoo.com
someone@yahoo.com... yahoo.com: Name server timeout
someone@yahoo.com... Transient parse error -- message queued for future delivery
someone@yahoo.com... queued
Command-Line Junkie
someone_4
Honored Contributor

Re: sendmail refuses to relay with no DNS

That tells us that you are trying to resolve yahoo.com though your localhost there. You are not sending to the relay. Lets try a few things.

You already specified that you have the DS set in your sendmail.cf ..
did you restart sendmail after making that change?

/sbin/init.d/sendmail stop
/sbin/init.d/sendmail start

in your DS you have the ip address. Can you ping the ip?
Try the host name of the other server. And have the hostname in /etc/hosts. This wont work unless you have nsswitch copy over nsswitch.conf since you said you didnt have one. Double check that you dont have an nsswitch because we dont want to overwrite it and if you are sure you dont do:

cp /usr/newconfig/etc/nsswitc .files /etc/nsswitch.conf

to copy over nsswitch to read hosts for files. I dont know if the DS macro has to be able to resolv the hostname or even be able to do a reverse lookup. That is why we need to have the relay hosts in /etc/hosts and have nsswitch to point to files.

if that doesnt work do
sendmail -bs
so we know what version we are working with.

Richard






someone_4
Honored Contributor
Solution

Re: sendmail refuses to relay with no DNS

A few more things to check if you read the sendmail.cf for the section that talks about DS.


it tells you that:
Second, you will need to uncomment the line in ruleset 0 following the comment:

# Pass mail to smarthost via uucp

That line looks like this:
# Pass mail to smarthost via uucp. Uncomment only one line.
#Uncomment next line to send mail via UUCP to: @domain!user
#R$* < @ $* > $* $#uucp $@ $S $: $1 < @@ $2 > $3 to uucp relay
#Uncomment next line to send mail via UUCP to: nodename!user%domain
#R$* < @ $* > $* $#uucp $@ $S $: $S ! $1 % $2

you would want to uncomment the 2nd line that says nodename!

Reading the sendmail.cf file it also says " First, set macro S (DS) to the name of the smart relay,"
It does not specify name or ip. I am sure that ip would work I dont see why but it would be best to do the name of the node you are trying to relay to. Sendmail can be funny like that. And in the above post as I said before we need to be able to resolv the nodename to the relay and yo have to set it up in /etc/hosts and have /etc/nsswitch.conf set up to files.

Richard
U.SivaKumar_2
Honored Contributor

Re: sendmail refuses to relay with no DNS

hi,
have you renamed your /etc/resolv.conf with
old DNS configuration ?.

regards,
U.SivaKumar
Innovations are made when conventions are broken
Printaporn_1
Esteemed Contributor

Re: sendmail refuses to relay with no DNS

Hi,

sendmail start from version 8.1.6 need to configure with DNS.
but there are workaround

in sendmail.cf
#Dj$w.Foo.COM
change to
#Dj$w.

and /etc/host

add hostname. to host entry

ip fqdn shortname shortname.

make /etc/nsswitch.conf point to host then DNS.

restart sendmail.
HTH
enjoy any little thing in my life
Dave Chamberlin
Trusted Contributor

Re: sendmail refuses to relay with no DNS

I had a similar problem. I tried tweaking lots of things. The resolv.conf file was removed. In the sendmail.cf I had specified the domain:
Dj$w.mydomain.com

and the "smart" relay host (groupwise here..)
DSmymailhost.mydomain.com

Those were the only changes needed in that file.

In /etc/hosts, I added an entry for the mail relay host. On that host, they had to allow relay permission for my HPUX host, for all users.

The item that seemed to make it work (thanks to HP support folks) was changing the nsswitch.conf file. It originally had:
hosts: files [NOTFOUND=continue] dns [NOTFOUND=continue].
After changing it to just:
hosts: files
It worked.

U.SivaKumar_2
Honored Contributor

Re: sendmail refuses to relay with no DNS

hi,
edit /etc/hosts

206.34.34.12 relay relay.yourdomain.com

edit /etc/sendmail.cf
there will be a line like this.
#O HostsFile=/etc/hosts

uncomment this line.
O HostsFile=/etc/hosts

DSrelay.yourdomain.com

regards,
U.SivaKumar



Innovations are made when conventions are broken
Anu Mathew
Valued Contributor

Re: sendmail refuses to relay with no DNS

Hello,

I too had the same problem trying to use an Exchange as the relay.

1) Please do not leave any white spaces between DS and your relay name. In my case, I've : DSexchange.domain.com

2) If your OS happens to be HP-UX, the service switch file setting will be ignored.

3) In case you have a good DNS with records for almost all critical systems setup (esp. records for your relay, say exchange.domain.com), go ahead and remove any entries for exchange from your /etc/hosts file. Also, at this point, edit your /etc/nsswitch.conf and modify the hosts line as "hosts: files[NOTFOUND=continue TRYAGAIN=continue] dns" . This ensures that as soon as any mail is originated, sendmail looks for exchange, finds it from DNS and passes the buck to him.

I would like to bring your attention that if your DS is configured in, all mails (except local mails) are forwarded to the DS hosts, even if you gave a in-valid email id.

4) In case you dont have a wealthy DNS running, ensure that what you have in the /etc/hosts file is the FQDN (fully qualified domain name) of exchange. Make sure that DS section in sendmail.cf also has the FDQN. ie, in /etc/hosts:

ip.add.re.ss exchange.domain.com.

Or else, just enter exchange's IP at the DS section of sendmail.cf .

Hope this helps,

Thanks,

Anu Mathew
A. Daniel King_1
Super Advisor

Re: sendmail refuses to relay with no DNS

I'm finally up and going. Thanks guys for all your help. The ultimate fix was:

1) There MUST exist /etc/nsswitch.conf and /etc/resolv.conf. The man page for nsswitch.conf says that there is a default, compiled-in file, but this will not do.

2) There MUST be an entry for the SMTP relay host in /etc/hosts.

3) You MUST use the name - and NOT the IP - of the relay host in sendmail.cf's DS macro.

4) You may have to run /usr/newconfig/etc/mail/cf/cf/gen_cf to turn on relaying.

5) Don't forget the start/restart of sendmail.

Your mileage may vary.
Command-Line Junkie