Created
November 3, 2017 22:19
-
-
Save alejor/e0d2eec712a31e3fe2323484ebc33312 to your computer and use it in GitHub Desktop.
Remote Tunnel Systemd Unit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Setup a secure tunnel to %I | |
After=network.target | |
[Service] | |
User=root | |
EnvironmentFile=/etc/default/secure-tunnel@%i | |
ExecStart=/usr/bin/ssh -NT -o ServerAliveInterval=60 -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p ${SSH_PORT} -R ${REMOTE_PORT}:localhost:${LOCAL_PORT} ${TARGET} | |
# Restart every >2 seconds to avoid StartLimitInterval failure | |
RestartSec=90 | |
Restart=always | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment