コンテンツにスキップ

DNSポリシー

ユーザーがGatewayにDNSリクエストを行うと、Gatewayはそのリクエストを組織のために設定したDNSポリシーと照合します。ドメインがブロックされたカテゴリに属していない場合、またはOverrideポリシーに一致する場合、ユーザーのクライアントはDNS解決を受け取り、HTTP接続を開始します。

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

DNSポリシーを作成する際には、ネットワークを完全に保護するために必要なだけのセキュリティリスクカテゴリとコンテンツカテゴリを選択できます。ポリシーにより具体的なセレクタ(たとえば、ユーザーのメールソースIP)が設定されていない限り、ポリシーは組織からGatewayに到達するすべてのDNSクエリに対して評価されます。

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.

アクション

HTTPポリシーのアクションと同様に、DNSポリシーのアクションでは、特定の要素のセットに対して何をするかを選択できます。ポリシーごとに1つのアクションを割り当てることができます。

選択できるアクションタイプは次のとおりです:

許可

API値: allow

利用可能なセレクタ

トラフィック

アイデンティティ

許可アクションを持つポリシーは、セレクタおよび値フィールド内で指定した宛先にDNSクエリが到達することを許可します。たとえば、次の構成は、教育コンテンツカテゴリに属すると分類されるドメインにDNSクエリが到達することを許可します:

セレクタオペレーターアクション
コンテンツカテゴリin教育許可

DNSSEC検証の無効化

DNSSEC検証を無効にするを選択すると、GatewayはDNSレコードの暗号署名が検証できなくてもDNSクエリを解決します。DNSSEC検証の無効化は、検証失敗がDNSSEC設定の問題によるものであり、悪意のある攻撃によるものでないことがわかっている場合を除き、お勧めしません。

ブロック

API値: block

利用可能なセレクタ

トラフィック

アイデンティティ

ブロックアクションを持つポリシーは、セレクタおよび値フィールド内で指定した宛先にDNSクエリが到達することをブロックします。たとえば、次の構成は、成人向けテーマのコンテンツカテゴリに属すると分類されるドメインへのDNSクエリが到達することをブロックします:

セレクタオペレーターアクション
コンテンツカテゴリin成人向けテーマブロック

カスタムブロックページ

ブロックアクションを選択する際に、カスタムブロックページを表示をオンにすると、ブロックページでクエリに応答し、ブロックされたウェブサイトにアクセスしたユーザーに表示したいメッセージを指定できます。ブロックページが無効になっている場合、Gatewayはブロックされたクエリに対してIPv4宛先には0.0.0.0Aレコード、IPv6宛先には::AAAAレコードで応答します。詳細については、カスタムブロックページの設定に関する専用のドキュメントを参照してください。

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値: override

利用可能なセレクタ

オーバーライドアクションは、DNS解決中またはその後に評価されるセレクタと一緒に使用することはできません。

トラフィック

アイデンティティ

オーバーライドアクションを持つポリシーは、特定のドメインに対するすべてのDNSクエリに別の宛先で応答することを許可します。たとえば、次のポリシーを使用して、www.example.comへのすべてのクエリに対してカスタム応答IP 1.2.3.4を提供できます:

セレクタオペレーターアクションオーバーライドホスト名
ホスト名iswww.example.comオーバーライド1.2.3.4

安全な検索

API値: safesearch

利用可能なセレクタ

トラフィック

アイデンティティ

SafeSearchは、検索エンジンの機能で、明示的または攻撃的なコンテンツをフィルタリングするのに役立ちます。SafeSearchを有効にすると、検索エンジンは明示的または攻撃的なコンテンツをフィルタリングし、子供や職場に安全な検索結果を返します。

Cloudflare Gatewayを使用して、Google、Bing、Yandex、YouTube、DuckDuckGoなどの検索エンジンでSafeSearchを有効にできます。たとえば、GoogleのSafeSearchを有効にするには、次のポリシーを作成できます:

セレクタオペレーターアクション
ドメインisgoogle.com安全な検索

YouTube制限モード

API値: ytrestricted

利用可能なセレクタ

トラフィック

アイデンティティ

同様に、YouTube制限アクションを選択することでYouTube制限モードを強制することができます。YouTube制限モードは、YouTubeに組み込まれた成人向けおよび攻撃的なコンテンツの自動フィルタです。YouTube制限モードを有効にするには、次のようなポリシーを設定できます:

セレクタオペレーターアクション
DNSドメインisyoutube.comYouTube制限

この設定により、ユーザーはDNSを使用して攻撃的なサイトにアクセスできなくなります。

セレクタ

Gatewayは、次のセレクタまたは基準に対してDNSクエリを照合します:

アプリケーション

You can apply DNS 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

権威あるネームサーバーIP

このセレクタを使用して、権威あるネームサーバーのIPアドレスに対して照合します。

UI名API例評価フェーズ
権威あるネームサーバーIPdns.authoritative_ns_ips == 198.51.100.0DNS解決中

コンテンツカテゴリ

Use this selector to filter domains belonging to specific content categories.

UI nameAPI exampleEvaluation phase
Content Categoriesany(dns.content_category[*] in {1})Before DNS resolution

When using an Allow or Block action, you can optionally block IP addresses or filter categories for CNAME records.

DNS CNAMEレコード

このセレクタを使用して、DNS応答をそのCNAMEレコードでフィルタリングします。

UI名API例評価フェーズ
DNS CNAME応答値any(dns.response.cname[*] in {"www.apple.com.edgekey.net"})DNS解決後

DNS MXレコード

このセレクタを使用して、DNS応答をそのMXレコードでフィルタリングします。

UI名API例評価フェーズ
DNS MX応答値any(dns.response.mx[*] in {"gmail-smtp-in.l.google.com"})DNS解決後

DNS PTRレコード

このセレクタを使用して、DNS応答をそのPTRレコードでフィルタリングします。

UI名API例評価フェーズ
DNS PTR応答値any(dns.response.ptr[*] in {"255.2.0.192.in-addr.arpa"})DNS解決後

DNSリゾルバIP

Use this selector to apply policies to DNS queries that arrived to your Gateway Resolver IP address aligned with a registered DNS location. For most Gateway customers, this is an IPv4 anycast address and policies created using this IPv4 address will apply to all DNS locations. However, each DNS location has a dedicated IPv6 address and some Gateway customers have been supplied with a dedicated IPv4 address — these both can be used to apply policies to specific registered DNS locations.

UI nameAPI exampleEvaluation phase
DNS Resolver IPany(dns.resolved_ip[*] == 198.51.100.0)Before DNS resolution

DNS TXTレコード

このセレクタを使用して、DNS応答をそのTXTレコードでフィルタリングします。

UI名API例評価フェーズ
DNS TXT応答値any(dns.response.txt[*] in {"your_text"})DNS解決後

DoHサブドメイン

Use this selector to match against DNS queries that arrive via DNS-over-HTTPS (DoH) destined for the DoH endpoint configured for each DNS location. For example, you can use a DNS location with a DoH endpoint of abcdefg.cloudflare-gateway.com by choosing the DoH Subdomain selector and inputting a value of abcdefg.

UI nameAPI exampleEvaluation phase
DOH Subdomaindns.doh_subdomain == "abcdefg"Before DNS resolution

ドメイン

Use this selector to match against a domain and all subdomains. For example, you can match example.com and its subdomains, such as www.example.com.

UI nameAPI exampleEvaluation phase
Domainany(dns.domains[*] == "example.com")Before DNS resolution

ホスト

Use this selector to match against only the hostname specified. For example, you can match test.example.com but not example.com or www.test.example.com.

UI nameAPI exampleEvaluation phase
Hostdns.fqdn == "test.example.com"Before DNS resolution

