Skip to content

非公式 / UnofficialCloudflare, Inc. 非提携。アカウント情報は入力しないでください。Not affiliated with Cloudflare, Inc. Do not enter Cloudflare credentials here.Official docsこのサイトについてプライバシー

推奨 DNS ポリシー

最終更新 Markdown で表示Agent セットアップ

組織向けのインターネットおよび SaaS アプリのセキュリティ戦略を構築するため、次の DNS ポリシーを追加することを推奨します。

よく使う DNS ポリシーの追加例は よく使う DNS ポリシー を参照してください。DNS ポリシーの作成方法は DNS ポリシー を参照してください。

All-DNS-Domain-Allowlist

既知のドメインとホスト名を許可リストに登録します。このポリシーにより、Newly Seen Domains や Login Screens などブロック対象のカテゴリに該当する場合でも、組織のドメインへアクセスできます。

セレクター 演算子 値 ロジック アクション
Domain in list Known Domains Or Allow
Host in list Known Domains
Create a Zero Trust Gateway rulebash
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/gateway/rules" \
	--request POST \
	--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
	--json '{
		"name": "All-DNS-Domain-Allowlist",
		"description": "Allowlist any known domains and hostnames",
		"precedence": 0,
		"enabled": true,
		"action": "allow",
		"filters": [
				"dns"
		],
		"traffic": "any(dns.domains[*] in $<KNOWN_DOMAINS_LIST_UUID>) or dns.fqdn in $<KNOWN_DOMAINS_LIST_UUID>"
	}'
resource "cloudflare_zero_trust_gateway_policy" "dns_whitelist_policy" {
  account_id  = var.cloudflare_account_id
  name        = "All-DNS-Domain-Allowlist"
  description = "Allowlist any known domains and hostnames"
  precedence  = 0
  enabled     = true
  action      = "allow"
  filters     = ["dns"]
  traffic     = "any(dns.domains[*] in ${"$"}${cloudflare_zero_trust_list.domain_whitelist.id}) or dns.fqdn in ${"$"}${cloudflare_zero_trust_list.domain_whitelist.id}"
}

Quarantined-Users-DNS-Restricted-Access

リスクの高いユーザー向けの identity provider (IdP) ユーザーグループに含まれるユーザーのアクセスを制限します。このポリシーにより、セキュリティチームは、悪意のある、または不審なアクティビティが検出されたユーザーのトラフィックを制限できます。

セレクター 演算子 値 ロジック アクション
Domain not in list Allowed Remediation Domains Or Block
Host not in list Allowed Remediation Domains And
User Group Names in Quarantined Users
Create a Zero Trust Gateway rulebash
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/gateway/rules" \
	--request POST \
	--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
	--json '{
		"name": "Quarantined-Users-DNS-Restricted-Access",
		"description": "Restrict access for users included in an identity provider (IdP) user group for risky users",
		"precedence": 10,
		"enabled": true,
		"action": "block",
		"filters": [
				"dns"
		],
		"traffic": "not(any(dns.domains[] in $<ALLOWED_REMEDIATION_DOMAINS_LIST_UUID>)) or not(any(dns.domains[] in $<ALLOWED_REMEDIATION_DOMAINS_LIST_UUID>))",
		"identity": "any(identity.groups.name[*] in {\"Quarantined Users\"})"
	}'
resource "cloudflare_zero_trust_gateway_policy" "dns_restrict_quarantined_users" {
  account_id  = var.cloudflare_account_id
  name        = "Quarantined-Users-DNS-Restricted-Access"
  description = "Restrict access for users included in an identity provider (IdP) user group for risky users"
  precedence  = 10
  enabled     = true
  action      = "block"
  filters     = ["dns"]
  traffic     = "not(any(dns.domains[*] in ${"$"}${cloudflare_zero_trust_list.allowed_remediation_domains.id})) or not(any(dns.domains[*] in ${"$"}${cloudflare_zero_trust_list.allowed_remediation_domains.id}))"
	identity		=	"any(identity.groups.name[*] in {\"Quarantined Users\"})"
}

All-DNS-SecurityCategories-Blocklist

Cloudflare の脅威インテリジェンスに基づき、Command and Control & Botnet や Malware などの セキュリティカテゴリ をブロックします。

セレクター 演算子 値 アクション
Security Categories in All security risks Block
Create a Zero Trust Gateway rulebash
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/gateway/rules" \
	--request POST \
	--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
	--json '{
		"name": "All-DNS-SecurityCategories-Blocklist",
		"description": "Block security categories based on Cloudflare'\''s threat intelligence",
		"precedence": 20,
		"enabled": true,
		"action": "block",
		"filters": [
				"dns"
		],
		"traffic": "any(dns.security_category[*] in {68 178 80 83 176 175 117 131 134 151 153})",
		"identity": ""
	}'
resource "cloudflare_zero_trust_gateway_policy" "block_security_threats" {
  account_id  = var.cloudflare_account_id
  name        = "All-DNS-SecurityCategories-Blocklist"
  description = "Block security categories based on Cloudflare's threat intelligence"
  precedence  = 20
	enabled     = true
  action      = "block"
  filters     = ["dns"]
  traffic     = "any(dns.security_category[*] in {68 178 80 83 176 175 117 131 134 151 153})"
}

All-DNS-ContentCategories-Blocklist

セキュリティリスクコンテンツサブカテゴリ の項目(New Domains など)は、常にセキュリティ上の脅威になるわけではありません。まず Allow ポリシーを作成し、ポリシーの一致を追跡して誤検知を特定することを推奨します。誤検知は、All-DNS-Domain-Allowlist で使う Trusted Domains リストに追加できます。

テストが完了したら、組織へのリスクを抑えるため、アクションを Block に変更することを推奨します。

セレクター 演算子 値 アクション
Content Categories in Questionable Content, Security Risks, Miscellaneous Block
Create a Zero Trust Gateway rulebash
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/gateway/rules" \
	--request POST \
	--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
	--json '{
		"name": "All-DNS-ContentCategories-Blocklist",
		"description": "Block common content categories that may pose a risk",
		"precedence": 30,
		"enabled": true,
		"action": "block",
		"filters": [
				"dns"
		],
		"traffic": "any(dns.content_category[*] in {17 85 87 102 157 135 138 180 162 32 169 177 128 15 115 119 124 141 161})",
		"identity": ""
	}'
resource "cloudflare_zero_trust_gateway_policy" "block_content_categories" {
  account_id  = var.cloudflare_account_id
  name        = "All-DNS-ContentCategories-Blocklist"
  description = "Block common content categories that may pose a risk"
  enabled     = true
  action      = "block"
  filters     = ["dns"]
  traffic     = "any(dns.content_category[*] in {17 85 87 102 157 135 138 180 162 32 169 177 128 15 115 119 124 141 161})"
  identity    = ""
}

All-DNS-Application-Blocklist

許可されていないアプリケーションをブロックし、ユーザーが特定のウェブツールへアクセスできないようにして、シャドーIT のリスクを抑えます。たとえば、次のポリシーは既知の AI ツールをブロックします。

セレクター 演算子 値 アクション
Application in Artificial Intelligence Block
Create a Zero Trust Gateway rulebash
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/gateway/rules" \
	--request POST \
	--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
	--json '{
		"name": "All-DNS-Application-Blocklist",
		"description": "Block access to unauthorized AI applications",
		"precedence": 40,
		"enabled": true,
		"action": "block",
		"filters": [
				"dns"
		],
		"traffic": "any(app.type.ids[*] in {25})",
		"identity": ""
	}'
resource "cloudflare_zero_trust_gateway_policy" "block_unauthorized_apps" {
  account_id  = var.cloudflare_account_id
  name        = "All-DNS-Application-Blocklist"
  description = "Block access to unauthorized AI applications"
  enabled     = true
  action      = "block"
  filters     = ["dns"]
  traffic     = "any(app.type.ids[*] in {25})"
  identity    = ""
}

All-DNS-GeoCountryIP-Blocklist

