SSH jump host for devices behind NAT
A jump host, or bastion, is a machine you can reach that can reach the machine you want. That is the catch: it only helps if the jump host has a path to the target. A device behind NAT has none, until the device builds one itself.
What a jump host does, and where it stops
ssh -J (ProxyJump) logs in to the jump host and asks it to open a
TCP connection to the target. Your SSH session to the target runs inside that
connection, and the jump host only passes bytes along. Use it instead of agent
forwarding, which makes your keys usable from the jump host.
ssh -J admin@jump.example.com pi@10.0.0.20
That works when the jump host sits in the same network as the target, such as a bastion in a cloud network or a server in the office, and the target has an address the jump host can reach. It does not work when the target is in a home, a customer's site or on a mobile link. The jump host cannot open a connection into a network behind NAT any more than your laptop can. See SSH NAT traversal for why.
Options when the device is behind NAT
A jump host plus a reverse tunnel from each device
The device runs ssh -R to the jump host, which listens on a port
that leads back to the device's sshd. Then the jump host does have a path, and
ProxyJump can use it. With the tunnel bound to the jump host's loopback
address, for example -R 127.0.0.1:22022:localhost:22, add this to
~/.ssh/config on your laptop:
Host pump-07
HostName localhost
Port 22022
User pi
ProxyJump admin@jump.example.com
HostKeyAlias pump-07
The ssh_config generator writes this block for your own names and ports, in your browser.
To compare a host key with the fingerprint you were given before you trust it,
the
SSH key fingerprint checker reads a
key or a known_hosts line in your browser and shows its SHA256
fingerprint.
localhost is resolved on the jump host, so it means the tunnel.
known_hosts records the host as [localhost]:22022,
so a port reused for another device gives a host key warning, or hides a real
change. HostKeyAlias gives each device its own entry.
If ssh already shows a changed-key warning, see what to do about it.
This is a good answer for one or two machines when you already run the server. What it takes on: the server to patch and pay for, a port per device and a record of which is which, keys on the jump host for everyone who needs access, and a tunnel that must be kept alive on every device. See why autossh tunnels drop. If the jump host is down, every device behind it is out of reach. When someone leaves, see revoking their access.
A VPN you run yourself, or a mesh
Joining the device to a network makes it reachable by address, so a jump host is no longer needed. It gives you more than a shell: any port, any protocol. It also puts the device on a network you have to design and look after, and the people who own the site have to agree to that. The three-way comparison is in reverse SSH vs a VPN mesh vs a hosted relay.
A hosted relay
The device keeps one outbound HTTPS connection to a relay that someone else runs, and your shell is joined to it there. There is no jump host to keep running and no port per device. The relay becomes the dependency.
RescueShell: the jump host as a service
An agent on the device holds one outbound HTTPS connection to our relay. You pick the device by name, in the browser or the CLI, and the session goes to the device's own OpenSSH server, which checks an SSH key from the device's own list of trusted keys. Our servers cannot add a key to that list.
1. Check the device
A shell is a session on the device's own OpenSSH server, so it needs one
running, with your key in an account's ~/.ssh/authorized_keys.
The installer copies the trusted keys from there. Check the rest:
uname -m
openssl version
command -v curl
It needs Linux on amd64, arm64, armv7 or armv6, and curl or wget. Any other
CPU stops with unsupported CPU. The release signature is checked
with OpenSSL 3; without it, pass --sha256. Dropbear is not
supported. For a device with no OpenSSH, see
install without OpenSSH.
2. Install
In the web app, open Devices, press Add device, name it and press Create pass. Then run this on the device as root, over SSH or at its console:
curl -fsSL https://releases.rescueshell.com/latest/install.sh | sh -s -- \
--base-url https://releases.rescueshell.com/latest --relay https://app.rescueshell.com \
--name pump-07 --trust-keys-from pi
Change pi to the account whose keys you log in with, and
pump-07 to a name for the device. The installer lists each key it
will trust by fingerprint and asks you to confirm, then asks
Registration pass or token:. Paste the pass; nothing shows as you
do. It ends with a host key: line. Keep it, because the browser
asks for it the first time you open a shell. See
add a device for the other options.
3. Open a shell
When the device shows as connected under Devices, open a
shell from the browser, or run rescueshell in your terminal and
pick the device and an account. See the CLI. The CLI
uses your own SSH key and checks the device's host key for you.
What it does not do
-
It is a shell on one device, one open shell at a time. Port forwarding
through a session is off, so it is not a way to reach other machines on the
device's network, and you cannot use it as
ProxyJumpto them. A bastion in front of a LAN, or a mesh, does that. -
It is not a plain
sshcommand with a hostname. You use the web app or the CLI. - Traffic always goes through the relay. It is a dependency: if it is unreachable you cannot open a shell, and we offer no uptime SLA.
- OpenSSH only, on Linux.
- The device needs outbound TCP 443 and WebSocket allowed. A network where web traffic only leaves through an HTTP proxy does not work. See what to ask the IT team.
How to choose
-
Machines that all sit in a network you control: a jump host with
ssh -J. - One or two devices behind NAT and a server you already run: a reverse tunnel, with the config above.
- You need ports and protocols, not a shell: a VPN or mesh.
- A shell on devices in other people's networks, without a server to look after: a hosted relay.
If the shell does not open, see the shell does not open.
Try it on one device
The first device is free to try with no card, for 30 days from when it connects, not from when you sign up. Start a trial.