Bastion hosts
Bastion hosts (jump hosts) let you reach servers behind firewalls or isolated private networks. Bayesian SSH supports both standard jump hosts using TCP port forwarding and interactive bastions requiring dedicated jump shell protocols.
Configure a default bastion
Section titled “Configure a default bastion”When all or most of your servers sit behind the same gateway, configure a default bastion in your global settings:
bssh config --default-bastion bastion.example.com --default-bastion-user jumpNewly added connections inherit these settings automatically:
--default-bastion <HOST>: Gateway host applied to new connections.--default-bastion-user <USER>: Username for the gateway host.
View your current configuration by running bssh config without arguments:
bssh configCurrent settings: Default user: ana Default bastion: bastion.example.com Default bastion user: jump Default port: 22 Use Kerberos by default: NoTo remove the default bastion so that future connections are direct by default, run:
bssh config --clear-bastionSet a bastion on a connection
Section titled “Set a bastion on a connection”You can configure a bastion for a specific host when adding or editing a connection.
Pass -b (or --bastion) and optionally -B (or --bastion-user) when saving a host:
bssh add db-prod 10.0.4.12 -b bastion.example.com -B jumpIf you omit -B, the bastion username defaults to the connection user.
To change or add a bastion on an existing connection:
bssh edit db-prod --bastion bastion.example.com --bastion-user jumpIn the desktop app, open the connection modal by clicking New host or editing an existing host.
Fill in the Jump host field with the bastion address (such as bastion.example.com) and the Jump user field if the bastion login differs from the host login. Saved hosts routed through a bastion display a Jump badge in the host list.
Connect directly without a bastion
Section titled “Connect directly without a bastion”To bypass any configured bastion:
- When adding a host: Pass
--no-bastionto prevent the global default bastion from being assigned:bssh add direct-srv 192.168.1.50 --no-bastion - When editing a host: Remove an existing bastion configuration:
bssh edit db-prod --no-bastion
- When connecting: Bypass the saved bastion for a single session:
bssh connect db-prod --no-bastion
- When importing: Mark every imported host as a direct connection, so none of them uses the default bastion:
bssh import --no-bastion
You can also temporarily override the bastion for a single connection session:
bssh connect db-prod -b temp-bastion.example.com -B jumpHow the route is chosen
Section titled “How the route is chosen”When you initiate a connection, bssh resolves the route using the following hierarchy:
- Session flags: Command-line flags passed to
bssh connect(-b,-B,--no-bastion) take precedence over stored settings. - Saved connection settings: Values stored on the connection record (
bastionandbastion_user). - Global defaults: The
default_bastionanddefault_bastion_userconfigured viabssh configare assigned when adding new connections, unless--no-bastionor an explicit bastion is specified.
Once the route is resolved, bssh chooses the transport mechanism:
- Direct connection: When no bastion is configured and Kerberos is disabled,
bsshconnects directly using its native Rust SSH transport (russh). - Classic jump host: When a bastion is configured and Kerberos is disabled (
use_kerberos: false),bsshdelegates to an OpenSSH subprocess usingProxyCommand(ssh -W %h:%p). This tunnels TCP traffic through the bastion while enforcing your configured host key policies on both hops. - Interactive bastion: When both a bastion and Kerberos are configured (
use_kerberos: true),bsshuses interactive bastion protocol handling.
Interactive bastions
Section titled “Interactive bastions”Some security gateways do not allow TCP forwarding (-W or -J). Instead, they act as application-level gateways (such as OVH “The Bastion” running --osh). Users authenticate to the bastion using Kerberos, and the bastion runs an interactive shell that accepts target_user@target_host as an argument.
Bayesian SSH identifies an interactive bastion whenever a connection has both a bastion configured and Kerberos enabled:
bssh add secure-db 10.0.8.20 -b bastion.example.com -B jump -k trueInteractive shell sessions
Section titled “Interactive shell sessions”When connecting interactively, bssh connects to port 22 on the bastion and passes the destination target as the remote command argument:
ssh -p 22 -- jump@bastion.example.com ana@10.0.8.20The gateway authenticates your Kerberos ticket and drops you into the target host session.
Remote commands and file transfers
Section titled “Remote commands and file transfers”Because interactive bastions reject standard OpenSSH argument relaying and subsystem forwarding:
- Command execution: When running non-interactive commands or directory listings through an interactive bastion,
bsshmanages PTY communication using output markers to separate command output from gateway login banners. - File transfers: Interactive bastions block standard SFTP subsystem channels. When uploading or downloading files,
bsshautomatically detects the interactive gateway and falls back to SCP. For OVH-style gateways,bsshautomatically generates a wrapper script in~/.local/share/bayesian-ssh/scp-wrapper.shthat translates SCP requests into the gateway’s--osh scpprotocol.