[stunnel-users] Connection refused, then connects

Peter Pentchev roam at ringlet.net
Fri May 17 09:07:20 CEST 2019

On Fri, May 17, 2019 at 01:54:47PM +1000, James Brown wrote:
> Can anyone tell me why It tries ::1:25 first and fails before connecting to
> 2019.05.17 13:48:34 LOG5[21]: Service [ssmtp465] accepted connection from ::ffff:
> 2019.05.17 13:48:34 LOG3[21]: s_connect: connect ::1:25: Connection refused (61)
> 2019.05.17 13:48:34 LOG5[21]: s_connect: connected
> 2019.05.17 13:48:34 LOG5[21]: Service [ssmtp465] connected remote server from
> /usr/local/etc/stunnel/stunnel.conf has:
> [ssmtp465]
> client = no
> accept  = 465
> connect = 25
> options = NO_SSLv2
> #transparent = source

You have specified only a port number, not an address; thus, stunnel assumes
the local host address. You have not explicitly told it to only use IPv4
addresses, so it tries the IPv6 local host address (::1) first; when that
fails, it falls back to the IPv4 local host address (

If you change the line to "connect =" like for your other
service, it will go straight to the IPv4 local host address.

Hope that helps!


Peter Pentchev  roam@{ringlet.net,debian.org,FreeBSD.org} pp at storpool.com
PGP key:        http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint 2EE7 A7A5 17FC 124C F115  C354 651E EFB0 2527 DF13
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://www.stunnel.org/pipermail/stunnel-users/attachments/20190517/85290de3/attachment.sig>

More information about the stunnel-users mailing list