Managed networks
Cloudflare WARP allows you to selectively apply WARP client settings if the device is connected to a secure network location such as an office.
A TLS endpoint is a host on your network that serves a TLS certificate. The TLS endpoint acts like a network location beacon — when a device connects to a network, WARP detects the TLS endpoint and validates its certificate against an uploaded SHA-256 fingerprint.
The TLS certificate can be hosted by any device on your network. However, the endpoint must be inaccessible to users outside of the network location. WARP will automatically exclude the managed network endpoint from all device profiles to ensure that users cannot connect to this endpoint over Cloudflare Tunnel. We recommend choosing a host that is physically in the office which remote users do not need to access, such as a printer.
If you do not already have a TLS endpoint on your network, you can set one up as follows:
- Generate a TLS certificate:
The command will output a certificate in PEM format and its private key. Store these files in a secure place.
- Next, configure an HTTPS server on your network to use this certificate and key. The examples below demonstrate how to run a barebones HTTPS server that responds to requests with a
200
status code:
nginx in Docker
To serve the TLS certificate from an nginx container in Docker:
-
Create an nginx configuration file called
nginx.conf
:
If needed, replace /certs/example.pem
and /certs/example.key
with the locations of your certificate and key.
-
Add the nginx image to your Docker compose file:
If needed, replace
./nginx.conf
and./certs
with the locations of your nginx configuration file and certificate. -
Start the server:
Python
To serve the TLS certificate using Python:
-
Create a Python 3 script called
myserver.py
: -
Run the script:
- To test that the server is working, run a curl command from the end user’s device:
You need to pass the insecure
option because we are using a self-signed certificate. If the device is connected to the network, the request should return a 200
status code.
The WARP client establishes a TLS connection using Rustls ↗. Make sure your TLS endpoint accepts one of the cipher suites supported by Rustls ↗.
To obtain the SHA-256 fingerprint of a local certificate:
The output will look something like:
To obtain the SHA-256 fingerprint of a remote server:
The output will look something like:
- In Zero Trust ↗, go to Settings > WARP Client.
- Scroll down to Network locations and select Add new.
- Name your network location.
- In Host and Port, enter the private IP address and port number of your TLS endpoint (for example,
192.168.185.198:3333
). - (Optional) In TLS Cert SHA-256, enter the SHA-256 fingerprint of the TLS certificate. This field is only needed for self-signed certificates. If a TLS fingerprint is not supplied, WARP validates the certificate against the local certificate store and checks that it is signed by a public certificate authority.
WARP will automatically exclude the TLS endpoint from all device profiles. This prevents remote users from accessing the endpoint through the WARP tunnel on any port. If a device profile uses Split Tunnels in Include mode, make sure that the Split Tunnel entries do not contain the TLS endpoint IP address; otherwise, the entire IP range will be excluded from the WARP tunnel.
-
In Zero Trust ↗, go to Settings > WARP Client.
-
Under Profile settings, create a new settings profile or edit an existing profile.
-
To apply this profile whenever a device connects to your network, add the following rule:
Selector Operator Value Managed network is <NETWORK-NAME>
-
Save the profile.
Managed networks are now enabled. Every time a device in your organization connects to a network (for example, when waking up the device or changing Wi-Fi networks), the WARP client will determine its network location and apply the corresponding settings profile.
To check if the WARP client detects the network location:
- Turn on WARP.
- Disconnect and reconnect to the network.
- Open a terminal and run
warp-cli debug alternate-network
.
- The WARP client scans all managed networks every time it detects a network change event from the operating system. To minimize performance impact, we recommend reusing the same TLS endpoint across multiple locations unless you require distinct settings profiles for each location.
- Ensure that the device can only reach one managed network at any given time. If multiple managed networks are configured and reachable, there is no way to determine which settings profile the device will receive.