Skip to content

reoclo tunnel

reoclo tunnel <server> [-L <spec>]... [-R <spec>]... [--udp] [--bind-public] [--reconnect-deadline <seconds>]
reoclo tunnel ls [--server <server>] [--active]
reoclo tunnel describe <tunnel-id>
reoclo tunnel close <tunnel-id>
reoclo tunnel setup [--domain <suffix>]... [--port-443] [--no-service] [--no-trust] [--no-hosts]
reoclo tunnel status [name]
reoclo tunnel add <name> --server <server> --target <host:port|port> [--kind tcp|udp] [--local-port <port>] [--hostname <name>] [--via reoclo|tailscale|auto] [--tailnet-host <name>] [--keep-up] [--no-up]
reoclo tunnel add <name> --server <server> --kind https --target <host:port|port> [--hostname <name>] [--via reoclo|tailscale|auto] [--tailnet-host <name>] [--keep-up] [--no-up]
reoclo tunnel add <name> --server <server> --kind reverse --remote-port <port> --local-target <host:port|port> [--bind-public] [--no-up]
reoclo tunnel add <name> --kind local --hostname <name> --local-target <host:port|port> [--no-up]
reoclo tunnel edit <name> [options]
reoclo tunnel rm <name>...
reoclo tunnel up <name>...
reoclo tunnel down <name>...
reoclo tunnel share <name> --tailnet [--port <port>]
reoclo tunnel unshare <name>
reoclo tunnel approvals [--all]
reoclo tunnel approve <id>
reoclo tunnel deny <id>
reoclo tunnel daemon run|start|stop|status|logs|install|uninstall
reoclo tunnel trust [--domain <suffix>]...
reoclo tunnel untrust
reoclo tunnel ca-path

reoclo tunnel opens a TCP or UDP tunnel between your machine and a server, through the server’s runner. The tunnel rides the runner’s existing outbound connection, so you don’t need SSH keys or an inbound firewall rule. The server must be connected with a runner. SSH-only servers don’t support one-shot tunnels, but a saved tunnel that uses Tailscale works with them.

Pass the server by name, slug, or id. The command stays in the foreground and closes the tunnel when you press Ctrl-C. To keep a tunnel up without a terminal, save it instead.

A forward tunnel listens on your machine and sends the traffic to a host and port reachable from the server.

-L [bind:]local_port:remote_host:remote_port
-L local_port:remote_port

With only two parts, the remote host is 127.0.0.1 on the server. The local side binds 127.0.0.1 unless you give 127.0.0.1 or 0.0.0.0 as the first part. Use local port 0 to let the CLI pick a free port. The command prints the port it bound.

Terminal window
$ reoclo tunnel reoclo-production -L 5432:5432
tunnel: connected
-L 127.0.0.1:5432 → reoclo-production:127.0.0.1:5432 (tcp)
Ctrl-C to close

Common forms:

Terminal window
# Local port 15432 to Postgres on the server
reoclo tunnel reoclo-production -L 15432:5432
# Reach a host that only the server can see
reoclo tunnel reoclo-production -L 5432:db.internal:5432
# Two forwards in one session
reoclo tunnel reoclo-production -L 5432:5432 -L 6379:6379

A reverse tunnel listens on the server and sends the traffic to a host and port on your side. Use it to show a service running on your laptop to something on the server.

-R [bind:]remote_port:local_host:local_port
-R remote_port:local_port

With two parts, the local host is 127.0.0.1. The server side binds 127.0.0.1 by default, so only processes on the server can reach it. To bind 0.0.0.0 on the server, pass --bind-public and put 0.0.0.0 first in the spec. Your organization’s tunnel policy can forbid reverse tunnels or public binds, and the command then fails with a message saying so.

Terminal window
# Server port 8080 reaches localhost:3000 on your machine
reoclo tunnel reoclo-production -R 8080:3000

You can mix -L and -R in one session.

Tunnels carry TCP by default. Add --udp to carry UDP instead. The flag applies to every -L and -R in that command, so open a second session if you need both protocols. Your organization’s tunnel policy can disable UDP.

Terminal window
reoclo tunnel reoclo-production -L 5353:53 --udp
OptionMeaning
-L <spec>Forward tunnel. Repeat for more than one
-R <spec>Reverse tunnel. Repeat for more than one
--udpUse UDP for all specs in this command
--bind-publicLet -R bind 0.0.0.0 on the server
--reconnect-deadline <seconds>How long to keep trying to reconnect before giving up. Default 300