高リスクに分類される国でホストされているウェブサイトをブロックします。対象国の指定は、組織のユーザーに基づく場合もあれば、EAR ↗、OFAC ↗、ITAR ↗ などの規制に基づく場合もあります。

セレクター 演算子 値 アクション
Resolved Country IP Geolocation in Afghanistan, Belarus, Congo (Kinshasa), Cuba, Iran, Iraq, Korea (North), Myanmar, Russian Federation, Sudan, Syria, Ukraine, Zimbabwe Block
Create a Zero Trust Gateway rulebash
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/gateway/rules" \
	--request POST \
	--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
	--json '{
		"name": "All-DNS-GeoCountryIP-Blocklist",
		"description": "Block traffic hosted in countries categorized as high security risks",
		"precedence": 50,
		"enabled": true,
		"action": "block",
		"filters": [
				"dns"
		],
		"traffic": "any(dns.dst.geo.country[*] in {\"AF\" \"BY\" \"CD\" \"CU\" \"IR\" \"IQ\" \"KP\" \"MM\" \"RU\" \"SD\" \"SY\" \"UA\" \"ZW\"})"
	}'
resource "cloudflare_zero_trust_gateway_policy" "dns_geolocation_block_policy" {
  account_id  = var.cloudflare_account_id
  name        = "All-DNS-GeoCountryIP-Blocklist"
  description = "Block traffic hosted in countries categorized as high security risks"
  precedence  = 50
  enabled     = true
  action      = "block"
  filters     = ["dns"]
  traffic     = "any(dns.dst.geo.country[*] in {\"AF\" \"BY\" \"CD\" \"CU\" \"IR\" \"IQ\" \"KP\" \"MM\" \"RU\" \"SD\" \"SY\" \"UA\" \"ZW\"})"
}

All-DNS-DomainTopLevel-Blocklist

悪用されやすいトップレベルドメイン(TLD)をブロックし、セキュリティリスクを下げます。アクセスを許可する明確な利点がない場合に特に有効です。同様に、OFAC ↗ や ITAR ↗ などの規制に従うため、特定の国別 TLD へのアクセス制限が必要になることもあります。

セレクター 演算子 値 アクション
Domain matches regex [.](cn|ru)$ or [.](rest|hair|top|live|cfd|boats|beauty|mom|skin|okinawa)$ or [.](zip|mobi)$ Block
Create a Zero Trust Gateway rulebash
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/gateway/rules" \
	--request POST \
	--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
	--json '{
		"name": "All-DNS-DomainTopLevel-Blocklist",
		"description": "Block DNS queries of known risky TLDs",
		"precedence": 60,
		"enabled": true,
		"action": "block",
		"filters": [
				"dns"
		],
		"traffic": "any(dns.domains[*] matches \".$ or .$ or .$\")"
	}'
resource "cloudflare_zero_trust_gateway_policy" "dns_blacklist_policy" {
  account_id  = var.cloudflare_account_id
  name        = "All-DNS-DomainTopLevel-Blocklist"
  description = "Block DNS queries of known risky TLDs"
  precedence  = 60
  enabled     = true
  action      = "block"
  filters     = ["dns"]
  traffic     = "any(dns.domains[*] matches \"[.](cn|ru)$ or [.](rest|hair|top|live|cfd|boats|beauty|mom|skin|okinawa)$ or [.](zip|mobi)$\")"
}

All-DNS-DomainPhishing-Blocklist

悪用されたドメインをブロックし、組織を標的にした高度なフィッシング攻撃からユーザーを保護します。たとえば、次のポリシーは、組織や認証サービスに関連する特定のキーワード(okta、2fa、cloudflare、sso など)を含むドメインをブロックしつつ、既知のドメインへのアクセスは許可します。

セレクター 演算子 値 ロジック アクション
Domain not in list Known Domains And Block
Domain matches regex .*okta.*|.*cloudflare.*|.*mfa.*|.sso.*
Create a Zero Trust Gateway rulebash
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/gateway/rules" \
	--request POST \
	--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
	--json '{
		"name": "All-DNS-DomainPhishing-Blocklist",
		"description": "Block misused domains used in phishing campaigns",
		"precedence": 70,
		"enabled": true,
		"action": "block",
		"filters": [
				"dns"
		],
		"traffic": "any(dns.domains[] matches \".okta.|.cloudflare.|.mfa.|.sso.\") and not(any(dns.domains[*] in $<KNOWN_DOMAINS_LIST_UUID>))"
	}'
