As platform lead, how would you set a team's Cloudflare Tunnel standard: remote or local management, who holds tokens and cert.pem, and how replicas are deployed?
answer
- one source of truth for routes
- run rights versus manage rights
- rotation leaves old connectors up
- connectivity is not authorisation
basics
~20 sDefault to remotely-managed tunnels changed through a reviewed API pipeline, keep tokens in a secret store and rotate them, keep cert.pem off servers, scope people with per-tunnel roles, and run two or more replicas that can each reach every service.
solid answer
~40 sI would make **remote management** the default: one configuration on Cloudflare, pushed to every replica, changed only through the API from a reviewed pipeline. Local `config.yml` tunnels stay for development. The token only runs its tunnel, but anyone holding it can attach a connector and receive traffic. So it lives in a secret store, is passed with `--token-file`, and is rotated; existing connectors survive rotation until restarted, so a leak also means force-disconnecting them. `cert.pem` manages every tunnel and never sits on a server. Pipelines use API tokens with Cloudflare Tunnel and DNS edit rights, and application teams get per-tunnel roles. Run two or more replicas in separate failure domains, one tunnel per trust boundary, end every ingress list with a `404` catch-all, and put an identity check in front of the dashboard.
go deeper
Recall the credentials: a token or credentials file runs one tunnel, cert.pem manages every tunnel in the account, and the tunnel itself does not authorise users.
Explain how remote management keeps replicas on one configuration, what token rotation does to running connectors, and which API token permissions a pipeline needs.
Show the operating practice: tokens from a secret store, rotation with a restart window, force-disconnect for leaks, replicas that reach every service, and health alerts.
Own the tradeoff: central, reviewed configuration and small blast radii per tunnel and role, against the pipeline, rotation windows and role audits they cost the team.
## The decision A team exposes an internal admin dashboard and a staging API through Cloudflare Tunnel. The tunnel itself takes an afternoon. The lead's job is the standard around it: **where routing lives**, **who holds which credential**, **how the connectors are deployed**, and **what still guards each service**. None of these has one right answer. Each choice moves risk and toil somewhere. ## Where the configuration lives | | Remotely-managed | Locally-managed | |---|---|---| | Source of truth | Cloudflare, edited in the dashboard or through the API | `config.yml` on each host, ideally from version control | | Consistency across replicas | One pushed configuration | Every host's file must match | | Change review | API calls from a reviewed pipeline | A pull request plus your own distribution | | Secret on the host | Token only | Credentials file, plus `cert.pem` wherever tunnels are created | | Cloudflare's guidance | Recommended for most uses | Development, testing, legacy | A reasonable default is **remote management, changed only through the API from a reviewed pipeline**, with dashboard edits reserved for incidents. That keeps one configuration for every replica and an audit trail. Local management earns its place when the configuration has to live with the host image, or in throwaway development tunnels. ## Who holds what - **Tunnel token.** It grants "run this tunnel". It is not harmless: anyone holding it can attach a connector, and Cloudflare will send that connector a share of traffic, generally the nearby users. Keep it in a secret store and pass it with `--token-file` or `TUNNEL_TOKEN` rather than on a command line. Rotate it on a schedule (**Rotate token**). After rotation the old token cannot open new connections, but **existing connectors stay up until restarted**. For a leaked token, rotate and then force-disconnect every connection through the API. - **`cert.pem`.** It manages every tunnel in the account, so it never sits on a server. Pipelines use a scoped API token instead. Creating a remotely-managed tunnel and publishing a hostname needs **Account, Cloudflare Tunnel, Edit** and **Zone, DNS, Edit**. - **People.** Cloudflare's **granular permissions** bind a resource-scoped role to specific tunnels, so the application team can manage its own tunnel without touching the rest. Members with an account-level role that covers tunnels, such as **Cloudflare Access**, still have write access to every tunnel, so that role is kept to the platform team. ## How the connectors are deployed 1. **At least two replicas** on hosts in different failure domains. Each must reach every service its rules name, so use private addresses, not `localhost` on one machine. 2. **One tunnel per trust boundary**, with the dashboard and staging on separate tunnels if their audiences differ. A leaked staging token then cannot attach a connector to the production dashboard's tunnel. 3. **Replicas for availability, separate tunnels behind a load balancer for steering.** The load balancer sees one tunnel as one endpoint. 4. **Health alerts.** Tunnel notifications fire when a tunnel's health or deployment status changes. They go to whoever is on call. ## What the origin still checks A tunnel provides connectivity. Access to each resource is controlled separately. The standard should state: - Services listen only on private interfaces and the firewall blocks all ingress, so the tunnel is the **only** way in. - The ingress list ends with **`http_status:404`**, so no unplanned hostname reaches a service. - `originRequest` keeps **`noTLSVerify` off**, using `originServerName` and `caPool` for private CAs. - The admin dashboard sits behind an identity check, and the origin verifies the identity token itself. Configuring that is covered with Cloudflare Access. ## A standard written down The outcome of these choices fits on one page: management style per environment, the secret store path for each token and its rotation interval, who holds which role, the minimum replica count and placement, the mandatory `404` catch-all, the `originRequest` defaults, and the alert routing. Writing it down turns each new tunnel from a design exercise into a checklist, and gives reviewers something to hold a change against. ## What it costs - Remote management adds a pipeline and API tokens to maintain. - Token rotation needs a restart window on every replica. - Granular permissions mean more role bindings to audit. - Several tunnels mean more connectors to run. The payoff is a tunnel estate where any one leaked file has a small blast radius, and where every replica serves the same routes.
- A tunnel token leaked into a public CI log. What do you do, in order?Rotate the token so it cannot open new connections, then force-disconnect the tunnel's existing connections through the API, because connectors already running stay up after a rotation. Reinstall every replica with the new token, check `cloudflared tunnel info` for connectors you do not recognise, and move the pipeline to `--token-file` from a secret store.
- When would you still choose a locally-managed tunnel?For development and test tunnels a developer creates and throws away, or where the configuration must ship inside a host image reviewed with the rest of the host. Then the standard is one `config.yml` from version control, identical on every replica, and `cert.pem` held only by whoever creates tunnels.
- A tunnel token is harmless because it cannot change the tunnel's routes
- Rotating the token immediately disconnects every running replica
- Give each application team cert.pem so they can manage their own tunnel
- Once traffic arrives through a tunnel, the origin can trust every request
- One tunnel for every environment keeps things simplest with no extra risk
Assumes Cloudflare's platform as of 2026-10-10, where remotely-managed tunnels are the recommended default and granular permissions can scope a member's role to individual tunnels.