At least one -L or -R is required.

Each person and each organization can have a limited number of tunnels open at once. The defaults are 4 per user and 32 per organization, and your organization’s tunnel policy can change them. When you reach the limit, the new tunnel exits straight away instead of retrying, with a message like this:

tunnel: max concurrent tunnels per user reached (4); see reoclo tunnel ls. Run `reoclo tunnel ls` to see open tunnels and `reoclo tunnel close <id>` to free one.

The organization limit reads max concurrent tunnels per tenant reached (32). Run reoclo tunnel ls --active to see what is open, then close one you no longer need. A tunnel that is waiting out a runner reconnect still holds its slot.

Needs CLI 0.94.1 or newer. Older versions treat the refusal as a dropped connection and keep retrying.

Tunnels are built to survive short interruptions.

  • Your connection drops. The CLI reconnects with a growing delay between attempts and prints tunnel: reconnecting. Your local listeners stay open. If it can’t reconnect within --reconnect-deadline (300 seconds by default), it exits with an error. A Reoclo restart is handled the same way.
  • The runner reconnects. If the server’s runner drops and comes back, Reoclo keeps your tunnel open and waits for it. Connections that were in flight at that moment are reset, and new connections are refused until the runner is back. When it returns, the tunnel resumes without a restart. A reverse tunnel listens on the server again on its own.
  • The runner stays away. After about 90 seconds without the runner, the tunnel closes and the CLI exits with runner_disconnected. Start the command again once the server is back.
  • Maximum duration. Tunnels close after the maximum duration in your organization’s policy, 8 hours by default.

The CLI doesn’t retry when the failure can’t fix itself: an expired or revoked sign-in, a missing permission, a server that doesn’t exist, a runner that isn’t connected, or the concurrent tunnel limit. It prints the reason and exits with code 1.

Uploads and downloads of any size work, including a large request body sent through a tunnel in one go. The CLI sends data in small pieces, and Reoclo splits anything bigger before it reaches the server. Needs CLI 0.94.1 or newer to send in small pieces. Older versions still work, because Reoclo splits their writes up to 8 MiB. A single write larger than that fails that one connection, and the rest of the tunnel keeps running.

Lists tunnel sessions in your organization, open and closed, newest first.

Terminal window
$ reoclo tunnel ls --server reoclo-production --active
TUNNEL ID SERVER MODE PROTO PORTS OPENED STATUS BYTES IN/OUT
8c1e5b4a-2f3d-4b8e-9a70-6d1f0c2e7a15 prod-1 forward tcp :5432→127.0.0.1:5432 2026-11-02T09:14:07Z active 1.2MB/48.0KB
OptionMeaning
--server <server>Only sessions on this server
--activeOnly sessions that are still open

Prints every field of one session, including bytes and datagrams in each direction and a list of any runner interruptions with whether each one recovered. When Reoclo returns the session’s targets, describe also lists each distinct destination the session carried traffic to, with its mode, protocol, host, port and the time it first appeared. A session that a saved tunnel pool shares lists every target it served.

Asks Reoclo to close a live tunnel. The CLI running that tunnel sees the connection end. Pass the ID shown in the TUNNEL ID column of ls.

Terminal window
$ reoclo tunnel close 8c1e5b4a-2f3d-4b8e-9a70-6d1f0c2e7a15
tunnel: close requested for 8c1e5b4a-2f3d-4b8e-9a70-6d1f0c2e7a15

Sometimes a session shows as open in ls although nothing holds it any more, for example after a crash. close cleans that up. When no live connection exists, the command reports it and marks the session closed:

tunnel: 8c1e5b4a-2f3d-4b8e-9a70-6d1f0c2e7a15 had no live connection; marked it closed

If the session was seen live within the last couple of minutes, Reoclo leaves it open, because another part of the platform may still hold it, and the command says so:

tunnel: 8c1e5b4a-2f3d-4b8e-9a70-6d1f0c2e7a15 was seen on a gateway in the last few minutes, so it was left open; try again shortly

Wait a minute and run close again. A session that is already closed exits with tunnel: <id> is already closed. Open sessions that no live connection holds are also closed on their own after a few minutes.

Terminal window
reoclo tunnel setup

Runs the one-time steps that prepare a machine for tunnels, in order:

StepWhat it doesSame as
Start at loginStarts the tunnel daemon at loginreoclo tunnel daemon install
Local CACreates the local CA and trusts it, so browsers accept HTTPS tunnelsreoclo tunnel trust
Hosts helperInstalls the root helper that manages hostnames in /etc/hostsreoclo hosts setup

Run it as often as you like. A step that is already done is left alone, and a step that fails does not stop the others. The command exits 1 if any step failed.

Trusting the CA can raise a system prompt and the hosts helper asks for sudo, so run this in a terminal. Without one, those two steps are skipped.

It finishes by reporting your sign-in, whether HTTPS URLs need a port, and whether Tailscale is available. It does not change any of those.

FlagEffect
--domain <suffix>Also allow this suffix for certificates and hostnames, such as internal. Repeatable
--port-443Relay port 443 to the HTTPS port so URLs drop the port. Refused while another program answers on 443
--no-serviceDo not start the daemon at login
--no-trustDo not trust the local CA
--no-hostsDo not install the hosts helper

A saved tunnel is a named tunnel that a background process, the tunnel daemon, keeps for you. It survives closing the terminal and comes back after the daemon restarts, so you set it up once and use it like a local service.

Terminal window
# Save it and bring it up. Postgres on prod-1 is now on 127.0.0.1:5432.
reoclo tunnel add prod-db --server prod-1 --target 5432
# See every saved tunnel
reoclo tunnel status

The first command that needs the daemon starts it. You never have to start it by hand, but you can: see the daemon.

KindMeaning
tcpForward TCP. The default
udpForward UDP
httpsForward a web service to a trusted HTTPS hostname on your machine. See HTTPS tunnels
reverseThe server listens and sends traffic to a host and port on your machine
localServe a hostname over HTTPS and forward it to a TCP address on this machine. See Local routes

A tcp or udp tunnel listens on 127.0.0.1 at its local port. An https tunnel binds no port of its own: the daemon’s HTTPS listener serves it by hostname.

A forward tunnel listens on 127.0.0.1 at its local port. Pass --local-port to choose the port. Without it, add uses the target port when it is free and a free port otherwise, then saves the port, so it never changes afterwards. Local ports must be unique across your forward tunnels.

add saves the organization like every other command: from --org, $REOCLO_ORG or a .reoclo file. It also saves the profile you were using. The daemon signs in with that saved profile each time it opens a session, so you do not pass a token. When the stored sign-in can no longer be refreshed, the tunnel moves to needs_sign_in. Run reoclo login and the next connection works.

Prints a table of saved tunnels: name, server, kind, local address, target, state, path, shared and detail. The local column shows the URL for an https tunnel. The path is relay or tailscale, and the shared column shows where a share answers once it is up. Pass a name to show one tunnel. With -o json it prints one object per line, including the message, the suggested action, traffic counters and, for an https tunnel, its hostname and url. Every tunnel carries via and path, plus path_reason, peer and share when there is something to report. A tunnel an agent opened shows (ad-hoc) after its kind, and its detail says when it ends.

For an ad-hoc tunnel the JSON also carries adhoc: true and expires_at.

A tunnel started in a terminal with reoclo tunnel <server> -L ... is listed after the saved tunnels, under Running in a terminal, with its forwards and process ID. It appears in the text output only; -o json lists saved tunnels. The Reoclo desktop app shows the same list and can stop a tunnel. A tunnel started by an older CLI appears after you restart it.

$ reoclo tunnel status
NAME SERVER KIND LOCAL TARGET STATE PATH SHARED DETAIL
prod-db prod-1 tcp 127.0.0.1:15432 prod-1:127.0.0.1:5432 ready relay
OptionMeaning
--server <server>Server name, slug or id. Required for every kind except local
--target <host:port|port>Forward: where the server connects. A bare port means 127.0.0.1 on the server
--kind <kind>tcp (default), udp, https, reverse or local. https is the default when you pass --hostname and no kind
--hostname <name>The local hostname. An https tunnel defaults to <name>.<server>.reoclo.localhost. On a tcp or udp tunnel it only adds a hosts entry. A local route requires it
--local-port <port>tcp and udp: the local port to listen on
--keep-upHold the session open instead of opening it on demand
--no-upSave the tunnel without bringing it up
--remote-port <port>Reverse: the port the server listens on
--local-target <host:port|port>Reverse and local: where this machine connects. A bare port means 127.0.0.1
--bind-publicReverse: bind 0.0.0.0 on the server
--via <transport>reoclo (the relay, default), tailscale or auto. A tunnel to an SSH server defaults to tailscale. See Tailscale transport
--tailnet-host <name>The server’s name on your tailnet, when it differs from its Reoclo hostname

