Jails, loopback interfaces and sendmail

Gregory Shapiro gshapiro at freebsd.org
Thu Jun 4 21:21:29 UTC 2009


> If programmers assume 127.0.0.1 is hte one and only loopback it's
> because of two things - 1) this has been done in the very old days
> where people updated the hosts file with uucp to know all hosts in the
> nwetwork and was never updated.  or 2) they are clueless or lazy.

To avoid being labeled clueless or lazy, I'll offer a third option.
The software authors have to support a lot of systems with broken setups
that can't actually resolve 'localhost'.  We (the sendmail authors)
originally had localhost in there but we got so many complaints that we
switched it to 127.0.0.1:

8.12.7/8.12.7   2002/12/29
...
        CONFIG: Use FEATURE(`msp', `[127.0.0.1]') in submit.mc by default
                to avoid problems with hostname resolution for localhost
                which on many systems does not resolve to 127.0.0.1 (or
                ::1 for IPv6).  If you do not use IPv4 but only IPv6 then
                you need to change submit.mc accordingly, see the comment
                in the file itself.


Note that it is only in the configuration file (via cf/feature/msp.m4
and cf/m4/proto.m4).  The source code doesn't contain any references
to 127.0.0.1.  In the case of sendmail, you can change both the client
(adjust parameter to FEATURE(msp) in your submit mc file) or server (use
FEATURE(no_default_msp) and your own DAEMON_OPTIONS() definition in your
MTA mc file) to not assume 127.0.0.1, it is just the default.

In my opinion, assuming 127.0.0.1 will work is much safer than assuming
localhost will resolve.  Hopefully that will change at some point, but
for now, sendmail will stick with the safer assumption.


More information about the freebsd-hackers mailing list