Skip to content
Cloudflare Docs

Network policies

With Cloudflare Zero Trust, you can configure policies to control network-level traffic leaving your endpoints. Using network selectors like IP addresses and ports, your policies will control access to any network origin. Because Cloudflare Zero Trust integrates with your identity provider, it also gives you the ability to create identity-based network policies. This means you can now control access to non-HTTP resources on a per-user basis regardless of where they are or what device they access that resource from.

A network policy consists of an Action as well as a logical expression that determines the scope of the action. To build an expression, you need to choose a Selector and an Operator, and enter a value or range of values in the Value field. You can use And and Or logical operators to evaluate multiple conditions.

If a condition in an expression joins a query attribute (such as Source IP) and a response attribute (such as Resolved IP), then the condition will be evaluated when the response is received.

Actions

Like actions in DNS and HTTP policies, actions in network policies define which decision you want to apply to a given set of elements. You can assign one action per policy.

Allow

API value: allow

Available selectors

Traffic

Identity

Device Posture

Policies with Allow actions allow network traffic to reach certain IPs or ports. For example, the following configuration allows specific users to reach a given IP address:

SelectorOperatorValueLogicAction
Destination IPin92.100.02.102AndAllow
Emailin*@example.com

Audit SSH Deprecated

API value: audit_ssh

Available selectors

Traffic

Identity

Device Posture

Policies with Audit SSH actions allow administrators to log SSH traffic. Gateway will detect SSH traffic over port 22. For example, the following configuration logs SSH commands sent to a given IP address:

SelectorOperatorValueAction
Destination IPin203.0.113.83Audit SSH

Gateway only audits SSH traffic over port 22. Non-standard ports, including those specified with the Destination Port selector, are not supported.

For more information on SSH logging, refer to Configure SSH proxy and command logs.

Block

API value: block

Available selectors

Traffic

Identity

Device Posture

Policies with Block actions block network traffic from reaching certain IPs or ports. For example, the following configuration blocks all traffic directed to port 443:

SelectorOperatorValueAction
Destination Portin443Block

WARP client block notifications

Feature availability

WARP modesZero Trust plans
  • Gateway with WARP
  • Secure Web Gateway without DNS filtering
Enterprise
SystemAvailabilityMinimum WARP version
Windows2024.1.159.0
macOS2024.1.160.0
Linux
iOS1.7
Android1.4
ChromeOS1.4

Turn on Display block notification for WARP Client to display notifications for Gateway block events. Blocked users will receive an operating system notification from the WARP client with a custom message you set. If you do not set a custom message, the WARP client will display a default message. Custom messages must be 100 characters or less. WARP will only display one notification per minute.

Upon selecting the notification, WARP will direct your users to the Gateway block page you have configured. Optionally, you can direct users to a custom URL, such as an internal support form.

When you turn on Send policy context, Gateway will append details of the matching request to the redirected URL as a query string. Not every context field will be included. Potential policy context fields include:

Policy context fields

FieldDefinitionExample
User emailEmail of the user that made the query.&cf_user_email=user@example.com
Site URLFull URL of the original HTTP request or domain name in DNS query.&cf_site_uri=https%3A%2F%2Fmalware.testcategory.com%2F
URL categoryDomain categories of the URL to be redirected.&cf_request_categories=New%20Domains,Newly%20Seen%20Domains
Original HTTP refererFor HTTP traffic, the original HTTP referer header of the HTTP request.&cf_referer=https%3A%2F%2Fexample.com%2F
Rule IDID of the Gateway policy that matched the request.&cf_rule_id=6d48997c-a1ec-4b16-b42e-d43ab4d071d1
Source IPSource IP address of the device that matched the policy.&cf_source_ip=203.0.113.5
Device IDUUID of the device that matched the policy.&cf_device_id=6d48997c-a1ec-4b16-b42e-d43ab4d071d1
Application namesName of the application the redirected domain corresponds to, if any.&cf_application_name=Salesforce
FilterThe traffic type filter that triggered the block.&cf_filter=http, &cf_filter=dns, &cf_filter=av, or &cf_filter=l4
Account IDCloudflare account ID of the associated Zero Trust account.&cf_account_id=d57c3de47a013c03ca7e237dd3e61d7d
Query IDID of the DNS query for which the redirect took effect.&cf_query_id=f8dc6fd3-a7a5-44dd-8b77-08430bb4fac3
Connection IDID of the proxy connection for which the redirect took effect.&cf_connection_id=f8dc6fd3-a7a5-44dd-8b77-08430bb4fac3
Request IDID of the HTTP request for which the redirect took effect.&cf_request_id=f8dc6fd3-a7a5-44dd-8b77-08430bb4fac3

Ensure that your operating system allows notifications for WARP. Your device may not display notifications if focus, do not disturb, or screen sharing settings are turned on. To turn on client notifications on macOS devices running DisplayLink software, you may have to allow system notifications when mirroring your display. For more information, refer to the macOS documentation.

Network Override

API value: l4_override

Available selectors

Traffic