Names use lowercase letters, digits and hyphens, start with a letter or digit, and hold up to 63 characters. A tunnel is up as soon as you add it unless you pass --no-up.

Adding an https tunnel prints a hint when the local CA is not trusted yet or the hosts helper is not installed.

Terminal window
# Reach a database that only the server can see, on a fixed local port
reoclo tunnel add prod-db --server prod-1 --target db.internal:5432 --local-port 15432
# Open Grafana at https://grafana.prod-1.reoclo.localhost:8443
reoclo tunnel add grafana --server prod-1 --kind https --target 3000
# Show a service on your laptop to the server
reoclo tunnel add hook --server prod-1 --kind reverse --remote-port 8080 --local-target 3000

Changes a saved tunnel. Pass any of --server, --target, --hostname, --local-port (tcp and udp only), --keep-up or --no-keep-up for a forward tunnel, and --server, --remote-port, --local-target, --bind-public or --no-bind-public for a reverse tunnel. Pass --hostname or --local-target to change a local route. Pass --via or --tailnet-host to change a forward or https tunnel’s transport. A tunnel that is up restarts with the new settings. You cannot rename a tunnel or change its kind; remove it and add it again.

Brings the tunnels down and removes them. remove and delete also work in place of rm.

up brings a saved tunnel up and down brings it down. The daemon remembers which tunnels are up and brings them back after a restart or a reboot, so down is how you stop one for good. A tunnel stays saved while it is down.

All saved tunnels to one server share one session, so they use one slot of your concurrent tunnel limit. Six tunnels on two servers hold two slots. A tunnel that uses Tailscale opens no session and holds no slot.

  • On demand. The session opens when the first local connection arrives for any of the server’s tunnels. The listeners stay up while it is closed, so the first connection after a quiet period waits for one handshake.
  • Idle close. The session closes after 600 seconds with no open connection. The tunnels go back to ready and the next connection reopens it. To change the period, set idle_timeout_seconds in tunnels.yaml in the state directory and restart the daemon.
  • Keep up. A tunnel saved with --keep-up opens its session when you bring it up and holds it, and reconnects with a growing delay of up to 30 seconds when the runner goes offline. A reverse tunnel always holds its session, because its connections arrive on the server, where the daemon cannot see them.
  • Maximum duration. When Reoclo closes a session at your organization’s maximum duration, the server’s tunnels move to expired and stay there. The daemon never reopens it on its own. Run reoclo tunnel up <name> on any tunnel of that server to start again.
  • Closed by an operator. A session closed with reoclo tunnel close or from the dashboard moves the tunnels to closed_by_operator. They stay down until you run up.

Any up on a tunnel of a server clears expired and closed_by_operator for all of that server’s tunnels.

StateMeaningWhat to do
downThe tunnel is not upRun reoclo tunnel up <name>
readyListening, no session openNothing
connectingOpening the sessionNothing
activeThe session is openNothing
reconnectingThe connection dropped and the session is retryingNothing
needs_sign_inThe stored sign-in expiredRun reoclo login
server_offlineThe server’s runner is not connectedTry again later
quota_reachedYou reached the concurrent tunnel limitClose another tunnel
expiredThe session reached the maximum durationRun reoclo tunnel up <name>
closed_by_operatorSomeone closed the sessionRun reoclo tunnel up <name>
forbiddenThe server or your policy refused the tunnelAsk an organization admin
failedAnything else, such as a local port already in useRead the detail column

An https tunnel serves a web service on the server at a hostname on your machine, with a certificate your browser trusts. The daemon terminates TLS and passes the bytes through, so WebSockets, server-sent events and keep-alive work unchanged. It does not parse HTTP, rewrite the Host header or add authentication. Your service sees the hostname you opened, so a service that checks Host (Vite, Django’s ALLOWED_HOSTS) needs that hostname allowed.

Terminal window
reoclo tunnel trust
reoclo tunnel add grafana --server prod-1 --kind https --target 3000
$ reoclo tunnel status grafana
NAME SERVER KIND LOCAL TARGET STATE PATH SHARED DETAIL
grafana prod-1 https https://grafana.prod-1.reoclo.localhost:8443 prod-1:127.0.0.1:3000 ready relay

