Skip to content

Commit c9ffe9b

Browse files
committed
Add first policies
1 parent a82544f commit c9ffe9b

File tree

3 files changed

+85
-5
lines changed

3 files changed

+85
-5
lines changed

src/content/docs/cloudflare-one/policies/gateway/network-policies/common-policies.mdx

Lines changed: 81 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,105 @@ Refer to the [network policies page](/cloudflare-one/policies/gateway/network-po
1818

1919
<Render file="gateway/policies/block-applications" product="cloudflare-one" />
2020

21+
<Tabs syncKey="dashPlusAPI"> <TabItem label="Dashboard">
22+
2123
| Selector | Operator | Value | Action |
2224
| ----------- | -------- | ------------------------- | ------ |
2325
| Application | in | _Artificial Intelligence_ | Block |
2426

27+
</TabItem>
28+
29+
<TabItem label="API">
30+
31+
```sh
32+
curl https://api.cloudflare.com/client/v4/accounts/{account_id}/gateway/rule\
33+
--header "Content-Type: application/json" \
34+
--header "Authorization: Bearer <API_TOKEN>" \
35+
--data '{
36+
"name": "Block unauthorized applications",
37+
"description": "Block access to unauthorized AI applications",
38+
"enabled": true,
39+
"action": "block",
40+
"filters": [
41+
"l4"
42+
],
43+
"traffic": "any(app.type.ids[*] in {25})",
44+
"identity": "",
45+
"device_posture": ""
46+
}'
47+
```
48+
49+
</TabItem> </Tabs>
50+
2551
## Check user identity
2652

2753
<Render file="gateway/policies/check-user-identity" />
2854

55+
<Tabs syncKey="dashPlusAPI"> <TabItem label="Dashboard">
56+
2957
| Selector | Operator | Value | Logic | Action |
3058
| ---------------- | -------- | ------------- | ----- | ------ |
3159
| Application | in | _Salesforce_ | And | Block |
3260
| User Group Names | in | _Contractors_ | | |
3361

62+
</TabItem>
63+
64+
<TabItem label="API">
65+
66+
```sh
67+
curl https://api.cloudflare.com/client/v4/accounts/{account_id}/gateway/rule\
68+
--header "Content-Type: application/json" \
69+
--header "Authorization: Bearer <API_TOKEN>" \
70+
--data '{
71+
"name": "Check user identity",
72+
"description": "Block access to Salesforce by temporary employees and contractors",
73+
"enabled": true,
74+
"action": "block",
75+
"filters": [
76+
"l4"
77+
],
78+
"traffic": "any(app.ids[*] in {606})",
79+
"identity": "any(identity.groups.name[*] in {\"Contractors\"})",
80+
"device_posture": ""
81+
}'
82+
```
83+
84+
</TabItem> </Tabs>
85+
3486
## Enforce device posture
3587

36-
Require devices to have certain software installed or other configuration attributes. For instructions on enabling a device posture check, refer to the [device posture section](/cloudflare-one/identity/devices/).
88+
Require devices to have certain software installed or other configuration attributes. For instructions on enabling a device posture check, refer to the [device posture section](/cloudflare-one/identity/devices/). For 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:
89+
90+
<Tabs syncKey="dashPlusAPI"> <TabItem label="Dashboard">
3791

3892
<Render file="gateway/policies/enforce-device-posture" />
3993

94+
</TabItem>
95+
96+
<TabItem label="API">
97+
98+
```sh
99+
curl https://api.cloudflare.com/client/v4/accounts/{account_id}/gateway/rule\
100+
--header "Content-Type: application/json" \
101+
--header "Authorization: Bearer <API_TOKEN>" \
102+
--data '{
103+
"name": "Enforce device posture",
104+
"description": "Limit access to an internal application to approved organization devices",
105+
"enabled": true,
106+
"action": "block",
107+
"filters": [
108+
"l4"
109+
],
110+
"traffic": "any(net.sni.domains[*] == \"example.com\")",
111+
"identity": "",
112+
"device_posture": "not(any(device_posture.checks.passed[*] in {\"<POSTURE-CHECK-UUID>\"}))"
113+
}'
114+
```
115+
116+
To get the UUIDs of your device posture checks, use the [List device posture rules](/api/resources/zero_trust/subresources/devices/subresources/posture/methods/list/) endpoint.
117+
118+
</TabItem> </Tabs>
119+
40120
## Enforce session duration
41121

42122
To require users to re-authenticate after a certain amount of time has elapsed, configure [WARP sessions](/cloudflare-one/connections/connect-devices/warp/configure-warp/warp-sessions/).

src/content/partials/cloudflare-one/gateway/get-started/create-network-policy.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ To create a new network policy:
1212
2. In the **Network** tab, select **Add a policy**.
1313
3. Name the policy.
1414
4. Under **Traffic**, build a logical expression that defines the traffic you want to allow or block.
15-
5. Choose an **Action** to take when traffic matches the logical expression.
15+
5. Choose an **Action** to take when traffic matches the logical expression. For 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:
16+
1617
<Render
1718
file="gateway/policies/enforce-device-posture"
1819
product="cloudflare-one"
1920
/>
21+
2022
6. Select **Create policy**.
2123

2224
</TabItem>

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
{}
33
---
44

5-
For 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:
6-
75
| Selector | Operator | Value | Logic | Action |
86
| ---------------------------- | -------- | ----------------------- | ----- | ------ |
9-
| SNI Domain | is | `internalapp.com` | And | Block |
7+
| SNI Domain | is | `example.com` | And | Block |
108
| Passed Device Posture Checks | not in | _Device serial numbers_ | | |

0 commit comments

Comments
 (0)