add ssh-tunnel service and functions

This commit is contained in:
Alexander Navarro 2026-01-29 12:26:43 -03:00
parent 6944ab1e25
commit b3df5795f2
4 changed files with 47 additions and 13 deletions

View file

@ -0,0 +1,10 @@
[Unit]
Description=SSH Persistent port forward for %i, makes available remote port locally
After=network-online.target
Wants=network-online.target
[Service]
EnvironmentFile=%h/.ssh/tunnels.d/%i.conf
ExecStart=/usr/bin/ssh -NT -o ExitOnForwardFailure=yes -o ServerAliveInterval=60 -o ServerAliveCountMax=3 -L ${TUNNEL_LOCAL_ADDRESS}:${TUNNEL_LOCAL_PORT}:${TUNNEL_REMOTE_ADDRESS}:${TUNNEL_REMOTE_PORT} ${TUNNEL_SSH_HOST}
RestartSec=3
Restart=always