The default URL carries :8443. An ordinary user cannot bind port 443 on macOS or Linux, so the daemon listens on port 8443 on 127.0.0.1 and ::1. To use another port, set https_port in tunnels.yaml and restart the daemon. If the port is already in use, every https tunnel shows failed with the reason. The daemon binds the port only while an https tunnel is up.

To drop the port from the URL, run reoclo hosts setup --port-443. See reoclo hosts for what it does and why it refuses to start while another program answers on port 443.

The default hostname is <tunnel>.<server>.reoclo.localhost, with the server name lowercased and cut down to letters, digits and hyphens. .localhost names are reserved for your own machine, so they never collide with a real domain. Some programs, curl among them, resolve them to loopback on their own. Programs that use the system resolver, such as Safari and most other macOS apps, need a hosts entry: run reoclo hosts setup once.

A hostname must be a lowercase DNS name, unique across your saved tunnels and manual hosts, and end in reoclo.localhost or in a suffix you allowed with reoclo tunnel trust --domain. The daemon refuses an unknown hostname during the TLS handshake. A tunnel that is down answers no handshake either.

The daemon signs a certificate for each hostname the first time something connects, with the local CA. Certificates last 30 days, live in memory only and renew after two thirds of that. The listener offers http/1.1 only.

An https tunnel shares its server’s session with every other saved tunnel to that server, like a tcp tunnel does. See Sessions and pooling.

A local route serves a hostname over HTTPS through the daemon’s listener and forwards the decrypted traffic to a TCP address on this machine. It has no server, organization or sign-in, so you can add one without credentials. Use it to put a service that runs on your own machine behind a trusted HTTPS hostname.

Terminal window
reoclo tunnel add dev-app --kind local --hostname app.reoclo.test --local-target 127.0.0.1:48080

A local route uses the same hostnames, certificates and local CA as an https tunnel, so its hostname must end in reoclo.localhost or in a suffix you allowed with reoclo tunnel trust --domain, and it must be unique across your saved tunnels. If nothing accepts connections at the local target, the daemon closes that connection and logs one line. --server, --target and --via do not apply to a local route.

reoclo tunnel trust creates a certificate authority for this machine and adds it to your system trust store. Browsers then accept the certificates the daemon signs.

CommandWhat it does
reoclo tunnel trust [--domain <suffix>]...Create the CA and trust it. Repeat --domain to allow more suffixes
reoclo tunnel untrustRemove the CA from every store it was added to and delete its key
reoclo tunnel ca-pathPrint the path of the CA certificate. Exits 1 when there is no CA
  • macOS. trust adds the CA to your login keychain as a trusted root. macOS shows its own authentication prompt.
  • Linux. trust copies the CA to /usr/local/share/ca-certificates, runs update-ca-certificates with sudo, and also adds it to ~/.pki/nssdb for Chromium when that directory and certutil exist.
  • Firefox keeps its own store. Set security.enterprise_roots.enabled to true in about:config, or import the file that ca-path prints.
  • Node and Bun do not read the system store. Point NODE_EXTRA_CA_CERTS at the file ca-path prints. For curl, pass it to --cacert.

The CA uses ECDSA P-256, lasts two years, and carries a critical name constraint that limits it to reoclo.localhost and the suffixes you allow. If its key ever leaks, it cannot sign a certificate for any other domain. The key is stored in ca/ca.key with mode 0600.

A suffix like internal lets you use hostnames such as grafana.internal:

Terminal window
reoclo tunnel trust --domain internal

A single-label suffix must be a reserved name (internal, test, local, localhost, lan, home, invalid, example or localdomain). Any multi-label suffix works, such as corp.example.com. Changing the suffixes issues a new CA, removes the old one from the trust store, and asks you to trust the new one. trust saves the suffixes in ca_suffixes in tunnels.yaml. Writing a custom hostname to your hosts file also needs the suffix on the helper’s allowlist: see reoclo hosts setup.

A saved tunnel can reach the server over your tailnet instead of through the Reoclo relay. The daemon dials the server’s tailnet address directly and pipes the bytes, so the traffic never touches the Reoclo gateway. See Tunnels over Tailscale for a walkthrough.

Terminal window
reoclo tunnel add prod-db --server prod-1 --target 5432 --via tailscale
viaMeaning
reocloAlways use the relay. The default
tailscaleAlways use the tailnet. A connection the tailnet cannot carry is refused, and the tunnel shows failed with the reason
autoChoose for each connection: the tailnet when it can carry it, the relay otherwise

