Skip to main content
When your database isn’t reachable from the internet, Midplane can reach it through an SSH bastion: a server it can reach on its SSH port that can reach the database. Midplane makes a key for the source; you add its public half to the bastion, limited to forwarding to that one database.

What you need

  • A bastion running OpenSSH 7.2 or later, with TCP forwarding allowed (AllowTcpForwarding, on by default), whose SSH port accepts your region’s egress addresses. The database needs no rule for Midplane: it sees the bastion.
  • A user on it for Midplane, such as midplane, with no password and best no login shell (/usr/sbin/nologin).
  • The connection string with the database’s host and port as the bastion sees them, such as db.internal:5432. Use the name its TLS certificate carries: Midplane checks it even through the bastion (TLS).

Add the Midplane key

1

Make the key

In the connect form, paste the connection string first, choose Through an SSH bastion, fill in Bastion host, Port and User, and select Make Midplane’s key. Its private half never leaves the MCP server. The form shows the line to add:
It names the connection string’s host and port: change the string, and copy the line again.
2

Add the line to the bastion

As the user Midplane logs in as:
OpenSSH ignores the file if others can write to it or its folder. Some systems refuse key logins to an account whose password is locked.
3

Test and connect

Midplane connects to the bastion, forwards to the database, and connects over TLS. Network, on the source’s page, then shows the bastion, its pinned host key and Midplane’s public key.

What the key line allows

restrict doesn’t stop the key running a command. To make sure it can’t, give the user no login shell, or start the line with command="/bin/false",: forwarding still works. Removing the source deletes its key from Midplane; delete the line yourself.

The pinned host key

Midplane keeps the bastion’s host key from its first connection, shown as SHA256:…, and refuses any other after. To check it, compare it on the bastion with:
A changed host key stops the source (the SSH bastion host key changed).