Package: stunnel4
Version: 3:5.74-2
Severity: normal

I have a single configured tunnel, very simply

  $ cat /etc/stunnel/jon-znc.conf
  [jon-znc]
  accept = 1234
  connect = 127.0.0.1:1235
  cert = <redacted>
  key  = <redacted>

If I try to start this using the systemd generator, it fails with 
"address already in use"

  # systemctl start [email protected]
  # systemctl status [email protected]
  …
  Aug 18 14:29:46 luv stunnel[1424926]: LOG5[ui]: Binding service [jon-znc] to 
:::1234: Address already in use (98)

There is nothing bound to port 1234. Starting the service by hand works:

  $ sudo /usr/bin/stunnel4 /etc/stunnel/jon-znc.conf
  $ sudo lsof -ni:1234
  COMMAND      PID USER FD   TYPE   DEVICE SIZE/OFF NODE NAME
  stunnel4 1424947 root 9u  IPv4 20106843      0t0  TCP *:1234 (LISTEN)

The host is dual stack.

If I configure the accept to my public IPv4 address, I get past that 
specific error, but inexplicably the server terminates shortly 
afterwards. Note: I'd rather not encode my public IPv4 in this file, but 
I can't see another way to say "bind on IPv4 only":

Aug 18 15:00:06 luv systemd[1]: Started [email protected] - TLS tunnel 
for network daemons - per-config-file service.
Aug 18 15:00:06 luv stunnel[1425647]: LOG5[ui]: stunnel 5.74 on 
aarch64-unknown-linux-gnu platform
Aug 18 15:00:06 luv stunnel[1425647]: LOG5[ui]: Compiled with OpenSSL 3.4.0 22 
Oct 2024
Aug 18 15:00:06 luv stunnel[1425647]: LOG5[ui]: Running  with OpenSSL 3.5.1 1 
Jul 2025
Aug 18 15:00:06 luv stunnel[1425647]: LOG5[ui]: Update OpenSSL shared libraries 
or rebuild stunnel
Aug 18 15:00:06 luv stunnel[1425647]: LOG5[ui]: Threading:PTHREAD 
Sockets:POLL,IPv6,SYSTEMD TLS:ENGINE,OCSP,PSK,SNI Auth:LIBWRAP
Aug 18 15:00:06 luv stunnel[1425647]: LOG5[ui]: Reading configuration from file 
/etc/stunnel/jon-znc.conf
Aug 18 15:00:06 luv stunnel[1425647]: LOG5[ui]: UTF-8 byte order mark not 
detected
Aug 18 15:00:06 luv stunnel[1425647]: LOG5[ui]: FIPS mode disabled
Aug 18 15:00:06 luv stunnel[1425647]: LOG5[ui]: Configuration successful
Aug 18 15:00:06 luv stunnel[1425651]: LOG5[main]: Terminated
Aug 18 15:00:06 luv systemd[1]: [email protected]: Deactivated 
successfully.

Reply via email to