Now that resolver is used, mail ignores 'mailhost' in /etc/hosts

Neil Rickert rickert at mp.cs.niu.edu
Wed Dec 19 16:37:26 AEST 1990


In article <1990Dec18.234957.29846 at mlb.semi.harris.com> del at 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 at cs.niu.edu>
  Northern Illinois Univ.
  DeKalb, IL 60115                                   +1-815-753-6940



More information about the Comp.unix.questions mailing list