[comp.unix.questions] Now that resolver is used, mail ignores 'mailhost' in /etc/hosts

unhd (Roger Gonzalez ) (11/30/90)

System: Sun 3/160 running SunOS 4.1, *no* YP

I had been having problems getting ftp, telnet, finger, etc. to use the
nameserver.  I received a suggestion to rebuild /usr/lib/libc.so with
the inclusion of some .o's from libresolv.a.  This worked pretty well;
all address resolution was now done through the nameserver.  Unfortunately,
this makes /etc/hosts completely ignored.  Its not *that* intolerable,
but the /etc/hosts contained some convenient nicknames for local machines
that the resolver doesn't know about.  C'est la vie.

Worse, however, is the fact that sendmail no longer knows what 'mailhost'
is.  Outgoing mail is completely dead with regards to non-local sites.
Am I doing something wrong, or are there some changes that I need to make
in sendmail.cf?

thanks,
Roger

-- 
"The question of whether a computer can think is no more interesting
 than the question of whether a submarine can swim" - Edsgar W. Dijkstra 
rg@unhd.unh.edu               |  UNH Marine Systems Engineering Laboratory
r_gonzalez@unhh.bitnet        |  Durham, NH  03824-3525

rbj@uunet.UU.NET (Root Boy Jim) (12/11/90)

In article <1990Nov30.135031.25038@uunet!unhd> rg@unhd.unh.edu (Roger Gonzalez ) writes:
>System: Sun 3/160 running SunOS 4.1, *no* YP

>I had been having problems getting ftp, telnet, finger, etc. to use the
>nameserver.  I received a suggestion to rebuild /usr/lib/libc.so with
>the inclusion of some .o's from libresolv.a.  This worked pretty well;
>all address resolution was now done through the nameserver.  Unfortunately,
>this makes /etc/hosts completely ignored.  Its not *that* intolerable,
>but the /etc/hosts contained some convenient nicknames for local machines
>that the resolver doesn't know about.  C'est la vie.

So add your nicknames to your nameserver database with CNAME records.
The easiest place is in your named.local file. I put things there
because (1) the info never changes (2) this is the one domain that
everyone is an authority for. Purists may groan, as the information
really doesn't "belong" there, but it works.

;
;	@(#)named.local	1.1	(Berkeley)	86/01/21
;
@	IN	SOA	host.do.main postmaster.host.do.main  (
			        901106	; Serial
                                3600	; Refresh
                                300	; Retry
                                3600000	; Expire
                                14400 )	; Minimum
	IN	NS	host.do.main
1	IN	PTR	LOCALHOST.
;
;	*** Add Alises Here *** DON'T FORGET THE DOTS!
;
mailhost.	IN	CNAME	localhost.
loghost.	IN	CNAME	localhost.
-- 

	Root Boy Jim Cottrell <rbj@uunet.uu.net>
	Close the gap of the dark year in between

del@algol.mlb.semi.harris.com (Don Lewis) (12/19/90)

In article <114205@uunet.UU.NET> rbj@uunet.UU.NET (Root Boy Jim) writes:
>In article <1990Nov30.135031.25038@uunet!unhd> rg@unhd.unh.edu (Roger Gonzalez ) writes:
>>System: Sun 3/160 running SunOS 4.1, *no* YP
>
>>I had been having problems getting ftp, telnet, finger, etc. to use the
>>nameserver.  I received a suggestion to rebuild /usr/lib/libc.so with
>>the inclusion of some .o's from libresolv.a.  This worked pretty well;
>>all address resolution was now done through the nameserver.  Unfortunately,
>>this makes /etc/hosts completely ignored.  Its not *that* intolerable,
>>but the /etc/hosts contained some convenient nicknames for local machines
>>that the resolver doesn't know about.  C'est la vie.
>
>So add your nicknames to your nameserver database with CNAME records.
>The easiest place is in your named.local file. I put things there
>because (1) the info never changes (2) this is the one domain that
>everyone is an authority for. Purists may groan, as the information
>really doesn't "belong" there, but it works.

There is also an environment variable "HOSTALIASES" that you can set
to a file name that contains aliases for hosts and the actual host
names.  You could put "mailhost whatever" in a file, and set the
HOSTALIASES variable before starting sendmail.  This feature allows users
to define their own host aliases as well (it'll probabably break things
if users uses these aliases in mail addresses unless the addresses are
somehow canonicalized).  This appears to be undocumented in the Sun
man pages.  I found out about it by looking at the Berkeley code and
doing a strings on Sun's libresolve.a.
--
Don "Truck" Lewis                      Harris Semiconductor
Internet:  del@mlb.semi.harris.com     PO Box 883   MS 62A-028
Phone:     (407) 729-5205              Melbourne, FL  32901

rickert@mp.cs.niu.edu (Neil Rickert) (12/19/90)

In article <1990Dec18.234957.29846@mlb.semi.harris.com> del@algol.mlb.semi.harris.com (Don Lewis) writes:
>
>There is also an environment variable "HOSTALIASES" that you can set
>to a file name that contains aliases for hosts and the actual host
>names.  You could put "mailhost whatever" in a file, and set the
>HOSTALIASES variable before starting sendmail.  This feature allows users
>to define their own host aliases as well (it'll probabably break things
>if users uses these aliases in mail addresses unless the addresses are
>somehow canonicalized).  This appears to be undocumented in the Sun
>man pages.  I found out about it by looking at the Berkeley code and
>doing a strings on Sun's libresolve.a.

 If you are smart you won't even try this.  The ability to do this is a bug.
The IDA sendmail sources, for example, unsetenv('HOSTALIASES') to prevent
this.

 The problem is that it is terribly unreliable.  Mail that comes in over the
network uses the HOSTALIASES set before the daemon was started.  Mail that
is created by a local user depends on the HOSTALIASES set by that user.  But
if the mail can't immediately go out it is queued, and the next try it depends
on the HOSTALIASES of the daemon again.  For UUCP mail the value of
HOSTALIASES will depend on whether the connection was started by cron, by
a remote dial in, or by a local user issuing a 'uucp' command.

 The real secret for 'mailhost' is that the name is encoded right inside
'sendmail.cf'.  Just edit 'sendmail.cf', and change 'mailhost' to the
fully qualified domain name of the mail host.  The rebuild the freeze file
with 'sendmail -bz' (if you use a freeze file).  Finally kill and restart
the sendmail daemon.


-- 
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
  Neil W. Rickert, Computer Science               <rickert@cs.niu.edu>
  Northern Illinois Univ.
  DeKalb, IL 60115                                   +1-815-753-6940

meggers@mothra.nts.uci.edu (Mark Eggers) (12/19/90)

Another way to do this is to set up the domain name system with a
mailhost.domain as a CNAME to the real host.  This seems to work
with Sun 4.0x, and 4.1 running the supplied sendmail stuff (one slight
hack to get it to recognize the fully qualified domain name as local), with
a real sendmail (read sendmail 5.64 - IDA 1.3.4) as the mail host.

/mde/