You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: content/docs/courses/zero-fundamentals/advanced-policies.mdx
+1-1
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,7 @@ If you're following these guides sequentially, your current policy only includes
51
51
</TabItem>
52
52
</Tabs>
53
53
54
-
This policy is a great first step to protecting your services. If you're using a workspace email address, you can immediately restrict access to allow only members of your organization. But you'll likely want to add more complex policies based on your use case.
54
+
This policy is a great first step to protecting your services. If you're using a workspace email address, you can immediately restrict access to allow only members of your organization. But you'll likely want to add more complex policies that only grant access to a specific user or group of users.
55
55
56
56
With Pomerium Policy Language (PPL), you can build richer policies that apply to real-world use cases. Let's cover a few example "real-world" policies below that would fall into the "advanced" category.
Each tutorial builds on the same configuration files. In this tutorial, you’ll build new routes with some of Pomerium’s route-level settings.
@@ -26,18 +26,18 @@ Each tutorial builds on the same configuration files. In this tutorial, you’ll
26
26
27
27
Pomerium provides route-level settings that allow you to customize how the Proxy service handles requests. More advanced configurations allow identity header pass-through, path and prefix rewrites, and request and response header modifications.
28
28
29
-
For the purposes of this tutorial, we will only review the following settings to give you an idea of how you can further configure your routes for your use case:
29
+
For the purposes of this guide, we will only review select settings from the list below to give you an idea of how you can further configure routes for your use case:
30
30
31
-
-**Remove Request Headers**
32
-
-**Host Rewrite Headers**
33
-
-**Set Response Headers**
34
-
-**Redirects**
31
+
-**Headers**
32
+
-**Path Matching**
33
+
-**Path Rewriting**
35
34
-**Prefix & Prefix Rewrite**
35
+
-**Redirects**
36
36
-**Direct Response**
37
37
38
38
### Configure HTTPBin
39
39
40
-
To see how some of these settings work, we will configure Pomerium and Docker Compose to host an HTTPBin server. If you’re not familiar with [HTTPBin](https://httpbin.org/), it’s a call-and-response HTTP server you can use to test (you guessed it) HTTP requests and responses.
40
+
To test these settings, we will configure Pomerium Zero and Docker Compose to host an HTTPBin server. If you’re not familiar with [HTTPBin](https://httpbin.org/), it’s a call-and-response HTTP server you can use to test (you guessed it) HTTP requests and responses.
41
41
42
42
Add the `httpbin` service to your Docker Compose file:
43
43
@@ -48,7 +48,7 @@ httpbin:
48
48
- 80:80
49
49
```
50
50
51
-
Add the `httpbin` route in your Pomerium configuration file:
51
+
Add the `httpbin` route in the Zero Console:
52
52
53
53
1. Create a new route
54
54
1. Add **From** and **To** URLs
@@ -58,9 +58,9 @@ Save your route and apply your changeset.
58
58
59
59
## Test Headers settings
60
60
61
-
### Identity headers
61
+
### Pass identity headers (per route)
62
62
63
-
[Pass Identity Headers](/docs/reference/routes/pass-identity-headers-per-route) is a route-level setting that forwards a signed JWT to the upstream application in a signed HTTP header. The HTTP header must use the (case insensitive) `x-pomerium-jwt-assertion` format. You configured this setting in the [previous guide](/docs/courses/zero-fundamentals/single-sign-on), but let's see how it looks as a request header.
63
+
[Pass Identity Headers](/docs/reference/routes/pass-identity-headers-per-route) is a route-level setting that forwards the user's JWT to the upstream application in a signed HTTP header. The HTTP header must use the (case insensitive) `x-pomerium-jwt-assertion` format. You configured this setting in the [previous guide](/docs/courses/zero-fundamentals/single-sign-on), but let's see how it looks as a request header.
64
64
65
65
In the Zero Console:
66
66
@@ -69,17 +69,93 @@ In the Zero Console:
69
69
1. Apply the **Pass Identity Headers** setting
70
70
1. Save your route and apply the changeset
71
71
72
-
Access the HTTPBin route and send a request:
72
+
Access the HTTPBin route and send a request. To send a request, on the HTTPBin page:
73
73
74
+
1. Open the **Request inspection** dropdown menu
75
+
1. In **GET /headers**, select **Try it out**
76
+
1. Select **Execute** to send the request
74
77
78
+
In the **Response body** field, you'll see the JWT assertion header:
75
79
76
-
:::info
80
+

77
81
78
-
RESUME HERE
82
+
:::info JWTs and SDKs
83
+
84
+
Read the following documentation to learn more about identity verification in Pomerium:
The **Pass Identity Headers** and **JWT Claim Headers** settings both forward identity headers to an upstream application.
97
+
### JWT Claim Headers
98
+
99
+
The pass identity headers setting can also forward _unsigned_ identity headers as additional [JWT Claim Headers](/docs/reference/jwt-claim-headers).
100
+
101
+
To add JWT claim headers in the Zero Console:
102
+
103
+
1. Select the **Settings** tab in the main sidebar
104
+
1. In **Editing Cluster Settings**, select **Headers**
105
+
1. In the **JWT Claim Headers** field, enter the values below:
106
+
107
+
| **KEY** | **VALUE** |
108
+
| :--- | :--- |
109
+
| `x-pomerium-claim-email` | `email` |
110
+
| `x-pomerium-claim-user` | `user` |
111
+
| `x-pomerium-claim-name` | `name` |
112
+
113
+
For example:
114
+
115
+

116
+
117
+
118
+
After you save your changes, apply your changeset, and access your HTTPBin route, inspect the request. You'll see these additional, unsigned HTTP headers added to the response body:
119
+
120
+

121
+
122
+
### Set and remove request headers
123
+
124
+
Now, configure [**Set Request Headers**](/docs/reference/routes/headers#set-request-headers) to add static custom HTTP headers to your request:
125
+
126
+
1. Go back to the HTTPBin headers settings
127
+
1. In **Property Name**, enter `X-SET-REQUEST-HEADERS`
128
+
1. In **Property Value**, enter `X-TEST-VALUE`
129
+
130
+
Next, configure [**Remove Request Headers**](/docs/reference/routes/headers#remove-request-headers) to remove two of the JWT claim headers you set in the previous section.
131
+
132
+
1. In the **Remove Request Headers** field, enter `X-POMERIUM-CLAIM-NAME` and `X-POMERIUM-CLAIM-USER`.
133
+
134
+

135
+
136
+
Apply your changeset and test the request again. You'll notice that the set request header was added to the request, and the specified JWT claim headers were removed:
137
+
138
+

139
+
140
+
### Rewrite Host header to a literal value
141
+
142
+
You may need to modify the value of the Host header. For example, some servers may only accept Host headers with a value that matches the [Origin](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin) of the request. The [Host Rewrite](/docs/reference/routes/headers#2-host-rewrite) setting allows you to modify the Host header in the HTTP request to a literal value.
143
+
144
+
If you don't tamper with this setting, the value of the Host header will be the hostname of our upstream service: `"Host": "httpbin"`.
145
+
146
+
Now, go back to the **Headers** tab for the HTTPBin route. In the **Host Rewrite to Literal** field, enter your HTTPBin route.
147
+
148
+
For example, `httpbin.righteous-gemstone-1734.pomerium.app`
149
+
150
+

151
+
152
+
After applying your changeset, check the request headers in HTTPBin again. You'll notice Pomerium rewrites the Host header to the domain you entered in the Zero Console:
0 commit comments