Alessandro Frigerio 79c7547d81 TUN-10799: Negotiate protected mode during Quick Tunnel provisioning
## Summary

Lands the request and data plumbing needed for protected Quick Tunnel provisioning.

This is intentionally staged dead code: `--allowed-mail` is not registered yet, so protected provisioning is not user-reachable in this MR. The existing public Quick Tunnel path remains unchanged. CLI registration and release notes will land when the feature becomes user-reachable.

## Changes

- Add `auth_mode` constants for protected quick tunnels
- Add `buildQuickTunnelRequestBody` helper to construct the OTP request body
- Read `--allowed-mail` values and compute `isProtected` once the flag is registered
- Send `{"auth_mode":"otp"}` when protected mode is requested
- Set `TunnelProperties.IsProtected` for downstream auth handlers
- Preserve structured Worker errors for non-2xx and unsuccessful responses
- Add unit tests for public and protected request bodies
- Add a TODO for CLI-level provisioning-error coverage under TUN-10791

## Validation

- `make test lint`
- Built the `cloudflared` binary locally
- Confirmed `--allowed-mail` is currently rejected as an undefined flag
- Confirmed a public invocation sends a bodyless provisioning request to a mock service
- Confirmed the mock Worker's `503` / `[1234] expected test failure` response is shown by the CLI

## Acceptance criteria

- [x] Protected request construction sends only the supported authentication mode
- [x] Public provisioning request remains bodyless
- [x] Unit tests cover public and protected request bodies
- [x] Current staged CLI behavior manually verified
- [x] Register `--allowed-mail` and make protected mode user-reachable (follow-up)
- [ ] Full CLI/integration coverage under TUN-10791

## Related

- Epic: RM-25152
- Previous/foundation work: TUN-10798
- End-to-end coverage: TUN-10791
2026-09-03 13:03:59 +00:00
2026-09-02 16:21:50 -07:00
2026-04-29 13:09:22 +00:00
2026-08-12 16:12:32 +01:00
2023-07-17 19:08:38 +00:00
2026-08-12 16:12:32 +01:00
2026-08-12 16:12:32 +01:00
2026-08-12 16:12:32 +01:00
2025-04-01 18:57:55 +01:00
2023-07-17 19:08:38 +00:00
2026-08-27 08:38:54 -07:00
2024-11-11 20:45:49 +05:30
2025-06-06 09:05:49 +00:00
2024-11-11 20:45:49 +05:30
2023-07-26 13:52:40 -07:00
2026-09-02 16:21:50 -07:00
2026-09-02 16:21:50 -07:00
2026-09-02 16:21:50 -07:00
2026-09-02 16:21:50 -07:00
2026-09-02 16:21:50 -07:00
2026-09-02 16:21:50 -07:00
2026-09-02 16:21:50 -07:00
2026-09-02 16:21:50 -07:00
2026-09-02 16:21:50 -07:00
2026-09-02 16:21:50 -07:00
2026-09-02 16:21:50 -07:00
2026-04-29 13:09:22 +00:00
2026-08-31 10:48:10 +01:00
2026-06-30 17:19:15 +01:00

Cloudflare Tunnel client

Contains the command-line client for Cloudflare Tunnel, a tunneling daemon that proxies traffic from the Cloudflare network to your origins. This daemon sits between Cloudflare network and your origin (e.g. a webserver). Cloudflare attracts client requests and sends them to you via this daemon, without requiring you to poke holes on your firewall --- your origin can remain as closed as possible. Extensive documentation can be found in the Cloudflare Tunnel section of the Cloudflare Docs. All usages related with proxying to your origins are available under cloudflared tunnel help.

You can also use cloudflared to access Tunnel origins (that are protected with cloudflared tunnel) for TCP traffic at Layer 4 (i.e., not HTTP/websocket), which is relevant for use cases such as SSH, RDP, etc. Such usages are available under cloudflared access help.

You can instead use WARP client to access private origins behind Tunnels for Layer 4 traffic without requiring cloudflared access commands on the client side.

Before you get started

Before you use Cloudflare Tunnel, you'll need to complete a few steps in the Cloudflare dashboard: you need to add a website to your Cloudflare account. Note that today it is possible to use Tunnel without a website (e.g. for private routing), but for legacy reasons this requirement is still necessary:

  1. Add a website to Cloudflare
  2. Change your domain nameservers to Cloudflare

Installing cloudflared

Downloads are available as standalone binaries, a Docker image, and Debian, RPM, and Homebrew packages. You can also find releases here on the cloudflared GitHub repository.

User documentation for Cloudflare Tunnel can be found at https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/

Creating Tunnels and routing traffic

Once installed, you can authenticate cloudflared into your Cloudflare account and begin creating Tunnels to serve traffic to your origins.

TryCloudflare

Want to test Cloudflare Tunnel before adding a website to Cloudflare? You can do so with TryCloudflare using the documentation available here.

Deprecated versions

Cloudflare currently supports versions of cloudflared that are within one year of the most recent release. Breaking changes unrelated to feature availability may be introduced that will impact versions released more than one year ago. You can read more about upgrading cloudflared in our developer documentation.

For example, as of January 2023 Cloudflare will support cloudflared version 2023.1.1 to cloudflared 2022.1.1.

Development

Requirements

Build

To build cloudflared locally run make cloudflared

Test

To locally run the tests run make test

Linting

To format the code and keep a good code quality use make fmt and make lint

Mocks

After changes on interfaces you might need to regenerate the mocks, so run make mocks

Git Hooks

To avoid CI errors, you can install pre-push hooks that run linting and tests before each push:

make install-hooks

This will configure git to use the hooks in .githooks/ that run make fmt-check lint test before each push.

Languages
Go 91.3%
Python 6.1%
Shell 0.8%
HTML 0.6%
Makefile 0.4%
Other 0.8%