コンテンツにスキップ

ネットワークポリシー

Cloudflare Zero Trustを使用すると、エンドポイントから出て行くネットワークレベルのトラフィックを制御するポリシーを構成できます。IPアドレスやポートなどのネットワークセレクタを使用して、ポリシーは任意のネットワークオリジンへのアクセスを制御します。Cloudflare Zero Trustはアイデンティティプロバイダーと統合されているため、アイデンティティベースのネットワークポリシーを作成する能力も提供します。これにより、ユーザーごとに、リソースにアクセスする場所やデバイスに関係なく、非HTTPリソースへのアクセスを制御できるようになります。

ネットワークポリシーは、アクションとアクションの範囲を決定する論理式で構成されます。式を構築するには、セレクタオペレーターを選択し、フィールドに値または値の範囲を入力する必要があります。AndおよびOrの論理演算子を使用して、複数の条件を評価できます。

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.

アクション

DNSおよびHTTPポリシーのアクションと同様に、ネットワークポリシーのアクションは、特定の要素セットに適用したい決定を定義します。ポリシーごとに1つのアクションを割り当てることができます。

許可

API値: allow

利用可能なセレクタ

トラフィック

アイデンティティ

デバイスポスチャ

許可アクションを持つポリシーは、特定のIPまたはポートにネットワークトラフィックが到達することを許可します。たとえば、次の構成は特定のユーザーが指定されたIPアドレスに到達することを許可します:

セレクタオペレーター論理アクション
宛先IPin92.100.02.102And許可
メールin*@example.com

SSH監査

API値: audit_ssh

利用可能なセレクタ

トラフィック

アイデンティティ

デバイスポスチャ

SSH監査アクションを持つポリシーは、管理者がSSHトラフィックをログに記録できるようにします。ゲートウェイはポート22上のSSHトラフィックを検出します。たとえば、次の構成は指定されたIPアドレスに送信されたSSHコマンドをログに記録します:

セレクタオペレーターアクション
宛先IPin203.0.113.83SSH監査

SSHログ記録の詳細については、SSHプロキシとコマンドログの設定を参照してください。

ブロック

API値: block

利用可能なセレクタ

トラフィック

アイデンティティ

デバイスポスチャ

ブロックアクションを持つポリシーは、特定のIPまたはポートにネットワークトラフィックが到達することをブロックします。たとえば、次の構成はポート443に向けられたすべてのトラフィックをブロックします:

セレクタオペレーターアクション
宛先ポートin443ブロック

WARPクライアントブロック通知 Early Access

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.3
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.

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

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.

ネットワークオーバーライド

API値: l4_override

利用可能なセレクタ

トラフィック

アイデンティティ

デバイスポスチャ

ネットワークオーバーライドアクションを持つポリシーは、特定のIPv4/IPv6アドレスまたはポートに向けられた、またはそこから来るトラフィックをオーバーライドします。宛先IPは、Zero Trustネットワークに接続されたパブリックIPまたはプライベートIPである可能性があります。たとえば、次の構成は、ユーザーのアイデンティティに基づいて、パブリックIPに送信されたトラフィックをプライベートIPにオーバーライドします:

セレクタオペレーター論理アクション
宛先IPin95.92.143.151Andネットワークオーバーライド
ユーザーのメールin*@example.comAnd
オーバーライドIP10.0.0.1

セレクタ

ゲートウェイは、以下のセレクタまたは基準に対してネットワークトラフィックを照合します。

アプリケーション

You can apply network policies to a growing list of popular web applications. Refer to Application and app types for more information.

UI nameAPI exampleEvaluation phase
Applicationany(app.ids[*] in {505})Before DNS resolution

宛先大陸

The continent where the request is destined. Geolocation is determined from the target IP address. To specify a continent, enter its two-letter code into the Value field:

  • AF – Africa
  • AN – Antarctica
  • AS – Asia
  • EU – Europe
  • NA – North America
  • OC – Oceania
  • SA – South America
  • T1 – Tor network
UI nameAPI example
Destination Continent IP Geolocationnet.dst.geo.continent == “EU”

宛先国

The country that the request is destined for. Geolocation is determined from the target IP address. To specify a country, enter its ISO 3166-1 Alpha 2 code in the Value field.

UI nameAPI example
Destination Country IP Geolocationnet.dst.geo.country == “RU”

宛先IP

The IP address of the request’s target.

UI nameAPI example
Destination IPnet.dst.ip == "10.0.0.0/8"

宛先ポート

The port number of the request’s target.

UI nameAPI example
Destination Portnet.dst.port == "2222"

検出されたプロトコル

The inferred network protocol based on our protocol detection.

UI nameAPI example
Detected Protocolnet.protocol.detection == "ssh"

This selector is available in early access for Enterprise users. For more information, contact your account team.

デバイスポスチャ

With the Device Posture selector, admins can use signals from end-user devices to secure access to their internal and external resources. For example, a security admin can choose to limit all access to internal applications based on whether specific software is installed on a device and/or if the device or software are configured in a particular way.