--via works on tcp, udp and https tunnels. A reverse tunnel opens a listener on the server, which only the relay can do, so it always uses the relay. --keep-up holds a gateway session, so it does not go with --via tailscale.

  • Finding the server. add saves the server’s hostname with the tunnel. The daemon looks for a peer in tailscale status --json with that name: the peer’s HostName first, then the first label of its DNS name, ignoring case. If the server has another name on your tailnet, pass --tailnet-host.
  • Where it dials. The daemon connects to the peer’s first IPv4 tailnet address. A target on the server’s loopback (127.0.0.1 or localhost) is rewritten to that address. A target with any other host, such as db.internal, is not eligible, because only the server can resolve that name.
  • Which ports work. The service must listen on 0.0.0.0, :: or the tailnet address. The server’s stored port scan shows each port’s bind address. A port that listens only on 127.0.0.1 or ::1 cannot be reached, so a via: tailscale tunnel refuses its connections and add prints a warning before it saves. A port missing from the scan is allowed, because the scan may be out of date.
  • auto and fallback. auto uses the tailnet when Tailscale is running, the peer is online, the target is eligible and the port is reachable. It uses the relay otherwise, and status says why in the detail column. If a dial over the tailnet fails, that one connection falls back to the relay.
  • UDP. The daemon keeps one tailnet socket for each local peer and closes it after 60 seconds without datagrams, the same rule the relay applies.
  • Policy and audit. Traffic over the tailnet is your own network path, so it does not count against your organization’s concurrent tunnel limits, maximum duration or bandwidth limit, and it does not appear in the platform audit. The daemon records each connection in its log.
  • SSH servers. An SSH server has no runner, so its tunnels can only use the tailnet. add defaults them to --via tailscale.

A tcp or https tunnel can also be shared with the other devices on your tailnet. The daemon runs tailscale serve for the tunnel, and a device that your tailnet’s access rules allow to reach this machine opens the share the way it would open any service on it. The traffic still leaves through your Reoclo session. Sharing never publishes anything to the internet.

Terminal window
reoclo tunnel share grafana --tailnet
reoclo tunnel unshare grafana
OptionMeaning
--tailnetShare on the tailnet. Required, because a tailnet is the only place a tunnel can be shared
--port <port>The port other devices connect to. The default is 443 for an https tunnel and the target’s port for a tcp tunnel
  • https tunnels appear at https://<machine>.<tailnet>.ts.net:<port> with Tailscale’s own certificate. The tailnet needs HTTPS certificates turned on. The daemon forwards tailscale serve --https=<port> to a plaintext listener on 127.0.0.1 that it keeps for the tunnel on a port saved in tunnels.yaml as internal_port, so the port never changes.
  • tcp tunnels are published with tailscale serve --tcp=<port>, forwarding to the tunnel’s local port.
  • A share lives as long as its tunnel. Each share is a foreground tailscale serve process of the daemon, never a background one. It stops when the tunnel goes down, when you remove it, and when the daemon stops. The daemon records the process ids in run/shares.json, and a daemon that starts after a crash stops any it finds there.
  • A share that dies restarts. The daemon restarts it with a delay that grows to 30 seconds, and the detail column shows why it is not up. A share that cannot start says so plainly: Tailscale is missing or not running, HTTPS certificates are off for the tailnet, or the port is already served.
  • Sharing restarts the tunnel, so connections that are open end.
  • The SHARED column of reoclo tunnel status shows the share’s address once it is up, and its state before that.

An agent needs your approval to share or unshare a tunnel. See Approvals.

An agent that runs reoclo mcp can list, open, close and save tunnels through the daemon. Every request it sends carries the agent’s name, so the daemon can tell an agent from you.

An agent can open a forward tunnel to a service on a server without saving anything. An ad-hoc tunnel:

  • listens on a free port on 127.0.0.1 and has no hostname, so it never changes your hosts file;
  • never appears in tunnels.yaml, and a daemon restart ends it;
  • ends after its time to live, 60 minutes by default and at most 480, or earlier when the agent closes it or you run reoclo tunnel down <name>;
  • shares one session per server with your saved tunnels, so they all hold one slot of the concurrent tunnel limit.

The daemon opens the session before it answers, and waits up to 30 seconds. A sign-in that expired, a tunnel the server refuses or an offline runner reaches the agent as an error instead of failing on its first connection, and the daemon drops the tunnel. You cannot edit an ad-hoc tunnel.

