Connect through an SSH tunnel
Arrange a managed SSH key, connect a private PostgreSQL or MySQL database, and verify an approved table.
Use an SSH tunnel when Querio can reach a bastion, but the database is reachable only from inside your network. Querio connects to the bastion over SSH; the bastion forwards the connection to your database. The supported database clients are PostgreSQL (postgres) and MySQL (mysql or mysql2). Other datasource types cannot use this tunnel.
1. Prepare the bastion and database access
You'll need permission to create a datasource and manage credentials in Querio, plus help from the bastion and database administrators. See Datasources and credentials for the access model.
Ask the bastion administrator for a dedicated SSH account, such as querio_tunnel, and the bastion hostname and SSH port that Querio can reach. This SSH account is separate from the database login.
Ask the database administrator for a dedicated login with read access to the tables you plan to analyze. Use the PostgreSQL or MySQL guide for database privileges. The administrator should allow connections from the bastion side: PostgreSQL uses host-based authentication rules; MySQL accounts have a host component.
Choose a small approved table or record with a known result for the final check.
2. Arrange the Querio-managed public key
Ask Querio to confirm that the managed SSH key is configured for your deployment, provide its matching public key, and explain what to enter in the required Private key field. Give the public key to the bastion administrator through your approved process. Do not put a private key in a prompt, source file or screenshot.
The connection uses Querio's managed gateway key. The form's Private key value does not select a separate key for this connection. Generating your own key pair and entering its private key will not replace the managed key. If the managed setup or form entry is unresolved, ask Querio before continuing. See SSH provider boundaries.
3. Authorize forwarding and network routes
Have the bastion administrator add the confirmed public key to that SSH account's configured AuthorizedKeysFile, commonly ~/.ssh/authorized_keys, with ownership and permissions appropriate to the host. Preserve any existing required keys. See OpenSSH's authorized keys format.
The account must allow local TCP forwarding to the database host and port. For OpenSSH, an administrator can adapt this restriction to the bastion's policy:
Match User querio_tunnel
AllowTcpForwarding local
PermitOpen db.internal.example:5432Replace the user and destination. PermitOpen must match the Dst addr and Dst port entered in Querio exactly; OpenSSH does not look up alternate names when matching the restriction. Effective server and per-key rules must both allow forwarding. See the OpenSSH forwarding control and destination restriction.
Arrange both network legs:
| Leg | Check |
|---|---|
| Querio to bastion | The bastion accepts Querio's approved outbound addresses on its SSH port. Use Copy IP Address in the connection form and confirm the listed addresses apply to your deployment with Querio. |
| Bastion to database | The bastion resolves and reaches the database hostname and SQL port. Database firewall and login rules accept the bastion-side source. |
The database destination is resolved from the bastion, not your laptop. Use localhost as Dst addr only if the database endpoint runs on the bastion. The SSH forwarding model shows this path.
SSH protects the Querio-to-bastion leg. It does not establish database TLS on the bastion-to-database leg. The SSH form has no direct connection URI TLS options or CA/client-certificate fields. If database TLS is required, confirm the deployed client's configuration with Querio before connecting.
The connector does not check an expected bastion host key, and the form has no host-key or fingerprint field. If your policy requires bastion identity verification, discuss that limit with Querio before connecting. A successful test does not establish host-key verification; the SSH client's host-key contract treats it separately from opening an encrypted session.
4. Enter the bastion and database details
Open Settings > Datasources > Add datasource, choose Internal, enter a unique Slug and optional Name, then select SSH Tunnel as Database type. Use your actual values; these examples are synthetic.
| Field | Enter |
|---|---|
| Host | bastion.example.com, the SSH bastion address. |
| Port | The bastion's SSH port; defaults to 22. |
| Username | querio_tunnel, the bastion SSH account. |
| Private key | Follow Querio's managed-setup instructions for this required field. Its value does not select the gateway key. |
| Dst addr | db.internal.example, the database host as reachable from the bastion. |
| Dst port | The database SQL port, such as 5432 for PostgreSQL. |
| Db > Client | postgres for PostgreSQL; mysql or mysql2 for MySQL. |
| Db > Name | analytics, the target database. |
| Db > User | querio_reader, the database login. |
| Db > Password | That database login's password. |
| Db > Db schema | reporting for this PostgreSQL example; defaults to public and is ignored for MySQL. |
Enter Db > User and Db > Password literally, without URL percent-encoding. The current SSH connection construction changes spaces in those values to plus signs; contact Querio before proceeding with an affected login. For PostgreSQL, Db > Db schema sets one quoted search-path entry. It does not grant privileges or limit access to other permitted schemas.
5. Test and query
- Select Test connection. Wait for Connection successful and resolve any failure before saving.
- Select Create. Querio tests again before saving; wait for Datasource added.
- Review access before others query it. The first credential is initially assigned to Everyone. Each intended user also needs datasource permission and exactly one distinct authorized credential. See credential selection.
- In Context, select the datasource and use Add tables or Add schemas to catalog. Confirm the approved table and expected columns appear. Resolve a failed refresh or missing table before using the connection for analysis.
- As an intended user, open an Explore with the datasource selected. Run a small read of an approved table, for example:
SELECT order_id, status
FROM reporting.orders
WHERE order_id = 1001
LIMIT 1;For MySQL, use a database-qualified table such as analytics.orders. Replace the names and ID with a record you can check independently. Inspect the SQL and returned row, then compare them with the known result using the same identity and filters.
The connection probe runs SELECT 1; it does not read that table or prove another user's access. See connection tests and introspection.
Troubleshooting
| Symptom | Check |
|---|---|
| SSH authentication fails | Confirm the SSH account, managed key and installed public key. Check account status and authorized-key file permissions. Changing Private key in the form does not select another key. |
| Forwarding is prohibited | Check effective forwarding and per-key rules, including the exact PermitOpen destination. |
| Destination is refused or times out | Check bastion-side DNS, the database listener, Dst addr and Dst port, and both network legs. |
| Database authentication or TLS fails | Check the database login, bastion-side source rule and deployed TLS setup separately from SSH authentication. |
| Test succeeds but tables are missing or a query fails | Check database and schema selection, catalog refresh and object privileges. |
User gets 403 or credential-conflict 409 | Check datasource permission and credential assignments in Groups. |
Continue with Analyze your data, then Improve context with the table grain, relationships and definitions needed for analysis.
Last updated on November 27, 2026