Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding DNS API calls to secure-internet-traffic learning path #18388

Draft
wants to merge 23 commits into
base: production
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
9279651
Initial code commit
tcerqueira-cf Nov 23, 2024
3c7697a
Fixed typos
tcerqueira-cf Nov 25, 2024
09414ca
Added terraform code
tcerqueira-cf Nov 25, 2024
e3975b6
Fixed typo
tcerqueira-cf Nov 25, 2024
0a78d47
Added API and Terraform code to create the allow list policy
tcerqueira-cf Nov 27, 2024
19c71bf
Added terraform and API code for the All-DNS-Domain-Allowlist rule
tcerqueira-cf Nov 27, 2024
566551a
Fixed JSON capitalization
tcerqueira-cf Nov 27, 2024
2a360ce
Fixed missing import
tcerqueira-cf Nov 27, 2024
5c42de6
Fixed styling issue
tcerqueira-cf Nov 27, 2024
df6ab87
Added API and terraform code for Quarantined users restricted access …
tcerqueira-cf Nov 27, 2024
141c95a
Fixed typo
tcerqueira-cf Nov 27, 2024
f0dc556
Added terraform and API code for the country geolocation block rule
tcerqueira-cf Nov 27, 2024
4ac36e6
Added Terraform and API code for the misuesed TLD block rule
tcerqueira-cf Nov 27, 2024
16c8ba0
Fixed small typo
tcerqueira-cf Nov 27, 2024
f8199f5
Added terraform and API code for the Domain Phishing block rule
tcerqueira-cf Nov 28, 2024
dbf54f2
Added tf and API code for the DNS Resolved IP Blocklist rule
tcerqueira-cf Nov 28, 2024
a061c44
Modified enforce-device-posture partial to add terraform and API code
tcerqueira-cf Nov 28, 2024
1ab4823
Fixed typo
tcerqueira-cf Nov 28, 2024
a15df8f
Fixed typo
tcerqueira-cf Nov 28, 2024
a977605
Fixed small typo
tcerqueira-cf Nov 28, 2024
0adca5b
Fixed typo
tcerqueira-cf Nov 28, 2024
7f40cc7
Merge branch 'production' into origin/tcerqueira/defense-in-depth-api…
maxvp Dec 30, 2024
95be41f
Fix formatting
maxvp Dec 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,61 @@ resource "cloudflare_zero_trust_gateway_policy" "dns_whitelist_policy" {
<Details header="Quarantined-Users-DNS-Restricted-Access">

<Render file="zero-trust/blocklist-restricted-users" />

| Selector | Operator | Value | Logic | Action |
| ---------------- | -------- | ------------------- | ----- | ------ |
| Domain | in list | *Known Domains* | Or | Block |
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maxvp I'm not 100% sure I understood this mock rule. From what I understood from the description of this rule, it appears that you are attempting to restrict Quarantined users to specific domains for remediation, is this correct? If so, this wouldn't work because it would block the domains allowed for remediation. I proposed a change to this, and from a policy standpoint it should work. Let me know if my reasoning is correct.

It also came to mind that this policy was meant to block quarantined users from accessing known malicious domains, but that wouldn't make much sense, as if the domains/hosts are known to be malicious, you would want that to be blocked organisation-wide

Let me know your thoughts on this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

| Host | in list | *Known Domains* | And | |
| User Group Names | in | *Quarantined Users* | | |

<Tabs>
<TabItem label="Dashboard">
| Selector | Operator | Value | Logic | Action |
| ---------------- | ------------ | --------------------------------- | ----- | ------ |
| Domain | not in list | *Allowed Remediation Domains* | Or | Block |
| Host | not in list | *Allowed Remediation Domains* | And | |
| User Group Names | in | *Quarantined Users* | | |
</TabItem>
<TabItem label="API">
```sh
curl --request POST \
--URL https://api.cloudflare.com/client/v4/accounts/{account_id}/gateway/rules \
--header 'Content-Type: application/JSON' \
--header "Authorization: Bearer <API TOKEN>" \
--data '{
"name": "Quarantined-Users-DNS-Restricted-Access",
"description": "Restrict quarantined users traffic to corporate policy remediation domains, so that quarantined users can obtain help and/or remediate their security posture",
"precedence": 10,
"enabled": false,
"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\"})",
"rule_settings": {
"block_page_enabled": true,
"notification_settings": {
"enabled": true
}
}'
```
</TabItem>
<TabItem label="Terraform">
```tf
resource "cloudflare_zero_trust_gateway_policy" "dns_restrict_quarantined_users" {
account_id = var.account_id
name = "Quarantined-Users-DNS-Restricted-Access"
description = "Restrict quarantined users traffic to corporate policy remediation domains, so that quarantined users can obtain help and/or remediate their security posture"
precedence = 10
enabled = false
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\"})"
rule_settings {
block_page_enabled = true
notification_settings {
enabled = true
}
}
}
```
</TabItem>
</Tabs>

</Details>

Expand Down
Loading