Skip to content

Commit df5d239

Browse files
committed
Add policy partial and Terraform procedure
1 parent 3d74ce3 commit df5d239

File tree

3 files changed

+65
-2
lines changed

3 files changed

+65
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ resource "cloudflare_zero_trust_gateway_policy" "dns_restrict_quarantined_users"
140140
<Render file="zero-trust/blocklist-security-categories" />
141141

142142
<Render
143-
file="gateway/policies/block-security-categories"
143+
file="gateway/policies/block-security-categories-dash-plus-api"
144144
product="cloudflare-one"
145145
/>
146146

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
{}
3+
---
4+
5+
import { Tabs, TabItem, Render } from "~/components";
6+
7+
<Tabs syncKey="dashPlusAPI"> <TabItem label="Dashboard">
8+
9+
<Render
10+
file="gateway/policies/block-security-categories"
11+
product="cloudflare-one"
12+
/>
13+
14+
</TabItem>
15+
<TabItem label="API">
16+
17+
```bash
18+
curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/gateway/rule \
19+
--header "Content-Type: application/json" \
20+
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
21+
--data '{
22+
"name": "Block security threats",
23+
"description": "Block all default Cloudflare DNS security categories",
24+
"enabled": true,
25+
"action": "block",
26+
"filters": [
27+
"dns"
28+
],
29+
"traffic": "any(dns.security_category[*] in {68 178 80 83 176 175 117 131 134 151 153})",
30+
"identity": ""
31+
}'
32+
```
33+
34+
</TabItem>
35+
<TabItem label="Terraform">
36+
37+
```tf
38+
resource "cloudflare_zero_trust_gateway_policy" "block_security_threats" {
39+
account_id = var.account_id
40+
name = "All-DNS-SecurityCategories-Blocklist"
41+
description = "Block all default Cloudflare DNS security categories"
42+
precednece = 20
43+
enabled = false
44+
action = "block"
45+
filters = ["dns"]
46+
traffic = "any(dns.security_category[*] in {68 178 80 83 176 175 117 131 134 151 153})"
47+
rule_settings {
48+
block_page_enabled = true
49+
notification_settings {
50+
enabled = true
51+
}
52+
}
53+
}
54+
```
55+
56+
</TabItem> </Tabs>

src/content/partials/cloudflare-one/gateway/policies/enforce-device-posture.mdx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,21 @@
22
{}
33
---
44

5-
import { Tabs, TabItem, Render } from "~/components";
5+
import { Tabs, TabItem } from "~/components";
66

77
In the following example, you can use a list of [device serial numbers](/cloudflare-one/identity/devices/warp-client-checks/corp-device/) to ensure users can only access an application if they connect with the WARP client from a company device:
8+
89
<Tabs syncKey="dashPlusAPI">
910
<TabItem label="Dashboard">
11+
1012
| Selector | Operator | Value | Logic | Action |
1113
| ---------------------------- | -------- | ----------------------- | ----- | ------ |
1214
| Passed Device Posture Checks | not in | _Device serial numbers_ | And | Block |
1315
| SNI Domain | is | `internalapp.com` | | |
16+
1417
</TabItem>
1518
<TabItem label="API">
19+
1620
```sh
1721
curl --request POST \
1822
--url https://api.cloudflare.com/client/v4/accounts/{account_id}/gateway/rules \
@@ -35,8 +39,10 @@ curl --request POST \
3539
}
3640
}'
3741
```
42+
3843
</TabItem>
3944
<TabItem label="Terraform">
45+
4046
```tf
4147
resource "cloudflare_zero_trust_gateway_policy" "dns_resolvedip_blocklist_rule" {
4248
account_id = var.account_id
@@ -54,5 +60,6 @@ resource "cloudflare_zero_trust_gateway_policy" "dns_resolvedip_blocklist_rule"
5460
}
5561
}
5662
```
63+
5764
</TabItem>
5865
</Tabs>

0 commit comments

Comments
 (0)