Skip to main content

Tunnels

Probe services that are only reachable through a bastion host or a SOCKS5 proxy — private networks, VPC-internal services, a database behind a jump box — with nothing new to deploy. If you already run SSH or a SOCKS proxy, you already have everything you need.

A tunnel-capable check carries a reference (tunnelCheckUid) to a tunnel check in the same organization: an ssh check (a bastion) or a socks5 check (a proxy). At each execution the worker opens a fresh route through it and dials the check's target through that route. A tunnel check can itself be tunneled, which builds a chain.

This page used to be called SSH tunnels (/docs/features/ssh-tunnels); the dashboard's "Run through SSH tunnel" option is now Run through a tunnel. The config key, tunnelCheckUid, did not change.

When to use this vs. a private location​

Both reach things the cloud workers cannot:

TunnelPrivate location / agent
SetupPoint at an existing ssh or socks5 checkDeploy and enroll an agent
Needs inbound accessYes — the bastion's SSH port or the proxy's portNo — the agent dials out
ProtocolsAny TCP-based check (databases, brokers, http, tcp, …)Every check type, incl. ICMP/UDP

Reach for the tunnel when a bastion or a proxy already exists; reach for an agent when nothing is reachable from outside at all.

Setting one up​

  1. Create the tunnel check.
    • For an SSH bastion: an ssh check with a username plus a password or private_key, and — required — its expected_fingerprint.
    • For a SOCKS5 proxy: a socks5 check with its host, port (default 1080) and, when the proxy asks for it, a username and password.
  2. On the check you want to tunnel, open Advanced → Run through a tunnel and pick the tunnel check. The list shows ssh and socks5 checks, each with its type.

The bastion or proxy is now monitored in its own right, and it is the single home for its credentials: they are stored encrypted at rest on that one check, and there is no separate tunnel resource to keep in sync.

SOCKS5 proxies​

A socks5 check monitors the proxy (connect, greeting, username/password authentication, and optionally a CONNECT to a testTarget; see the check type) and is usable as a tunnel:

  • Every connection of the tunneled probe is its own CONNECT through the proxy. The worker still connects and authenticates once when it sets the tunnel up, so a proxy that is down or rejects the credentials is a tunnel failure, not the target going down.
  • Hostnames are sent to the proxy unresolved: the proxy resolves them, like a bastion does.
  • A CONNECT the proxy refuses because the target is unreachable or refused the connection (SOCKS reply codes 3, 4, 5, 6) is the target being down. Any other refusal (not allowed by the ruleset, general failure) is a tunnel failure.
  • There is no host-key equivalent: the expected_fingerprint rule only applies to ssh hops. Prefer a proxy on a network you trust.

Chained tunnels​

A tunnel check can itself carry a tunnelCheckUid: an smtp check can go through an ssh bastion, reached through a socks5 proxy, reached through another ssh bastion. The worker walks the references from the check outward, then dials the route from the outermost hop inward:

  • At most 4 hops. A longer route is refused when you save the check (on the tunnel field) and again at run time.
  • No loops. A route that comes back to a check already on it, or to the check being saved, is refused, naming the checks involved.
  • The egress policy applies to hop 1 only. Hop 1 is dialed from the worker, through its egress policy. Every next hop is dialed through the previous one: it starts on the previous hop's network, where the worker's policy has no meaning, and its hostname is resolved there.
  • Timing. tunnel_setup_ms covers the setup of the whole chain; it stays out of the check's response time. Every connection the probe opens crosses every hop, so the response time itself includes the latency the hops add.
  • Output. A chained result carries tunnel_hops (the number of hops). A failed hop is named: tunnel failed: hop 2 of 3 (socks5 check <uid>): …, plus tunnel_failed_hop (its position, 1 being the hop dialed from the worker), tunnel_failed_check_uid and tunnel_failed_check_type. A single tunnel's output is unchanged.
  • Hops are closed in reverse order (innermost first) when the execution ends.
  • An ssh check that is itself tunneled is checked through its tunnel: its own probe reaches the server the same way the chain does.

Supported check types​

Every TCP-based check type can run through a tunnel — the classic bastion use cases (a database or message broker on a private network) are all covered:

  • Web & network: http, tcp, ssl, websocket, grpc
  • Databases: postgresql, mysql, mssql, oracle, clickhouse, redis, mongodb
  • Message brokers: rabbitmq, kafka, mqtt
  • Mail: smtp, imap, pop3
  • File transfer: ftp
  • Tunnel checks themselves: ssh, socks5 (a chain)

The dashboard's selector appears only on types that support it (the API reports this as supportsTunnel on /api/v1/orgs/{org}/check-types), so the option shows up automatically wherever it applies.

UDP- and ICMP-based types (icmp, udp, ntp, snmp, dns, dnsbl, sip, a2s) cannot tunnel: an SSH direct-tcpip forward and a SOCKS5 CONNECT carry TCP only. For those, use a private location / agent instead.

For the same reason an http check with httpVersion: "3" cannot tunnel: HTTP/3 runs over QUIC, which is UDP. HTTP/1.1 and HTTP/2 tunnel normally.

FTP passive mode

For ftp, both the control connection and passive-mode (PASV) data connections are dialed through the bastion. One caveat: a tunneled implicit-TLS FTPS check connects in plaintext through the tunnel — use explicit TLS (AUTH TLS) if you need the control channel encrypted end to end.

  • Scripting: js
JavaScript checks

js scripts get three rules when the check is tunneled:

  • http.*, http.session(), and the tcp/udp/websocket handles from javascript-checks.md are dialed through the tunnel, same as any other tunneled type (udp.open() is still refused — UDP cannot be tunneled, tunneled or not).
  • A sub-check of a type not in the table above (solidping.udp(...), solidping.icmp(...), solidping.dns(...), …) is refused rather than silently run from the worker's own network — a script must not be able to believe it probed through the bastion when it did not.
  • browser.open() is refused: Chrome has its own network stack and cannot be routed through the tunnel (it has no SOCKS authentication either).

See JavaScript checks for the details.

Host-key verification is required​

An SSH check may be used as a tunnel only if its expected_fingerprint is set, and the tunnel dial verifies the bastion's host key against it strictly. The tunnel carries your probe's traffic, so an unverified bastion is a silent man-in-the-middle. SSH checks with no fingerprint stay selectable-but-disabled in the picker, with a hint.

A plain SSH check without a fingerprint keeps working as a check — the requirement applies only when it is used as a tunnel.

Names are resolved by the bastion or the proxy​

The target hostname is sent through the tunnel verbatim and resolved on the bastion or the proxy, not by the worker. That is the point: internal-api.private means nothing to a cloud worker's resolver, but resolves correctly on the far side — so private DNS names work exactly as they do when you SSH in yourself.

Tunnels from a private location (deported agent)​

A check that runs in a private location / agent can tunnel too — the classic case is a service reachable only through a jump box inside that same private network. For that to work, the referenced SSH check (and, for a chain, every hop) must itself be allocated to the same private region:

  • The SSH check must cover every private region the tunneled check runs in. If your check runs in @paris, its bastion SSH check must also run in @paris. That is what guarantees the bastion's credentials are already sealed to that region's agents — dispatch ships the sealed credential envelope to the agent verbatim, and the agent (a recipient by construction) unseals it with its own key. Nothing is ever re-encrypted, and no credential ever reaches an agent of a region the SSH check is not allocated to.
  • A bastion monitored only from private regions can't serve a cloud check. An SSH check allocated exclusively to private regions stores its credentials sealed-only — the server itself can't read them, only the region's agents can. Such a bastion can only be tunneled through by checks that also run exclusively in those private regions. To also tunnel from a cloud region, give the SSH check a cloud region as well.

