Authorized Bastions and Tunnels
Quick answer
A bastion is an approved intermediary for reaching a managed host. SSH forwarding can carry a specific permitted application connection inside SSH; it does not replace authorization or network policy.
Prepare the practice environment
Run python3 lab-fixtures/ssh-transfer/setup.py from the extracted package root as an ordinary user. Enter the printed private path and check pwd. Use a fresh fixture and Bash with LC_ALL=C and pipefail. Only local rsync and synthetic files are tested here. For manual SSH examples use an isolated authorized VM network, snapshot, console access, provisioned learner account and independently verified host keys; see the lab guide. Never use real credentials or external hosts.
How it works
With ProxyJump the client uses the jump host to reach the final SSH server. Verify both host identities and authorize both connections. A local forward binds a client-side listener and requests a connection from the SSH server to a named destination. Use loopback binding for a private lab, and understand that any local process with access to that listener may use it. Server forwarding policy may deny the request. The connection from the SSH server to the application is a separate leg and may need its own TLS. ExitOnForwardFailure detects setup failures, not all later application connection failures.
In the fictional lab, distinguish an established SSH session, an approved listener and a successful application response. Even when the first two are present, the destination application may be stopped or the server may reject a particular forwarded connection. A local listener is not proof of end-to-end authorization or TLS protection. Test only the explicitly approved lab application, and confirm the listener is closed after the task.
Try the examples
This diagram is text, not a live network or tunnel.
Expected stdout:
client -> bastion -> managed hostclient loopback -> SSH -> approved appssh -G -F ./ssh_config.sample lab-target.example | grep "^proxyjump "VM only; inspect the configuration without connecting. Both VM host keys must be verified before an actual connection.
Manual example; not executed locally. Follow its stated environment restrictions.
This sample is not activated. The first endpoint is local to the client and the second is loopback on the SSH server. Use only a permitted VM application; stop and close the tunnel after the authorized task.
Expected stdout:
LocalForward 127.0.0.1:18080 127.0.0.1:8080Common mistakes
Never use tunnels to bypass organizational access controls, expose a listener broadly without authorization, or assume a bastion makes agent forwarding safe.
Practice
Draw the client, bastion, final server and approved application. Label host verification, each authorization boundary and where the listener would bind. Explain how to close access after the lab.
Related references
Study: ssh. These are reference names, not deployed links.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Authorized bastions and tunnels — Knowledge Check
Apply SSH trust and transfer concepts to synthetic fixtures and VM-only scenarios.
What is a bastion?
Where does a local forward listen?
What does loopback binding restrict?
Does ExitOnForwardFailure prove the app is reachable later?