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: tutorial/index.md
+59-62Lines changed: 59 additions & 62 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ Set up an isolated test environment with Multipass and the `charm-dev` blueprint
17
17
18
18
On your machine, install Multipass and use it to set up an Ubuntu virtual machine (VM) called `my-juju-vm` from the `charm-dev` blueprint.
19
19
20
-
> See more: [Set things up (automatically)](https://canonical-juju.readthedocs-hosted.com/en/latest/user/howto/manage-your-deployment/manage-your-deployment-environment/#manage-your-deployment-environment)
20
+
> See more: [Set things up (automatically)](https://documentation.ubuntu.com/juju/latest/howto/manage-your-deployment/manage-your-deployment-environment/index.html#manage-your-deployment-environment)
21
21
22
22
```{note}
23
23
This document also contains a manual path, using which you can set things up without the Multipass VM or the `charm-dev` blueprint. However, please note that the manual path may yield slightly different results that may impact your experience of this tutorial.
@@ -35,7 +35,10 @@ Make sure MicroK8s is correctly set up:
Running `juju status` should now two offers that we will use from a different model in the next step.
81
84
82
-
## Setup External IdP
83
-
84
-
We recommend using the following [how-to](https://charmhub.io/topics/canonical-identity-platform/how-to/integrate-external-identity-provider)
85
-
and choosing your preferred identity provider.
86
-
87
-
```{note}
88
-
You can temporarily skip this step and return to it later, JIMM can still run without integrating the identity bundle to an external identity provider but login to JIMM will not work.
85
+
### Create an user.
86
+
```text
87
+
# disable MFA to avoid unnecessary steps
88
+
juju config kratos enforce_mfa=False
89
+
# create the user and get the identity-id
90
+
juju run kratos/0 create-admin-account [email protected] password=test username=admin
91
+
# reset the password to make it active
92
+
juju add-secret password-secret password=abc
93
+
juju grant-secret password-secret kratos
94
+
juju run kratos/0 reset-password identity-id=<identity-id> password-secret-id=<secret:id>
89
95
```
90
96
91
-
Setting up an IdP to point to your local environment can be tricky depending on the provider used. Below are some tips to make this work.
92
-
93
-
When setting up certain providers, e.g. Google, security restrictions limit what redirect URLs can be used. Some restrictions include,
97
+
### Expose the identity bundle to your host machine. (only necessary if running in Multipass)
98
+
The reason you need to expose the identity bundle to your host machine is that at the end of this tutorial
99
+
you will need to login via a web browser.
94
100
95
-
- The redirect URL must be `https`.
96
-
- The redirect URL must be a top level domain `.com`.
97
-
- The redirect URL cannot be an IP address.
98
-
99
-
The redirect URL is the URL that your browser is returned to after you have signed in at the identity provider. When using Canonical's
100
-
identity bundle, the redirect URL after login will be something like `https://<kratos-public-url>/self-service/methods/oidc/callback/<provider-id>`.
101
-
as described in the above how-to. Although the URL is `https`, it is an IP address.
102
-
This address needs to be registered in your identity provider as an approved redirect URI/URL.
103
-
104
-
If your preferred identity provider does not accept an IP address, we recommend using a tool like `https://nip.io/`,
105
-
a DNS resolver service that can map any IP address to a hostname.
106
-
107
-
| This service can map hostnames of the form `<anything>[.-]<IP Address>.nip.io` to return simply `<IP Address>`.
108
-
| E.g. `magic.127.0.0.1.nip.io` resolves to `127.0.0.1`. This service is very useful when working with an IdP locally for testing.
109
-
110
-
```{note}
111
-
The same effect can be obtained by editing your `/etc/hosts` file but this would require changes on your host system and within various containers.
101
+
Locate the IP of your Multipass instance by running `multipass list` on your host machine, if you have multiple IPs pick the first one.
Note that the public and private key pairs must be generated by the [go macaroon bakery repository](https://github.com/go-macaroon-bakery/macaroon-bakery).
290
-
To do this briefly run the following command, ensuring you have the `go` tool installed:
291
-
292
-
```text
293
-
go run github.com/go-macaroon-bakery/macaroon-bakery/cmd/bakery-keygen/v3@latest
294
-
```
295
-
296
-
This should return a private and public key pair as below which can be used to configure JIMM.
297
-
These values are only used internally between JIMM and Juju controllers.
298
-
299
-
```text
300
-
{
301
-
"public": "<public-key>",
302
-
"private": "<private-key>"
303
-
}
304
-
```
305
-
306
295
At this point you can run `juju status` and you should observe JIMM is active.
307
296
Navigate to `http://test-jimm.localhost/debug/info` to verify your JIMM deployment.
308
297
309
298
Finally we will obtain the ca-certificate generated to ensure that we can connect to JIMM with HTTPS.
310
299
This is necessary for the Juju CLI to work properly
311
300
312
301
```text
313
-
juju run jimm-cert/0 get-ca-certificate --quiet | yq .ca-certificate | sudo tee /usrlocal/share/ca-certificates/jimm-test.crt
314
-
sudo update-ca-certificates
302
+
juju run jimm-cert/0 get-ca-certificate --quiet | yq .ca-certificate | sudo tee /usr/local/share/ca-certificates/jimm-test.crt
303
+
sudo update-ca-certificates --fresh
315
304
```
316
305
317
306
Verify that you can securely connect to JIMM with the following command:
@@ -325,7 +314,15 @@ You should be presented with a message to login.
325
314
326
315
```text
327
316
juju login test-jimm.localhost:443 -c jimm-k8s
328
-
# Please visit https://iam.10.64.140.46.nip.io/iam-hydra/oauth2/device/verify and entercode <code> to log in.
317
+
# Please visit https://<multipass-ip>/iam-hydra/oauth2/device/verify and entercode <code> to log in.
318
+
```
319
+
Visit the link from your browser, fill the credentials you've created before and you should see.
0 commit comments