The dashboard's tunnel picker enforces the first rule up front: an SSH check that isn't allocated to a private region your check runs in appears disabled, with the reason (not in region @paris). Editing a check's regions can likewise be rejected if it would move the check somewhere its tunnel's SSH check doesn't cover — and, from the other side, narrowing an in-use bastion's regions is refused while dependents still rely on it.

Latency: tunnel_setup_ms​

Establishing the tunnel (the SSH session, the proxy's authentication, or the whole chain) is not counted in the check's response time. It is recorded as its own metric, tunnel_setup_ms, in the result's metrics. Without that split, every tunneled check's latency graph would be a picture of SSH handshakes rather than of the service you are monitoring.

Each execution dials its own session, so expect a tunnel_setup_ms on every result. (Connection pooling is a future improvement.)

Failure classification​

A failure of the tunnel is reported distinctly from a failure of the target:

What happenedResult
Bastion or proxy unreachable, auth failed, host key mismatch, forward refusederror, output tunnel failed: … plus a tunnel_failed: true marker (and, on a chain, the failing hop). The target is never probed.
Tunnel fine, target refused / timed out / returned the wrong thingThe check's normal down / timeout result

So a broken bastion reads as a broken bastion, not as ten services going down at once. (Automatically suppressing dependents' alerts when the bastion is down is a planned follow-up built on this distinction.)

Error catalog​

When a check runs on a private-location agent, two extra failure modes carry a tunnel_failed: true marker in the result output:

MessageCauseFix
tunnel failed: tunnel check … no longer exists in this organizationA tunnel check of the route was deleted after this check was configured.Recreate it or detach the tunnel.
tunnel failed: tunnel check … is not allocated to region @parisA hop was moved out of the agent's region since the check was validated.Re-allocate that tunnel check to the region.
tunnel failed: tunnel: the tunnel chain loops back on itself … / … is longer than 4 hops …The route was edited into a loop or past 4 hops outside the API.Fix the tunnelCheckUid of the hops listed.
tunnel failed: ssh tunnel check … must set expected_fingerprint …The bastion's fingerprint was cleared.Set expected_fingerprint on the SSH check again.
tunnel failed: ssh tunnel credentials not sealed for this agent …The agent isn't a recipient of the bastion's sealed credentials (region drift, or credentials never re-sealed after the agent enrolled).Re-save the SSH check's credentials so they seal to the current agents.
tunnel failed: ssh tunnel: not available on this agent …The agent received a tunneled job with no tunnel block: version skew, or an agent older than socks5 and chained tunnels given a route that is not a single ssh hop.Ensure every tunnel check is allocated to the agent's region; upgrade the agent.

These are written as an explicit error result — the job is never dispatched without its tunnel and never silently skipped, so the check's history always explains why it isn't running.

Rules and limits​

  • The referenced check must be in the same organization and must be an ssh check (with expected_fingerprint set) or a socks5 check.
  • Chains are limited to 4 hops, without loops (see Chained tunnels).
  • Deleting a tunnel check that other checks tunnel through is refused (409), listing the dependents. Detach them first. The tunnel check's detail page shows the same list.
  • The dependency is config-level, not runtime-level: disabling or pausing the tunnel check does not stop the checks that tunnel through it — a disabled tunnel check still works as a tunnel.
  • Regions must line up for private locations. For a check running on a deported agent, the SSH check must be allocated to that private region too (see Tunnels from a private location). For checks running only in cloud regions, the bastion's regions are independent — as long as its credentials are server-resolvable (not sealed-only).

Not covered​

  • Pooling. Every execution dials its own route.
  • A worker-wide proxy (ALL_PROXY for TCP checks). Outbound HTTP checks follow the environment's HTTP proxy, never on a tunneled check.
  • UDP and ICMP checks. Tunnels carry TCP only.
  • TCP checkers that do not dial through the tunnel: sftp, minecraft, and the WHOIS part of domain.
  • Browser checks. Chrome cannot be routed through the tunnel, and has no SOCKS authentication.