Skip to content

Commit 9279651

Browse files
committed
Initial code commit
1 parent 8096a6a commit 9279651

File tree

1 file changed

+29
-1
lines changed
  • src/content/docs/learning-paths/secure-internet-traffic/build-dns-policies

1 file changed

+29
-1
lines changed

src/content/docs/learning-paths/secure-internet-traffic/build-dns-policies/create-policy.mdx

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@ sidebar:
55
order: 1
66
---
77

8-
import { Render } from "~/components";
8+
import { Tabs, TabItem, Render } from "~/components"
99

1010
DNS policies determine how Gateway should handle a DNS request. When a user sends a DNS request, Gateway matches the request against your filters and either allows the query to resolve, blocks the query, or responds to the query with a different IP.
1111

1212
You can filter DNS traffic based on query or response parameters (such as domain, source IP, or geolocation). You can also filter by user identity if you connect your devices to Gateway with the [WARP client or Cloudflare One Agent](/learning-paths/secure-internet-traffic/connect-devices-networks/install-agent/).
1313

1414
To create a new DNS policy:
1515

16+
<Tabs syncKey="dashPlusAPI">
17+
<TabItem label="Dashboard">
1618
1. In [Zero Trust](https://one.dash.cloudflare.com/), go to **Gateway** > **Firewall policies**.
1719
2. In the **DNS** tab, select **Add a policy**.
1820
3. Name the policy.
@@ -25,3 +27,29 @@ To create a new DNS policy:
2527
6. Select **Create policy**.
2628

2729
For more information, refer to [DNS policies](/cloudflare-one/policies/gateway/dns-policies/).
30+
</TabItem>
31+
<TabItem label="API">
32+
To create a new DNS policy using **cURL**:
33+
```sh
34+
curl --request POST \
35+
--url https://api.cloudflare.com/client/v4/accounts/{account_id}/gateway/rules \
36+
--header 'Content-Type: application/json' \
37+
--header "Authorization: Bearer <API_TOKEN>" \
38+
--data '{
39+
"name": "All-DNS-SecurityCategories-Blocklist",
40+
"description": "Block known security risks based on Cloudflare's threat intelligence",
41+
"precedence": 2,
42+
"enabled": false,
43+
"action": "block",
44+
"filters": [
45+
"dns"
46+
],
47+
"traffic": "any(dns.security_category[*] in {68 178 80 83 176 175 117 131 134 151 153})",
48+
"rule_settings": {
49+
"block_page_enabled": true,
50+
"block_reason": "This domain was blocked due to being classified as a security risk to the organisation"
51+
}
52+
}'
53+
```
54+
</TabItem>
55+
</Tabs>

0 commit comments

Comments
 (0)