Skip to content

Instantly share code, notes, and snippets.

Last active September 30, 2022 12:07
  • Star 9 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Description=AutoSSH service to remotely access signald's unix socket for weechat's (/smsg +145789323231)
# Use this instead if autossh will interact with the local SSH server
# sshd.service
# Set aggressive network timeouts not autossh systemd unit timeouts and also avoid Broken pipe errors.
# After 30 seconds of no server response, Autossh will re-negotiate a new session.
# This assumes SSH version >=2. See
# Set 'ClientAliveInterval 10' in the remote sshd_config so unresponsive SSH clients will be
# disconnected after approx. (10 x ClientAliveCountMax) = 30 seconds
ExecStart=/usr/bin/autossh -M 0 \
-o "ServerAliveInterval 10" \
-o "ServerAliveCountMax 3" \
-o "StreamLocalBindUnlink yes" \
-o "ExitOnForwardFailure yes" \
-L ${SSOCK}:${SSOCK} -N lair2 #sleep 10
# We set 'sleep 10' to make ssh exit in case no TCP connections are forwarded in 10 seconds.
# Useful to get remote shell exit codes.
ExecStop=/usr/bin/kill $MAINPID
ExecReload=/usr/bin/kill -HUP $MAINPID
# On Linux TCP_TIMEWAIT_LEN is not tunable and set to (60*HZ), about 60 seconds. TCP_FIN_TIMEOUT also defauls to 60 seconds.
# See systemd.kill(5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment