Skip to content

Commit e0fec68

Browse files
PCX-12892 - WIP initial version of the tutorial
1 parent edbd037 commit e0fec68

File tree

3 files changed

+67
-0
lines changed

3 files changed

+67
-0
lines changed
Loading
Loading
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
updated: 2024-08-13
3+
category: 🔐 Zero Trust
4+
difficulty: Advanced
5+
pcx_content_type: tutorial
6+
content_type: 📝 Tutorial
7+
title: Augment Clouflare Access SSO capabilities with Cloudflare Workers
8+
---
9+
10+
## Introduction
11+
12+
This tutorial will walk you through extending the single-sign-on (SSO) capabilities of Cloudflare Access with Serverless. Specifically, this guide will demonstrate how to modify requests sent to your secured origin to include additional information from the Cloudflare Access authentication event.
13+
14+
## Cloudflare Access authentication flow
15+
16+
Cloudflare Access is an authentication proxy in charge of authenticating and authorization users for your exposed app before they reach it. When anthentication and authorization steps are successful, Cloudflare will insert a JWT inside the request before it reaches the origin. That is the standard flow and that JWT can then be [verifed on the origin side](https://developers.cloudflare.com/cloudflare-one/identity/authorization-cookie/validating-json/#validate-jwts).
17+
18+
![extendedflow](~/assets/images/cloudflare-one/applications/access-standard-flow.png)
19+
20+
Sometimes, it is necessary to modify the request or overload it with some extra information coming from that authentication event. Cloudflare Workers is a perfect fit for that task and we'll see in this tutorial how to make that happen.
21+
22+
![standardflow](~/assets/images/cloudflare-one/applications/access-extended-flow-serverless.png)
23+
24+
:::note
25+
26+
This example shows how workers is running right after Access and is in charge of inserting new request headers: **risk_score** and **disk_encrypted**
27+
28+
The posture element serves as a prime example in this article, but the use and application of that concept extends far beyond that. You can indeed modify the request or overload it with anything Clouflare Access is collecting from the authentication event the user has passed before reaching the application.
29+
30+
:::
31+
32+
33+
## Before you begin
34+
35+
36+
Make sure your account have:
37+
38+
* An active subscription for [Cloudflare Access](https://developers.cloudflare.com/cloudflare-one/policies/access/) (Zero-trust)
39+
* An active [Workers](https://developers.cloudflare.com/workers/#cloudflare-workers) plan
40+
* An active [self-hosted](https://developers.cloudflare.com/cloudflare-one/applications/configure-apps/self-hosted-apps/#add-a-self-hosted-application) application exposed with an active authentication and authorization policy
41+
42+
43+
## Create a new workers script that will be in charge of expanding
44+
45+
46+
1. In [Zero Trust](https://one.dash.cloudflare.com/), go to **Gateway** > **Egress Policies**.
47+
48+
2. Select **Add a policy**.
49+
50+
3. Name your policy, then add conditions to check users are configured in Microsoft Entra ID. For example, you can check for [identity conditions](/cloudflare-one/policies/gateway/identity-selectors/):
51+
52+
| Selector | Operator | Value |
53+
| ---------------- | -------- | --------------------------------------------- |
54+
| User Group Names | in | `Sales and Marketing`, `Retail`, `U.S. Sales` |
55+
56+
Additionally, you can check for [device posture conditions](/cloudflare-one/identity/devices/):
57+
58+
| Selector | Operator | Value | Logic |
59+
| --------------------------- | -------- | ------------------------------------------------- | ----- |
60+
| Passed Device Posture Check | is | `CrowdStrike Overall ZTA score (Crowdstrike s2s)` | And |
61+
| Passed Device Posture Check | is | `AppCheckMac - Required Software (Application)` | |
62+
63+
4. Enable **Use dedicated Cloudflare egress IPs**. Select your desired IPv4 and IPv6 addresses. For example:
64+
65+
| Primary IPv4 address | IPv6 address |
66+
| -------------------- | --------------- |
67+
| `203.0.113.0` | `2001:db8::/32` |

0 commit comments

Comments
 (0)