[stunnel-users] need to restart stunnel if stunnel starts before network?

Zhang Weiwu zhangweiwu at realss.com
Sat Jan 23 03:30:56 CET 2010

Zhang Weiwu 写道:
> However these days through the use of NetworkManager, the network
> interfaces are often not brought up when stunnel started as a system
> service. Instead, the network interfaces are brought up by users, in
> case of wifi or wan, after user typed password. I found I have to first
> start network interfaces, and run
> /etc/init.d/stunnel restart
Now I can answer my own question after a few days of research on this issue.

When stunnel starts, loopback is available, so stunnel should be able to
listen. But the Internet connection is not available, so it do not know
which host to connect to when a connection is heard, because it cannot
resolve the remote host name. Ordinary user like me might as well expect
stunnel would resolve the remote host name when it want to establish a
connection, but it is not the case. Stunnel resolve the remote host name
right when it is started, which is always a failure because Internet
connection managed by network manager is only available after user
logged in.

So for user to workaround this problem, I should quote the IP address of
the remote host instead of domain name, in stunnel.conf. I should always
be aware I should update my configuration when the IP address of the
remote host changes. I should also be aware if the IP address of remote
host is changed after I started stunnel, stunnel would not be able to
detect the change, because it resolves domain when starting not when
needing connection like most other software.

For developer how do you think make stunnel resolving the domain when
establishing connection?


More information about the stunnel-users mailing list