Help › Tunnels, sign-in and passwords

Reach a database through SSH

Connect through one or several SSH hosts with an agent, a key file or a password, or take the route from your SSH config.

Querlyn 0.1.0 is not released yet. This help describes it ahead of release.

Many databases accept connections only from inside their own network. If you can reach a machine in that network over SSH (a bastion or jump host), Querlyn can connect through it, or through a chain of several.

Querlyn makes the SSH connection itself. It does not open a port on your computer for it, and you do not start ssh yourself. When the first SSH host can only be reached through another program, Querlyn runs that program for you; see Reach the first host through a command.

Connect through one SSH host

  1. In the connection dialog, enter the database's Host and Port as they are seen from the SSH host: the address the bastion would use. If the database runs on the bastion itself, that is localhost.

  2. Under Route, choose SSH, then Add Hop.

  3. Fill in the hop:

    FieldWhat to enter
    SSH hostThe bastion's address, as seen from your computer.
    PortThe SSH port, usually 22.
    SSH userYour user name on the bastion.
  4. Choose how you sign in to it: SSH Agent, Key File or Password. See Sign in to a hop.

  5. Choose Test Connection. The test lists the SSH steps of each hop and then the database's.

The first time you connect to an SSH host, Querlyn asks whether you trust its key; see Trust an SSH host's key.

Connect through several hosts

Choose Add Hop (Command Palette › Database: Add SSH Hop) once for each host on the way, in the order you pass through them. The dialog titles them "Hop 1 (from this computer)", "Hop 2 (through hop 1)" and so on, and says how many there are. Use the ↑ and ↓ buttons of a hop to change the order and Remove to take one out.

Each hop has its own user and its own way of signing in. There is no limit on the number of hops. The database's host name is looked up by the last hop.

Reach the first host through a command

Some SSH hosts are not reached over the network directly but through a program: another ssh, AWS Systems Manager, Cloudflare Access, or a SOCKS proxy. OpenSSH calls this a ProxyCommand. Querlyn runs the program and speaks SSH through its input and output, so nothing listens on a port of your computer.

  1. In Hop 1 (from this computer), under How Querlyn reaches this SSH host, choose Through a Command.

  2. Under Command, enter the command as you would in ~/.ssh/config. These parts are filled in when connecting:

    TokenBecomes
    %hThe hop's SSH host.
    %pThe hop's Port.
    %rThe hop's SSH user.
    %nThe host's name in your SSH config, or the SSH host.
    %%A percent sign.
  3. Fill in the SSH host, Port and SSH user as usual. The host key is checked against that host and port, as for any hop.

Some commands that are often used:

To reach the host throughCommand
Another SSH hostssh -W %h:%p jump.example.com
AWS Systems Manager (the host is an instance ID)aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters portNumber=%p
Cloudflare Accesscloudflared access ssh --hostname %h
A SOCKS proxync -X 5 -x proxy.example.com:1080 %h %p

Querlyn looks for the program the way it looks for its other tools: the path set under Tools in Settings for the programs listed there (Querlyn › Open Settings), then the places programs are usually installed. You can also write the program's full path. A command that uses shell syntax (quotes, $VARIABLE, ~, a pipe) runs through the standard shell: /bin/sh on a Mac, cmd.exe on Windows.

Test Connection shows "Start proxy command" before the SSH steps. If the program stops before the SSH connection is made, the test says so and shows what it printed under the technical details. The program runs as long as the connection uses the SSH host and is stopped when you disconnect, when the SSH session closes after five idle minutes, and when you quit Querlyn.

Only the first hop can be reached through a command: every later hop is reached through the one before it. A host name or user that contains characters a shell could act on (spaces, quotes, ;, $) is refused rather than put into the command.

Sign in to a hop

ChoiceWhat Querlyn uses
SSH AgentThe keys your SSH agent holds. Nothing is stored in Querlyn.
Key FileThe private key at the path under Private key file, for example ~/.ssh/id_ed25519. If the key is encrypted, its passphrase goes under Key passphrase (if encrypted). Querlyn stores the path, never the key.
PasswordThe SSH password. A host that asks for the password as a question (keyboard-interactive) works too.

For a passphrase or a password, the buttons above the field say where it is kept: Save in Keychain, Ask every time, or a password manager. See Choose where passwords are kept.

Which agent

Querlyn talks to the agent your Mac gives every application, the one ssh-add adds keys to. If your SSH config names another agent for a host with IdentityAgent (1Password's agent, for example), import the route from the config and Querlyn uses that agent for the hop.

Which keys

Ed25519 and ECDSA keys work, in OpenSSH and PEM files, encrypted or not.

RSA keys, and servers that have only an RSA host key, are refused until you turn them on: open Settings, and under SSH turn on Allow RSA keys (Command Palette › Preferences: Toggle RSA SSH Keys). They are off by default because of a known weakness in the software that handles them. Querlyn signs with SHA-256 or SHA-512 and never with the old SHA-1 signatures.

Take the route from your SSH config

If the route is already in ~/.ssh/config, you do not have to type it.

  1. Under Route, choose SSH, then Import from SSH Config… (Command Palette › Database: Import SSH Hosts from ~/.ssh/config).
  2. Querlyn lists the hosts it found. Choose the host to reach.

The hops in the dialog are replaced by the route to that host, including every ProxyJump on the way. The last hop is the host itself. What you import only fills the dialog: you can change any field afterwards, and your changes win.

From the configWhat Querlyn does with it
HostName, User, PortFills the hop's fields.
ProxyJumpAdds a hop for each jump, in order.
IdentityFileKey File with the first private key listed.
IdentityAgent, or only .pub identity filesSSH Agent, using that agent.
IdentitiesOnlyOffers the agent only the listed keys.
UserKnownHostsFileAlso checks host keys against that file.
ServerAliveInterval, ServerAliveCountMaxUsed for that hop's keepalive.
Include, Host patterns and negationFollowed as OpenSSH follows them.
ProxyCommandThrough a Command for the first hop, with the command as written. On a later hop it cannot be used and is left out, with a note under the hops; so is one with a token other than %h, %p, %r, %n or %%. When a host has both ProxyJump and ProxyCommand, the one written first wins, as in OpenSSH.
ForwardAgentNever used. Querlyn does not forward your agent to a bastion.
Match blocks other than Match allSkipped.

While you are connected

  • Querlyn sends a keepalive every 30 seconds so that an idle connection is not dropped on the way.
  • Connections that go the same way share the SSH sessions. When nothing uses a hop for five minutes, Querlyn closes it.
  • If a hop is lost, the connections through it are disconnected and say why. They reconnect when you next use them. To force new SSH sessions at once, right-click the connection and choose Command Palette › Database: Reconnect (New SSH Tunnels).

A command that arrives with a connection from a team workspace is not used: a program someone else wrote never runs on your computer without you typing it in. Connections that come from your own other computers through sync keep their command.

What is not supported

  • A command for any hop but the first, and OpenSSH's ProxyUseFdpass.
  • SSH certificates for signing in, and hardware keys that need PKCS#11 or FIDO2 support in the client.
  • Combining SSH hops with a Kubernetes or AWS Systems Manager tunnel in one connection.

Help for Querlyn 0.1.0. All help topics