image: enable keepalives on the reverse ssh tunnel
authorKristof Provost <kp@FreeBSD.org>
Wed, 26 Feb 2025 20:37:31 +0000 (21:37 +0100)
committerKristof Provost <kp@FreeBSD.org>
Wed, 26 Feb 2025 20:37:31 +0000 (21:37 +0100)
We've seen the reverse ssh connection become unusable after some time.
It's assumed this happens because NAT and/or firewall states along the path
time out as there's no traffic. Explicitly enable both SSH and TCP keepalive
mechanisms to avoid this.

image/overlay/domotica/etc/rc.d/autossh

index cb149bb..e690732 100755 (executable)
@@ -21,6 +21,9 @@ autossh_start()
            "AUTOSSH_POLL=120 AUTOSSH_MAXLIFETIME=28800 \
            autossh -M 0 -p 2207 -N -R ${control_port}:localhost:22 \
            -R ${http_port}:localhost:8123 \
+           -o ServerAliveCountMax=6 \
+           -o ServerAliveInterval=15 \
+           -o TCPKeepAlive=yes \
            -o ExitOnForwardFailure=yes \
            domotica@kosmos.sigsegv.be"
 }