Difference between revisions of "Secure Tunnel Service"

From W9CR
Jump to navigation Jump to search
Line 28: Line 28:
 
  systemctl enable secure-tunnel@keekles.service
 
  systemctl enable secure-tunnel@keekles.service
 
  systemctl status secure-tunnel@keekles.service
 
  systemctl status secure-tunnel@keekles.service
 +
 +
 +
= Connecting to the remote device via the server =
 +
 +
$ ssh bryan@127.0.0.1 -p 34500 -J keekles

Revision as of 03:10, 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]
ExecStart=/usr/bin/ssh -NT -F /etc/default/secure-tunnel.config  %i

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

[Install]
WantedBy=multi-user.target


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

systemctl enable secure-tunnel@keekles.service
systemctl status secure-tunnel@keekles.service


Connecting to the remote device via the server

$ ssh bryan@127.0.0.1 -p 34500 -J keekles