On 17 May 2019, at 5:07 pm, 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
Perfect, that worked - Thanks Peter
(Obvious now that I think of it!)
James.