By default an agent cannot do these without you:

  • save, edit or bring up a reverse tunnel, or a tunnel bound on all interfaces (--bind-public);
  • add, change or remove a hostname, which includes saving any https tunnel;
  • trust or untrust the local CA;
  • share a tunnel on the tailnet, or stop sharing it.

An agent never needs approval to close a tunnel, to open an ad-hoc tunnel, or to save or bring up a plain tcp or udp tunnel without a hostname.

When an agent asks for one of these, the daemon keeps the request: the agent’s name, the action and a description. The agent waits up to 60 seconds. If nobody answers, it gets pending_approval with an id and tells you what it is waiting for. The request stays for 10 minutes and then expires. The daemon holds requests in memory, so a restart drops them.

Terminal window
$ reoclo tunnel approvals
ID AGENT ACTION REQUEST EXPIRES
a1b2c3d4 claude-code save_tunnel Save reverse tunnel "hook": prod-1 port 8080 to 127.0.0.1:3000 on this machine in 9m
$ reoclo tunnel approve a1b2c3d4
tunnel: approved a1b2c3d4: Save reverse tunnel "hook": prod-1 port 8080 to 127.0.0.1:3000 on this machine
CommandWhat it does
reoclo tunnel approvals [--all]List the requests waiting for you. --all adds the ones decided in the last hour, with their status
reoclo tunnel approve <id>Run the request. If the action then fails, the command prints the reason and exits 1
reoclo tunnel deny <id>Drop the request

These commands need a running daemon and do not start one. An agent cannot approve, deny or change the daemon’s settings: the daemon refuses those requests when they come from MCP.

To turn approvals off, set agent_approvals: off at the top of tunnels.yaml and restart the daemon. Agents can then do everything the CLI can.

Approvals are a guardrail, not a sandbox. An agent runs as your user, so it could run reoclo tunnel add --kind reverse in a shell or talk to the daemon’s socket itself. Approvals stop a well-meaning agent from doing more than you asked. They do not contain a hostile process.

The tunnel daemon is the reoclo binary running in the background, one per user. It holds the saved tunnels, the local listeners and the gateway sessions. Commands talk to it over a Unix socket that only your user can open.

CommandWhat it does
reoclo tunnel daemon startStart it in the background and wait until it answers
reoclo tunnel daemon stopStop it. Tunnels that are up come back on the next start
reoclo tunnel daemon statusShow the version, process id, uptime, tunnel counts, the HTTPS listener, the local CA, the hosts helper and Tailscale. Exits 1 when it is not running
reoclo tunnel daemon logs [-f] [-n <lines>]Print the last lines of the log (50 by default). -f keeps printing new lines until Ctrl-C
reoclo tunnel daemon runRun it in the foreground. This is what start, launchd and systemd run
reoclo tunnel daemon installStart it at login
reoclo tunnel daemon uninstallStop starting it at login

The daemon starts on its own the first time you run status, add, edit, rm, up or down, and only one daemon runs at a time. A second one exits at once.

install writes a launchd agent on macOS (~/Library/LaunchAgents/com.reoclo.tunneld.plist) or a systemd user unit on Linux (~/.config/systemd/user/reoclo-tunneld.service), then loads it. It points at the path you run, so a Homebrew install uses the reoclo symlink and keeps working after an upgrade. The service restarts the daemon after a crash but not after daemon stop.

The daemon keeps its files in tunnels/ inside the CLI’s configuration directory (~/.reoclo or ~/.config/reoclo, or $REOCLO_CONFIG_DIR):

FileContents
tunnels.yamlThe saved tunnels and which ones are up, plus https_port (default 8443), agent_approvals (required or off, default required), ca_suffixes and manual_hosts
ca/ca.pem and ca/ca.keyThe local CA certificate and its private key, created by tunnel trust
tunneld.logThe daemon log
run/tunneld.sock and run/tunneld.pidThe control socket and the process id
run/shares.jsonThe process ids of the tailscale serve processes behind shares

The daemon writes tunnels.yaml. Use the commands above to change tunnels instead of editing the file by hand.

CodeMeaning
0The tunnel closed after Ctrl-C
1The tunnel failed: refused, limit reached, deadline exceeded, runner gone, or the session wasn’t found
2Wrong or missing -L or -R spec, no server given, or a flag mix tunnel add and tunnel edit reject