Created
November 18, 2022 15:36
-
-
Save nemik/f1746fdff66511e1e153a2ba4be16c66 to your computer and use it in GitHub Desktop.
SSH Tunnel service
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
Host myserver.net | |
User admin | |
HostName myserver.net | |
Host tunneled_server | |
#UserKnownHostsFile /dev/null | |
#StrictHostKeyChecking no | |
ForwardAgent yes | |
HostName localhost | |
Port 9001 | |
ProxyJump myserver.net | |
User someuser | |
LocalForward 0.0.0.0:8888 0.0.0.0:8888 | |
LocalForward 0.0.0.0:8080 0.0.0.0:8080 |
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 nemik.net | |
After=network.target | |
[Service] | |
User=someuser | |
Group=someuser | |
WorkingDirectory=/home/someuser | |
ExecStart=/bin/bash tunnel.sh | |
# Restart every >2 seconds to avoid StartLimitInterval failure | |
RestartSec=5 | |
Restart=always | |
[Install] | |
WantedBy=multi-user.target |
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
#!/bin/bash | |
/usr/bin/ssh -NT -i /home/someuser/.ssh/id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ServerAliveInterval=60 -o ExitOnForwardFailure=yes -R 9001:localhost:22 someuser@myserver.net |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment