Index:
[thread]
[date]
[author]
[stats]
From: markus schnalke <meillo@marmaro.de>
To : <masqmail@marmaro.de>
Date: Fri, 16 Jul 2010 23:36:27 +0200
Re: [masqmail] 127.0.0.1 vs. localhost (was: What masqmail intends to be)
[2010-07-16 21:56] Juergen Daubert <juergen.daubert@t-online.de>
> On Fri, Jul 16, 2010 at 08:45:42PM +0200, markus schnalke wrote:
> > [2010-07-16 18:20] Juergen Daubert <juergen.daubert@t-online.de>
> > > On Fri, Jul 16, 2010 at 02:26:39PM +0200, markus schnalke wrote:
> > > > [2010-07-16 12:43] Juergen Daubert <juergen.daubert@t-online.de>
> > > > > On Fri, Jul 16, 2010 at 01:05:02AM +0200, markus schnalke wrote:
> > > > > >
> > > > > > Local delivery will be available by default with 0.3.0. Masqmail will
> > > > > > listen on `localhost:25' by default. This would collide with the
> > > > > > --disable-smtp-server option.
> > > > >
> > > > > Oops, what do you mean with by default? It listen to localhost:25 even
> > > > > if not configured to do so in masqmail.conf with listen_addresses?
> > > >
> > > > Yes. I'll introduce this with 0.3.0 (if there isn't one who convinces
> > > > me to not do so). The reason is that there are MUAs that submit mail
> > > > only via SMTP to localhost:25. Pine seems to be an example for that.
> > > > Probably Thunderbird too, if it should use the local MTA. By doing
> > > > this change, we have a convenient basic setup that only requires to
> > > > set host_name in masqmail.conf. This is appealing IMO.
> > >
> > > Hmm, no no no ;) What if I want a setup where masqmail is listening
> > > only on e.g. 192.168.0.1 but not on 127.0.0.1?
> >
> > No problem, set `listen_addresses' to "192.168.0.1:25".
> >
> > I think we've got our wires crossed (in German: ``aneinander vorbei
> > reden'').
>
> Indeed :)
>
> > Everything is still as it was, except:
> > if `listen_addresses' is not included in masqmail.conf, then it is set
> > to "localhost:25".
>
> Now I get it, that's of course a nice. I thought that your idea was
> to always listen at localhost:25 regardless of a listen_addresses
> setting in masqmail.conf.
Good, we're talking the same language again. ;-)
Now about the localhost vs. 127.0.0.1 question.
I investigated:
Wikipedia writes: ``Localhost always translates to the loopback IP
address 127.0.0.1 in IPv4, [...]''. But you cannot trust Wikipedia...
and indeed, I think they are wrong.
I altered my /etc/hosts to have:
127.0.0.1 foo
192.168.0.100 localhost
192.168.0.74 dream.schnalke.local dream
(192.168.0.74 is the IP address of the machine. 192.168.0.100 is some
different machine.)
Ping gets fooled:
$ ping localhost
PING localhost (192.168.0.100) 56(84) bytes of data.
64 bytes from localhost (192.168.0.100): icmp_req=1 ttl=64 time=2.12 ms
^C
Dig does not get fooled:
$ dig +short localhost
127.0.0.1
Host neither:
$ host localhost
localhost.schnalke.local has address 127.0.0.1
The resolvtest test program, that compiles from masqmail's sources
(from 0.3.0 on), does not get fooled neither:
$ ./resolvtest localhost
A:
localhost.schnalke.local 127.0.0.1
MX:
IP resolved directly (assumed FQDN, no default domain added):
127.0.0.1
When I tell masqmail to listen on localhost:25:
$ grep listen_addresses masqmail.conf
listen_addresses = "localhost:25"
it cannot. The log writes:
# tail -2 /var/log/masqmail/masqmail.log
2010-07-16 23:22:00 [11075] masqmail 0.3.0 daemon starting
2010-07-16 23:22:00 [11075] bind: Cannot assign requested address
Although it seems to be very unlikely that some administrator sets
`localhost' to something other than 127.0.0.1, it is more secure to
default to 127.0.0.1. This IP address is defined in RFCs:
- RFC 1700 (page 5):
{127, <any>}
Internal host loopback address. Should never appear outside
a host.
- RFC 3330:
127.0.0.0/8 - This block is assigned for use as the Internet host
loopback address. A datagram sent by a higher level protocol to an
address anywhere within this block should loop back inside the host.
This is ordinarily implemented using only 127.0.0.1/32 for loopback,
but no addresses within this block should ever appear on any network
anywhere [RFC1700, page 5].
In contrast, I found nothing about the `localhost' to 127.0.0.1
mapping.
I'll change the default listen_addresses to "127.0.0.1:25".
meillo
Index:
[thread]
[date]
[author]
[stats]