And in addition, if you want to know which service is already listening to a port, you can use: sudo lsof -nP -iTCP:465 -sTCP:LISTEN

On Fri, May 17, 2019 at 9:07 AM Peter Pentchev <roam@ringlet.net> wrote:
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 127.0.0.1:25?
>
> 2019.05.17 13:48:34 LOG5[21]: Service [ssmtp465] accepted connection from ::ffff:192.168.1.76:49170
> 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 127.0.0.1:25
> 2019.05.17 13:48:34 LOG5[21]: Service [ssmtp465] connected remote server from 127.0.0.1:56701
>
> /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 (127.0.0.1).

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

Hope that helps!

G'luck,
Peter

--
Peter Pentchev  roam@{ringlet.net,debian.org,FreeBSD.org} pp@storpool.com
PGP key:        http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint 2EE7 A7A5 17FC 124C F115  C354 651E EFB0 2527 DF13
_______________________________________________
stunnel-users mailing list
stunnel-users@stunnel.org
https://www.stunnel.org/cgi-bin/mailman/listinfo/stunnel-users