When to use SSH tunnels
Use a tunnel when:- The database has no public IP or listens only on RFC1918 addresses
- VPN to every analyst is not practical, but you already operate a hardened bastion
- Cloud vendors offer Session Manager or similar, yet you standardize on SSH keys for third-party tools
Tunnels add latency and a moving part (the bastion). Prefer native private connectivity when your network team can provision it.
Configuration
You provide:| Field | Purpose |
|---|---|
| Bastion host | Public hostname or IP of the jump server |
| Bastion port | Usually 22; change if your SSH daemon listens elsewhere |
| Bastion username | OS account used for forwarding (often dedicated planasonix-tunnel) |
| Private key | PEM or OpenSSH key stored in the org secret manager; never embed in pipeline JSON |
| Known hosts (recommended) | Pin the bastion host key to prevent MITM on first connect |
| Remote bind | Database hostname as seen from the bastion and port (for example db.internal.corp:5432) |
| Local port | Often auto-assigned; fixed ports help when debugging from agents |
- Key-based auth
- Certificate-based SSH
Upload or reference an RSA or Ed25519 key. Rotate on the same schedule as database passwords.
Steps to set up with different providers
AWS EC2 bastion
Use a small instance in a public subnet with security group ingress restricted to Planasonix egress IPs (if you use allowlisting). Install
sshd, harden sshd_config (PasswordAuthentication no), and attach an IAM instance profile only if the bastion must call AWS APIs—otherwise omit extra privileges.Azure VM jump box
Place the VM behind Azure Firewall or NSG rules. Enable Azure AD login for admins if you disable password auth entirely. Document the private DNS name the bastion uses to reach Azure Database for PostgreSQL or SQL managed instances.
GCP Compute Engine
Use IAP TCP forwarding or a traditional bastion with OS Login and 2FA for human access. Ensure the bastion can resolve Cloud SQL private IP via VPC or PSC.
Troubleshooting tunnel issues
Connection timed out to bastion
Connection timed out to bastion
Verify security groups, NACLs, and host firewalls allow TCP/22 (or your port) from Planasonix egress. Confirm DNS resolves to the intended IP and that no geo block applies.
Authentication failed
Authentication failed
Confirm the username, key format, and that the public half is in
authorized_keys. Check SELinux or home directory permissions on the bastion if key auth silently fails.Tunnel opens but database still fails
Tunnel opens but database still fails
The database error is often auth or SSL. From the bastion, run
nc -zv db-host 5432 (or the right port) to prove reachability. Ensure the database user is allowed from the Planasonix runner IP or the bastion’s forwarded source, depending on how the DB ACLs are written.Intermittent drops
Intermittent drops
Idle timeouts on load balancers or NAT gateways close long SSH sessions. Enable keepalive in tunnel settings if offered, or shorten connection reuse intervals in the driver.
Agent-specific failures
Agent-specific failures
When using a pipeline agent, the tunnel may originate from the agent’s network. Allowlist the agent egress IP on the bastion, not only the SaaS region IPs.
Related topics
Databases
Connection parameters after the tunnel is in place.
Connection troubleshooting
Deep dive on timeouts, SSL, and firewall errors.