Difference between revisions of "Secure Tunnel Service"

From W9CR
Jump to navigation Jump to search
(Created page with "Here's a simple ssh based way setup a remote tunnel to a server. root@retropie:~# cat /etc/systemd/system/secure-tunnel@.service [Unit] Description=Setup a secure tunnel t...")
(No difference)

Revision as of 02:11, 10 January 2025

Here's a simple ssh based way setup a remote tunnel to a server.

root@retropie:~# cat /etc/systemd/system/secure-tunnel@.service
[Unit]
Description=Setup a secure tunnel to %I
After=network.target

[Service]
EnvironmentFile=/etc/default/secure-tunnel@%i
#User=${USER}
ExecStart=/usr/bin/ssh -NT -F /etc/default/secure-tunnel.config  ${TARGET}

# Restart every >2 seconds to avoid StartLimitInterval failure
RestartSec=5
Restart=always

[Install]
WantedBy=multi-user.target

cat /etc/default/secure-tunnel@keekles
USER=emiliano
TARGET=keekles

root@retropie:~# cat /etc/default/secure-tunnel.config
Host keekles
        HostName keekles.org
        User emiliano
        IdentityFile  /home/emiliano/.ssh/id_ed25519
        RemoteForward 34568 127.0.0.1:22
        ServerAliveInterval 60
        ExitOnForwardFailure yes