For more information on device posture checks, refer to Device posture.

UI nameAPI example
Passed Device Posture Checksany(device_posture.checks.failed[*] in {"1308749e-fcfb-4ebc-b051-fe022b632644"}), any(device_posture.checks.passed[*] in {"1308749e-fcfb-4ebc-b051-fe022b632644"})"

プロトコル

The protocol used to send the packet.

UI nameAPI example
Protocolnet.protocol == "tcp"

プロキシエンドポイント

The proxy server where your browser forwards HTTP traffic.

UI nameAPI example
Proxy Endpointproxy.endpoint == "3ele0ss56t.proxy.cloudflare-gateway.com"

SNI

The host whose Server Name Indication (SNI) header Gateway will filter traffic against. This will allow for an exact match.

This selector only applies to traffic on port 443.

UI nameAPI example
SNInet.sni.host == "www.example.com"

SNIドメイン

The domain whose Server Name Indication (SNI) header Gateway will filter traffic against. For example, a rule for example.com will match example.com, www.example.com, and my.test.example.com.

This selector only applies to traffic on port 443.

UI nameAPI example
SNI Domainnet.sni.domains == "example.com"

送信元大陸

リクエストを行っているユーザーの大陸。

Geolocation is determined from the device’s public IP address (typically assigned by the user’s ISP). To specify a continent, enter its two-letter code into the Value field:

ContinentCode
AfricaAF
AntarcticaAN
AsiaAS
EuropeEU
North AmericaNA
OceaniaOC
South AmericaSA
Tor networkT1
UI nameAPI exampleEvaluation phase
Source Continent IP Geolocationnet.src.geo.continent == “North America”Before DNS resolution

送信元国

リクエストを行っているユーザーの国。

Geolocation is determined from the device’s public IP address (typically assigned by the user’s ISP). To specify a country, enter its ISO 3166-1 Alpha-2 code in the Value field.

UI nameAPI exampleEvaluation phase
Source Country IP Geolocationnet.src.geo.country == “RU”Before DNS resolution

送信元内部IP

Use this selector to apply network policies to a private IP address, assigned by a user’s local network, that requests arrive to Gateway from. This selector will only apply to users connected through a Magic GRE or IPSec tunnel.

UI nameAPI example
Source Internal IPnet.src.internal_src_ip == “192.168.86.0/27”

送信元IP

UI nameAPI example
Source IPnet.src.ip == "10.0.0.0/8"

送信元ポート

UI nameAPI example
Source Portnet.src.port == "2222"

ユーザー

Identity-based selectors include:

  • SAML Attributes
  • User Email
  • User Group Emails
  • User Group IDs
  • User Group Names
  • User Name

To use identity-based selectors, enable Gateway with WARP in the Zero Trust WARP client and enroll your user in your organization. For more information, refer to Identity-based policies.

仮想ネットワーク

Use this selector to match all traffic routed through a specific Tunnel Virtual Network via the WARP client.

UI nameAPI example
Virtual Networknet.vnet_id == “957fc748-591a-e96s-a15d-1j90204a7923”

比較演算子

Comparison operators are the way Gateway matches traffic to a selector. When you choose a Selector in the dashboard policy builder, the Operator dropdown menu will display the available options for that selector.

OperatorMeaning
isequals the defined value
is notdoes not equal the defined value
inmatches at least one of the defined values
not indoes not match any of the defined values
in listin a pre-defined list of values
not in listnot in a pre-defined list of values
matches regexregex evaluates to true
does not match regexregex evaluates to false
greater thanexceeds the defined number
greater than or equal toexceeds or equals the defined number
less thanbelow the defined number
less than or equal tobelow or equals the defined number

In the Value field, you can input a single value when using an equality comparison operator (such as is) or multiple values when using a containment comparison operator (such as in). Additionally, you can use regular expressions (or regex) to specify a range of values for supported selectors.

Regular expressions

Gateway uses Rust to evaluate regular expressions. The Rust implementation is slightly different than regex libraries used elsewhere. For more information, refer to our guide for Wildcards. To evaluate if your regex matches, you can use Rustexp.

If you want to match multiple values, you can use the pipe symbol (|) as an OR operator. In Gateway, you do not need to use an escape character (\) before the pipe symbol. For example, the following policy blocks requests to two SNI hosts if either appears in a request header:

SelectorOperatorValueAction
SNImatches regex.\*whispersystems.org|.\*signal.orgBlock

In addition to regular expressions, you can use logical operators to match multiple values.

論理演算子

To evaluate multiple conditions in an expression, select the And logical operator. These expressions can be compared further with the Or logical operator.

OperatorMeaning
Andmatch all of the conditions in the expression
Ormatch any of the conditions in the expression

The Or operator will only work with conditions in the same expression group. For example, you cannot compare conditions in Traffic with conditions in **アイデンティティ**または**デバイスポスチャ**.