by denysonique on 9/28/24, 4:09 PM with 86 comments
by xk3 on 9/28/24, 6:21 PM
[Unit]
Description=look ma, no autossh
After=network.target
[Service]
Type=exec
ExecStart=/usr/bin/ssh -o ServerAliveInterval=60 -o ExitOnForwardFailure=yes -Nn -R 7070:localhost:22 pc 'sleep 20m'
Restart=always
RestartSec=20
RuntimeMaxSec=30m
[Install]
WantedBy=default.target
by beagle3 on 9/28/24, 7:04 PM
At this point I configure all of the keep alive and retry options in ssh_config and sshd_config, and use
While true; do ssh user@host ; sleep 10; done
To get the same effect, but with much more flexibility - e.g. alternating connection addresses on a multihomed host, add logging, run from daemontools or systemd unit instead of a loop and let them track the process and restart, etc.by vincentpants on 9/28/24, 5:56 PM
by cperciva on 9/29/24, 5:26 AM
Also, spiped is way simpler and more secure than SSH. (On my servers, I tunnel SSH over spiped, to protect the sshd from attacks.)
by eichin on 9/29/24, 12:13 AM
by paulfharrison on 9/29/24, 1:09 AM
socat TCP4-LISTEN:1234,fork,bind=127.0.0.1 EXEC:'ssh my.remote.server nc 127.0.0.1 1234'
1234 = local/remote port. Can be adapted to use unix sockets at the remote end. my.remote.server = your remote server address.This will set up a tunnel only when needed, and seems to play nicely with my browser.
by botto on 9/28/24, 7:01 PM
by hi-v-rocknroll on 9/28/24, 7:03 PM
In general, when flexibility is possible, such a use-case nowadays would often be better served by deploying WireGuard. Grouchy, out-of-touch corporate net admins probably don't even know what it is and insist on their antiquated Cisco VPNs.
by bashkiddie on 9/28/24, 10:34 PM
I would still recommend it.
by mifydev on 9/28/24, 11:16 PM
by aborsy on 9/28/24, 9:22 PM
You set up public key authentication with SSH to a reverse proxy, a persistent tunnel, and a socks proxy. In a Firefox profile, you set localhost:port. Done! All your services are available in that browser all the time.
Autossh with a reverse ssh tunnel can also be used to expose an internal service to the Internet through a VPS.
SSH has been very secure over the decades. A good feature of SSH is that it can jump from host to host, unlike VPN.
by _davide_ on 9/29/24, 8:46 AM
https://github.com/build-trust/ockam
One binary, easy to use, no ssh getting stuck! (yep, I work at Ockam :)
by isoprophlex on 9/28/24, 6:33 PM
by dheera on 9/28/24, 7:11 PM
autossh -f -N -o ServerAliveCountMax=2 -o ServerAliveInterval=5 -o ConnectTimeout=5 -o BatchMode=yes [...]
by dingi on 9/28/24, 8:25 PM
by sgt on 9/28/24, 6:20 PM
by ndreas on 9/28/24, 6:25 PM
Nowadays I use wireguard an a dedicated SOCKS proxy. The upside is that I can access everything on my home network directly without having to tunnel.
by amelius on 9/28/24, 7:05 PM
by qwertox on 9/28/24, 8:51 PM
by frizlab on 9/28/24, 6:54 PM
ssha () {
while true
do
ssh "$@"
sleep 1
done
true
}
EDIT: Oh I think I know, autossh must be detecting when the connexion is closed but ssh does not automatically…by chasil on 9/28/24, 8:10 PM
It is much more straightforward than ssh for this purpose, and works well with socket activation under systemd.
I use it with the systemd automounter to encrypt NFSv4, and I have found it to be quite reliable.
by leetrout on 9/28/24, 6:35 PM
by jbverschoor on 9/29/24, 2:26 PM
I’ve run autossh for quite some time but it was not reliable enough under my conditions
by pawelduda on 9/28/24, 11:33 PM
by whatever1 on 9/29/24, 5:36 AM
by 89nn on 9/28/24, 11:32 PM
by whalesalad on 9/28/24, 10:02 PM