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
Lab8 fixes after running through clean install (#58)
* Lab8 fixes after running through clean install
* Found the issue - nginx.conf has the resolve items which seems cleaner.
* Cleaned up Lab9 with all the previous labs done.
1. You can use browser's built-in certificate viewer to look at the details of the TLS certificate that was sent from NGINX to your browser. In address bar, click on the `Not Secure` icon, then click on `Certificate is not valid`. This will display the certificate. You can verify looking at the `Comman Name` field that this is the same certificate that you provided to NGINX for Azure resource.
289
+
1. You can use browser's built-in certificate viewer to look at the details of the TLS certificate that was sent from NGINX to your browser. In the address bar, click on the `Not Secure` icon, then click on `Certificate is not valid`. This will display the certificate. You can verify looking at the `Common Name` field that this is the same certificate that you provided to NGINX for Azure resource.
To enable an application to use Entra ID / Azure AD for authentication, you will need to create a new `app registration` from within the Azure Entra ID Portal.
35
35
36
36
1. Login into Microsoft Azure Portal and navigate to `App registrations`.
37
-
2. CLick the `+` button at the top for `New registration`
37
+
2. Click the `+` button at the top for `New registration`
38
+
39
+

38
40
3. Fill out the name your application registration.
39
41
For this workshop we provided the name of `example.com`.
40
-
4. Select the necessary account types based on who would be using this application. For this lab exercise, you will select *"Accounts in this organizational directory only (<name> - Single tenant)"*, which means users of your current Subscription. (Using other Account types is not covered in this workshop).
41
-
5. Click `+ Platform`, and select `Web` for the Platform.
42
-
43
-
On the `Configure Web` panel, you will need to provide a `redirect URI`. You can optionally also provide a `Front-channel logout URL`. For the `redirect URI`, you will want to fill in with the hostname of the application you want to Protect, including the port number, with `/_codexch`.
42
+
4. Select the necessary account types based on who would be using this application. For this lab exercise, you will select *"Accounts in this organizational directory only (<name> - Single tenant)"*, which means users of your current Subscription. (Using other Account types is not covered in this workshop).
43
+
5. In the Redirect URI (optional) section, select `Web` and provide a `redirect URI`. For the `redirect URI`, you will want to fill in with the hostname of the application you want to Protect, including the port number, with `/_codexch`.
44
44
45
45
For example, in this workshop, NGINXaaS will be configured for OIDC to access `cafe.example.com`. So the `redirect URI` for the workshop will be the following:
Take note of the `Application (client) ID` and `Directory (tenant) ID`.
67
63
68
64
8. Copy and set the following ENVIRONMENT variables for the Client and Tenant IDs, to be used in the next section:
69
65
70
66
```bash
71
-
export$MY_CLIENT_ID=<ApplicationClientID>
72
-
export$MY_TENANT_ID=<DirectoryTenantID>
73
-
67
+
export MY_CLIENT_ID="<ApplicationClientID>"
68
+
export MY_TENANT_ID="<DirectoryTenantID>"
74
69
```
75
70
76
71
## Creating N4A Client Credentials
@@ -81,25 +76,24 @@ You will need to create a new `Client credentials secret` that will be used by N
81
76
82
77
2. Click the `+ New client secret` button within the `Client Secrets` tab to create a new client secret that will be used by NGINXaaS. This secret will be used in the Nginx config as part of the Auth workflow.
3. Fill out the description for the client secret. For this workshop we provided the name as `example.com`.
87
82
88
-
4. You can also change the Duration for the client secret expiriration or keep the default recommended value. Click on `Add` to generate the new client secret.
83
+
4. You can also change the Duration for the client secret expiration or keep the default recommended value. Click on `Add` to generate the new client secret.
5. Once you click on the `Add` button, you will see the secret within the `Client Secrets` tab as seen in below screenshot. The `Value` column will be the field you want to look for and copy. This Client Secret will be used by Nginx to communicate with Entra ID.
6. Copy the `Value` portion of the client secret to the clipboard, and also save it on your computer as you will use it in next section of this lab. **NOTE:** It is important that you have a backup of this `Client Secret Value`, *as it is only shown here at creation time.*If you lose the Client Secret, you can easily create a new one in this same Azure Portal page and you will have to update your N4A configuration.
91
+
6. Copy the `Value` portion of the client secret to the clipboard, and also save it on your computer as you will use it in next section of this lab. **NOTE:** It is important that you have a backup of this `Client Secret Value`, *as it is only shown here at creation time.* If you lose the Client Secret, you can easily create a new one in this same Azure Portal page and you will have to update your N4A configuration.
97
92
98
93
7. Copy and set the following ENVIRONMENT variable for the Client Secret, to be used in the next section:
99
94
100
95
```bash
101
-
export$MY_CLIENT_SECRET=<Client Secret Value>
102
-
96
+
export MY_CLIENT_SECRET="<Client Secret Value>"
103
97
```
104
98
105
99
### Collecting the Required URLs
@@ -108,7 +102,6 @@ You will need to create a new `Client credentials secret` that will be used by N
There are three URLs required, which you will use in your Nginx for Azure configuration:
@@ -205,37 +198,12 @@ Now that the Azure Entra ID configurations are complete, you will configure Ngin
205
198
206
199
As there are 2 Active/Active instances of Nginx `under the hood` of an N4A deployment, synchronizing the KeyValue shared memory zone used for OIDC tokens is required. This NginxPlus feature uses a module called `ngx_stream_zone_sync_module`. The module uses a dedicated TCP connection between N4A pairs to send updates of the shared memory to each other. For the Nginx OIDC solution, the shared memory is used to cache the users' Auth Tokens, so that subsequent requests do NOT have to be validated with the IDP. Caching these Auth Tokens provides a large performance improvement to users accessing OIDC protected content. Without this Nginx caching feature, `every request would suffer the Round Trip delay` of going back and forth to the Identity provider, slowing your application Response Time to a dismal crawl, and potentially prompting for user credentials repeatedly.
207
200
208
-
<< N4A zone sync diagram here >>
209
-
210
-
1. Using the N4A console, create a new `/etc/nginx/stream/zonesync.conf` file in the `stream context`. Use the example file provided, just copy/paste:
211
-
212
-
```nginx
213
-
# Nginx for Azure Zone Sync config
214
-
# Chris Akker, Shouvik Dutta, Adam Currier - Mar 2024
215
-
#
216
-
# zonesync.conf
217
-
#
218
-
resolver 127.0.0.1:49153 valid=20s;
219
-
220
-
server {
221
-
222
-
listen 9000; # should match the port specified with zone_sync_server
1. Copy the three `openid_connect` files from the /lab8 folder, to your Nginx for Azure `/etc/nginx/oidc` folder. You will have to create each file and copy/paste the contents from the examples provided in the lab8 folder.
237
205
238
-
1.Modify the `/etc/nginx/oidc/openid_connect_configuration.conf` file as follows:
206
+
1.Create and modify the `/etc/nginx/oidc/openid_connect_configuration.conf` file as follows:
239
207
240
208
There are 5 lines to edit in this configuration file, shown as follows:
241
209
@@ -246,9 +214,14 @@ Submit your Nginx Configuration.
246
214
3. Line #28, change the `jwks_uri` to your URL
247
215
248
216
4. Line #33, change the `client_id` to your Value
249
-
217
+
```bash
218
+
echo$MY_CLIENT_ID
219
+
```
250
220
5. Line #42, change the `client_secret` to your Value
251
-
221
+
```bash
222
+
echo$MY_CLIENT_SECRET
223
+
```
224
+
Take those values and put them into the file mentioned above (/etc/nginx/oidc/openid_connect_configuration.conf).
252
225
```nginx
253
226
# Nginx for Azure / OpenID Connect configuration
254
227
# Chris Akker, Shouvik Dutta, Adam Currier - Mar 2024
@@ -299,9 +272,9 @@ Submit your Nginx Configuration.
299
272
```
300
273
301
274
302
-
1. There are no changes needed for the `/etc/nginx/oidc/openid_connect.server_conf`.
275
+
1. There are no changes needed for the `/etc/nginx/oidc/openid_connect.server_conf` - just copy and paste it.
303
276
304
-
1. There are no changes needed for the `/etc/nginx/oidc/openid_connect.js` Javascript file. This is the core Nginx Javascript code that gets executed for this OIDC Solution.
277
+
1. There are no changes needed for the `/etc/nginx/oidc/openid_connect.js` Javascript file - just copy and paste it. This is the core Nginx Javascript code that gets executed for this OIDC Solution. Once the three files are created/modified, click `Submit` to have them loaded into the N4A instance.
305
278
306
279
1. Copy the `cafe.example.com.conf` file provided to `/etc/nginx/conf.d/cafe.example.com.conf`. Notice the new /location block with a REGEX that captures the `/beer and /wine` URIs. This new location block will be protected by Azure Entra ID using OIDC.
307
280
@@ -395,7 +368,7 @@ Submit your Nginx Configuration.
395
368
396
369
## Test Nginx 4 Azure with Entra ID
397
370
398
-
1. You can now test your Azure Entra ID with OIDC config with NGINXaaS. To test open up your browser, open Dev Tools, and try `https://cafe.example.com/beer`. **NOTE:** You will likely have to use a new `Chrome Incognito` browser, because it is caching and using your current credentials, *and you need to start with fresh browser.*
371
+
1. You can now test your Azure Entra ID with OIDC config with NGINXaaS. To test, open up your browser, open Dev Tools, and try `https://cafe.example.com/beer`. **NOTE:** You will likely have to use a new `Chrome Incognito` browser, because it is caching and using your current credentials, *and you need to start with fresh browser.*
399
372
400
373
If everything has been configured correctly, you should see the browser Redirect you to Entra ID for an Azure user authentication logon prompt, and Dev Tools should show you the details of the Redirect to `microsoftonline.com`, highlighted below. Take a moment to look as some of the other objects/headers in the Dev Tools, it should look familiar if you have used OpenID before.
0 commit comments