You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/cloudflare-one/connections/connect-networks/configure-tunnels/remote-management.mdx
+162-2Lines changed: 162 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -148,6 +148,166 @@ To configure how `cloudflared` sends requests to your [public hostname](/cloudfl
148
148
149
149
## Tunnel permissions
150
150
151
-
A remotely-managed tunnel only requires the tunnel token to run. Anyone with access to the token will be able to run the tunnel. You can get a tunnel's token from the dashboard or via the [API](/api/operations/cloudflare-tunnel-get-a-cloudflare-tunnel-token).
151
+
A remotely-managed tunnel only requires the tunnel token to run. Anyone with access to the token will be able to run the tunnel.
152
152
153
-
Account members with Cloudflare Access and DNS [permissions](/cloudflare-one/roles-permissions/) will be able to create, delete, and configure all tunnels for the account.
153
+
### View the tunnel token
154
+
155
+
To get the token for a remotely-managed tunnel:
156
+
157
+
<TabssyncKey="dashPlusAPI">
158
+
<TabItemlabel="Dashboard">
159
+
1. In [Zero Trust](https://one.dash.cloudflare.com/), go to **Networks** > **Tunnels**.
160
+
2. Select a `cloudflared` tunnel and select **Edit**.
161
+
3. Copy `cloudflared` installation command.
162
+
4. Paste the installation command into any text editor. The token value is of the form `eyJhIjoiNWFiNGU5Z...`
163
+
164
+
</TabItem>
165
+
<TabItemlabel="API">
166
+
167
+
Make a `GET` request to the [Cloudflare Tunnel token](api/operations/cloudflare-tunnel-get-a-cloudflare-tunnel-token) endpoint:
Cloudflare recommends rotating the tunnel token at a regular cadence to reduce the risk of token compromise. You can rotate a token with minimal disruption to users as long as the tunnel is served by at least two [`cloudflared` replicas](/cloudflare-one/connections/connect-networks/deploy-tunnels/deploy-cloudflared-replicas/). To ensure service availability, We recommend performing token rotations outside of working hours or in a maintenance window.
188
+
189
+
To rotate a tunnel token:
190
+
191
+
1. Refresh the token on Cloudflare:
192
+
193
+
<TabssyncKey="dashPlusAPI">
194
+
<TabItemlabel="Dashboard">
195
+
1. In [Zero Trust](https://one.dash.cloudflare.com/), go to **Networks** > **Tunnels**.
196
+
2. Select a `cloudflared` tunnel and select **Edit**.
197
+
3. Select **Refresh token**.
198
+
4. Copy the `cloudflared` installation command for your operating system. This command contains the new token.
199
+
200
+
</TabItem>
201
+
<TabItemlabel="API">
202
+
203
+
1. Generate a random base64 string (minimum size 32 bytes) to use as a tunnel secret:
204
+
205
+
```sh
206
+
openssl rand -base64 32
207
+
```
208
+
209
+
```sh output
210
+
AQIDBAUGBwgBAgMEBQYHCAECAwQFBgcIAQIDBAUGBwg=
211
+
```
212
+
213
+
2. Make a `PATCH` request to the [Cloudflare Tunnel](/api/operations/cloudflare-tunnel-update-a-cloudflare-tunnel) endpoint:
After refreshing the token, `cloudflared` can no longer establish new connections to Cloudflare using the old token. However, existing connectors will remain active and the tunnel will continue serving traffic.
253
+
254
+
2. On half of your `cloudflared` replicas, update `cloudflared` to use the new token. For example, on a Linux host:
255
+
256
+
```sh
257
+
sudo cloudflared service install <TOKEN>
258
+
```
259
+
260
+
3. Restart `cloudflared`:
261
+
262
+
```sh
263
+
sudo systemctl restart cloudflared.service
264
+
```
265
+
266
+
4. Confirm that the service started correctly:
267
+
```sh
268
+
sudo systemctl status cloudflared
269
+
```
270
+
271
+
While these replicas are connecting to Cloudflare with the new token, traffic will automatically route through the other replicas.
272
+
273
+
5. Wait 10 minutes for traffic to route through the new connectors.
274
+
275
+
6. Repeat steps 2, 3, and 4 for the second half of the replicas.
276
+
277
+
The tunnel token is now fully rotated. The old token is no longer in use.
278
+
279
+
### Rotate a compromised token
280
+
281
+
If your tunnel token is compromised, we recommend taking the following steps:
282
+
283
+
1. Refresh the token using the dashboard or API. Refer to Step 1 of [Rotate a token without service disruption](#rotate-a-token-without-service-disruption).
284
+
2.[Delete all connections](/api/operations/cloudflare-tunnel-clean-up-cloudflare-tunnel-connections) between `cloudflared` and Cloudflare:
This will clean up any unauthorized connections and prevent users from connecting to your network.
292
+
293
+
3. On each `cloudflared` replica, update `cloudflared` to use the new token. For example, on a Linux host:
294
+
295
+
```sh
296
+
sudo cloudflared service install <TOKEN>
297
+
```
298
+
4. Restart `cloudflared`:
299
+
300
+
```sh
301
+
sudo systemctl restart cloudflared.service
302
+
```
303
+
304
+
5. Confirm that the service started correctly:
305
+
```sh
306
+
sudo systemctl status cloudflared
307
+
```
308
+
309
+
The tunnel token is now fully rotated. The old token is no longer in use.
310
+
311
+
### Account-scoped roles
312
+
313
+
Account members with [Cloudflare Access](/cloudflare-one/roles-permissions/) and [DNS](/fundamentals/setup/manage-members/roles/) permissions will be able to create, delete, and configure all tunnels for the account.
0 commit comments