Skip to content

Commit df6ab87

Browse files
committed
Added API and terraform code for Quarantined users restricted access example
1 parent 5c42de6 commit df6ab87

File tree

1 file changed

+55
-7
lines changed

1 file changed

+55
-7
lines changed

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

Lines changed: 55 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,61 @@ resource "cloudflare_zero_trust_gateway_policy" "dns_whitelist_policy" {
6060
<Details header="Quarantined-Users-DNS-Restricted-Access">
6161

6262
<Render file="zero-trust/blocklist-restricted-users" />
63-
64-
| Selector | Operator | Value | Logic | Action |
65-
| ---------------- | -------- | ------------------- | ----- | ------ |
66-
| Domain | in list | *Known Domains* | Or | Block |
67-
| Host | in list | *Known Domains* | And | |
68-
| User Group Names | in | *Quarantined Users* | | |
69-
63+
<Tabs>
64+
<TabItem label="Dashboard">
65+
| Selector | Operator | Value | Logic | Action |
66+
| ---------------- | ------------ | --------------------------------- | ----- | ------ |
67+
| Domain | not in list | *Allowed Remediation Domains* | Or | Block |
68+
| Host | not in list | *Allowed Remediation Domains* | And | |
69+
| User Group Names | in | *Quarantined Users* | | |
70+
</TabItem>
71+
<TabItem label="API">
72+
```sh
73+
curl --request POST \
74+
--URL https://api.cloudflare.com/client/v4/accounts/{account_id}/gateway/rules \
75+
--header 'Content-Type: application/JSON' \
76+
--header "Authorization: Bearer <API TOKEN>" \
77+
--data '{
78+
"name": "Quarantined-Users-DNS-Restricted-Access",
79+
"description": "Restrict quarantined users traffic to corporate policy remediation domains, so that quarantined users can obtain help and/or remediate their security posture",
80+
"precedence": 10,
81+
"enabled": false,
82+
"action": "block",
83+
"filters": [
84+
"dns"
85+
],
86+
"traffic": "not(any(dns.domains[*] in $<Allowed Remediation Domains list UUID>)) or not(any(dns.domains[*] in $<Allowed Remediation Domains list UUID>))",
87+
"identity": "any(identity.groups.name[*] in {\"Quarantined Users\"})",
88+
"rule_settings": {
89+
"block_page_enabled": true,
90+
"notification_settings": {
91+
"enabled": true
92+
}
93+
}'
94+
```
95+
</TabItem>
96+
<TabItem label="Terraform">
97+
```tf
98+
resource "cloudflare_zero_trust_gateway_policy" "dns_restrict_quarantined_users" {
99+
account_id = var.account_id
100+
name = "Quarantined-Users-DNS-Restricted-Access"
101+
description = "Restrict quarantined users traffic to corporate policy remediation domains, so that quarantined users can obtain help and/or remediate their security posture"
102+
precedence = 10
103+
enabled = false
104+
action = "block"
105+
filters = ["dns"]
106+
traffic = "not(any(dns.domains[*] in $<Allowed Remediation Domains list UUID>)) or not(any(dns.domains[*] in $<Allowed Remediation Domains list UUID>))"
107+
identity = "any(identity.groups.name[*] in {\"Quarantined Users\"})"
108+
rule_settings {
109+
block_page_enabled = true
110+
notification_settings {
111+
enabled = true
112+
}
113+
}
114+
}
115+
```
116+
</TabItem>
117+
</Tabs>
70118

71119
</Details>
72120

0 commit comments

Comments
 (0)