On Fri, Jul 05, 2013 at 04:00:44PM -0400, Wietse Venema wrote:
> Viktor Dukhovni:
> > On Fri, Jul 05, 2013 at 03:46:46PM -0400, Wietse Venema wrote:
> >
> > > To clone the submission service and set "smtpd_tls_auth_only=no"
> > > for connections to 127.0.0.1:
> > >
> > > /etc/postfix/master.cf
> > > 127.0.0.1:submission ...same stuff as ordinary submission service...
> > > ... same stuff as ordinary submission service...
> > > -o smtpd_tls_auth_only=no
> >
> > One may then need to make the default submission entry also specify a
> > specific IP address, as listeners on 0.0.0.0:port exclude listeners on
> > specific addresses on most systems.
>
> That is not needed. The more specific binding to 127.0.0.1 takes
> precedence over the unspecific binding to 0.0.0.0.
Linux forbids bindings to 127.0.0.1 when a wildcard binding exists,
you're probably testing on a FreeBSD system.
linux# showsock() { lsof -n -P -i tcp:12345; }; printf "\nBEGIN\n";
showsock; for ip in 0.0.0.0 127.0.0.1; do printf "\nIP: $ip\n"; strace -e bind
perl -e 'use IO::Socket; my $s = IO::Socket::INET->new(Listen=>1, LocalAddr =>
shift(@ARGV), LocalPort => 12345, Reuse => 1) or die "bind: $!\n";
select(undef, undef, undef, 5);' $ip & sleep 1; done; printf "\nEND\n";
showsock
BEGIN
IP: 0.0.0.0
[1] 19129
bind(3, {sa_family=AF_INET, sin_port=htons(12345),
sin_addr=inet_addr("0.0.0.0")}, 16) = 0
IP: 127.0.0.1
[2] 19132
bind(3, {sa_family=AF_INET, sin_port=htons(12345),
sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EADDRINUSE (Address already in use)
bind: Address already in use
[2]+ Exit 98 strace -e bind perl -e 'use IO::Socket; my $s
= IO::Socket::INET->new(Listen=>1, LocalAddr => shift(@ARGV), LocalPort =>
12345, Reuse => 1) or die "bind: $!\n"; select(undef, undef, undef, 5);' $ip
END
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
perl 19131 root 3u IPv4 35552265 0t0 TCP *:12345 (LISTEN)
--
Viktor.