resource "cloudflare_zero_trust_gateway_policy" "dns_phishing_domains_block" {
  account_id  = var.cloudflare_account_id
  name        = "All-DNS-DomainPhishing-Blocklist"
  description = "Block misused domains used in phishing campaigns"
  precedence  = 70
  enabled     = true
  action      = "block"
  filters     = ["dns"]
  traffic     = "any(dns.domains[*] matches \".*okta.*|.*cloudflare.*|.*mfa.*|.sso.*\") and not(any(dns.domains[*] in ${"$"}${cloudflare_zero_trust_list.known_phishing_domains_list.id}))"
}

All-DNS-ResolvedIP-Blocklist

悪意がある、または組織に脅威となる特定の IP アドレスをブロックします。

このポリシーは、カスタムブロックリストを作成するか、脅威インテリジェンスパートナーや地域の Computer Emergency and Response Teams(CERT)が提供するブロックリストを使って実装できます。理想的には、CERT が API 自動化 でブロックリストを更新し、リアルタイムの脅威保護を提供します。

セレクター 演算子 値 アクション
Resolved IP in list IP Blocklist Block
Create a Zero Trust Gateway rulebash
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/gateway/rules" \
	--request POST \
	--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
	--json '{
		"name": "All-DNS-ResolvedIP-Blocklist",
		"description": "Block specific IP addresses deemed to be a risk to the Organization",
		"precedence": 80,
		"enabled": true,
		"action": "block",
		"filters": [
				"dns"
		],
		"traffic": "any(dns.resolved_ips[*] in $<IP_BLOCKLIST_UUID>)"
	}'
resource "cloudflare_zero_trust_gateway_policy" "dns_resolvedip_blocklist_rule" {
  account_id  = var.cloudflare_account_id
  name        = "All-DNS-ResolvedIP-Blocklist"
  description = "Block specific IP addresses deemed to be a risk to the Organization"
  precedence  = 80
  enabled     = true
  action      = "block"
  filters     = ["dns"]
  traffic     = "any(dns.resolved_ips[*] in ${"$"}${cloudflare_zero_trust_list.ip_blocklist.id}"
}

All-DNS-DomainHost-Blocklist

悪意がある、または組織に脅威となる特定のドメインやホストをブロックします。All-DNS-ResolvedIP-Blocklist と同様に、このブロックリストは手動または API による自動化で更新できます。

セレクター 演算子 値 ロジック アクション
Domain in list Domain Blocklist Or Block
Host in list Host Blocklist Or
Host matches regex .*example\.com
Create a Zero Trust Gateway rulebash
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/gateway/rules" \
	--request POST \
	--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
	--json '{
		"name": "All-DNS-DomainHost-Blocklist",
		"description": "Block specific domains or hosts that are malicious or pose a threat to your organization.",
		"precedence": 90,
		"enabled": true,
		"action": "block",
		"filters": [
				"dns"
		],
		"traffic": "any(dns.domains[*] in $<DOMAIN_BLOCKLIST_UUID>) and dns.fqdn in $<HOST_BLOCKLIST_UUID> and dns.fqdn matches \".*example.com\""
	}'
resource "cloudflare_zero_trust_gateway_policy" "block_dns_domain_host" {
  account_id  = var.cloudflare_account_id
  name        = "All-DNS-DomainHost-Blocklist"
  description = "Block specific domains or hosts that are malicious or pose a threat to your organization."
  precedence  = 90
  enabled     = true
  action      = "block"
  filters     = ["dns"]
  traffic     = "any(dns.domains[*] in ${"$"}${cloudflare_zero_trust_list.domain_blocklist.id}) and dns.fqdn in ${"$"}${cloudflare_zero_trust_list.host_blocklist.id} and dns.fqdn matches \".*example\\.com\""
}

役に立ちましたか?