インジケータフィード

Use this selector to match against custom indicator feeds. To enable this selector, a designated third-party vendor must assign a custom indicator feed to your account.

UI nameAPI exampleEvaluation phase
Indicator Feedsdns.indicator_feedBefore DNS resolution

ロケーション

Use this selector to apply policies to a specific Gateway DNS location or set of locations.

UI nameAPI exampleEvaluation phase
Locationdns.location in {"location_uuid_1" "location_uuid_2"}Before DNS resolution

クエリレコードタイプ

Use this selector to choose the DNS resource record type that you would like to apply policies against. For example, you can match A records for a domain but not MX records.

UI nameAPI exampleEvaluation phase
Query Record Typedns.query_rtype == "TXT"Before DNS resolution

解決された大陸

このセレクタを使用して、クエリが解決される大陸に基づいてフィルタリングします。ジオロケーションは、応答内のIPアドレスから決定されます。大陸を指定するには、その2文字コードをフィールドに入力します:

  • AF – アフリカ
  • AN – 南極
  • AS – アジア
  • EU – ヨーロッパ
  • NA – 北アメリカ
  • OC – オセアニア
  • SA – 南アメリカ
  • T1 – Torネットワーク
UI nameAPI exampleEvaluation phase
解決済み大陸IPジオロケーションdns.dst.geo.continent == "EU"DNS解決後

解決済み国

このセレクタを使用して、クエリが解決される国に基づいてフィルタリングします。ジオロケーションは、レスポンス内のIPアドレスから決定されます。国を指定するには、ValueフィールドにそのISO 3166-1 Alpha 2コードを入力します。

UI nameAPI exampleEvaluation phase
解決済み国IPジオロケーションdns.dst.geo.country == "RU"DNS解決後

解決済みIP

このセレクタを使用して、クエリが解決されるIPアドレスに基づいてフィルタリングします。

UI nameAPI exampleEvaluation phase
解決済みIPany(dns.resolved_ips[*] == 198.51.100.0)DNS解決後

セキュリティカテゴリ

Use this selector to match domains (and optionally, IP addresses) belonging to specific security categories.

UI nameAPI exampleEvaluation phase
Security Categoriesany(dns.security_category[*] in {1})Before DNS resolution

When using an Allow or Block action, you can optionally block IP addresses or filter categories for CNAME records.

ソース大陸

このセレクタを使用して、クエリがGatewayに到達した大陸に基づいてフィルタリングします。

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 Geolocationdns.src.geo.continent == “North America”Before DNS resolution

ソース国

このセレクタを使用して、クエリがGatewayに到達した国に基づいてフィルタリングします。

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 Geolocationdns.src.geo.country == “RU”Before DNS resolution

ソースIP

Use this selector to apply policies to the source IP address of DNS queries. For example, this could be the WAN IP address of the stub resolver used by your organization to send queries to Gateway.

UI nameAPI exampleEvaluation phase
Source IPdns.src_ip == 198.51.100.0Before DNS resolution

ユーザー

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.

比較演算子

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 hostnames if either appears in a request header:

SelectorOperatorValueAction
Hostmatches 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 Identity.

制限事項

サードパーティフィルタリングの競合

Gatewayは、iCloud Private RelayなどのサードパーティVPNや他のインターネットフィルタリングソフトウェアを通じて送信されたトラフィックを適切にフィルタリングしません。DNSポリシーがトラフィックに適用されることを確実にするために、Gatewayに干渉する可能性のあるソフトウェアを制限することをお勧めします。

Magic WAN転送

Magic WANを通じて転送されたクエリにDNSポリシーを適用するには、組織のDNSリゾルバをIPv6、DoH、またはDoTエンドポイントにポイントするか、専用のリゾルバIPv4アドレスをリクエストする必要があります。詳細については、DNSリゾルバIPとホスト名を参照してください。