|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * authentication/external-auth.adoc |
| 4 | + |
| 5 | +:_mod-docs-content-type: PROCEDURE |
| 6 | +[id="external-auth-configuring_{context}"] |
| 7 | +// = Configuring {product-title} to use an external authentication provider |
| 8 | + |
| 9 | += Configuring an OIDC identity provider for direct authentication |
| 10 | + |
| 11 | +TODO: intro |
| 12 | + |
| 13 | +:FeatureName: Direct authentication with an OIDC identity provider |
| 14 | +include::snippets/technology-preview.adoc[] |
| 15 | + |
| 16 | +This example uses Keycloak as the identity provider, configured with a user named `user1`, who is a member of `group1`. |
| 17 | + |
| 18 | +Or provide this as bullets: |
| 19 | + |
| 20 | +* User called `user1` (does this matter?) |
| 21 | +* Group called `group1`, which `user1` as a member (does this matter?) |
| 22 | +* Clients for console and client |
| 23 | +* Creates a secret for console login / console client |
| 24 | +* Creates a config map to store the ca-bundle.crt |
| 25 | + |
| 26 | +// TODO: check other test cases for any other use cases / things we need to document too |
| 27 | + |
| 28 | +// TODO: Do we need to give any tips for configuring Keycloak? |
| 29 | + |
| 30 | +.Prerequisites |
| 31 | + |
| 32 | +* You have enabled the `TechnologyPreviewNoUpgrade` feature set. |
| 33 | +// TODO: Do we call this out? Do they have to do that whole thing, or can they do just the `ExternalOIDC` feature gate? |
| 34 | +* You have configured your external authentication provider. This procedure uses Keycloak as the identity provider. |
| 35 | +* You have access to a `kubeconfig` file for the cluster, to ensure that you still have access to the cluster in the case of an issue with the external authentication provider. |
| 36 | +* You have access to the cluster as a user with the `cluster-admin` role. |
| 37 | ++ |
| 38 | +// TODO actually, we need to say to be logged in using the kubeconfig... |
| 39 | + |
| 40 | +.Procedure |
| 41 | + |
| 42 | +. Log in w/ kubeconfig (TODO: detail why). |
| 43 | + |
| 44 | +. Create a secret (TODO: detail why) by running the following command: |
| 45 | ++ |
| 46 | +[source,terminal] |
| 47 | +---- |
| 48 | +$ oc create secret generic console-secret \ <1> |
| 49 | + --from-literal=clientSecret=<secret_value> \ <2> |
| 50 | + -n openshift-config |
| 51 | +---- |
| 52 | +<1> TODO |
| 53 | +<2> Replace `<secret_value>` with the value of the secret for the client in Keycloak. |
| 54 | ++ |
| 55 | +// TODO: Update callouts with comment syntax |
| 56 | + |
| 57 | +. Extract (TODO: detail why) by running the following command: |
| 58 | ++ |
| 59 | +[source,terminal] |
| 60 | +---- |
| 61 | +$ oc extract cm/default-ingress-cert -n openshift-config-managed --to=router-ca |
| 62 | +---- |
| 63 | ++ |
| 64 | +// TODO: update router-ca example directory |
| 65 | + |
| 66 | +. Create a config map (TODO: detail why) by running the following command: |
| 67 | ++ |
| 68 | +[source,terminal] |
| 69 | +---- |
| 70 | +$ oc create configmap keycloak-oidc-ca --from-file=ca-bundle.crt=router-ca/ca-bundle.crt \ <1> |
| 71 | + -n openshift-config |
| 72 | +---- |
| 73 | ++ |
| 74 | +// TODO: Update callouts with comment syntax |
| 75 | + |
| 76 | + |
| 77 | + |
| 78 | +. Patch the authentication configuration: |
| 79 | ++ |
| 80 | +// TODO: Patch or manually edit? Patch the authentication config - oc patch authentication.config/cluster --type=merge -p=" |
| 81 | ++ |
| 82 | +[source,yaml] |
| 83 | +---- |
| 84 | +# ... |
| 85 | +spec: |
| 86 | + oidcProviders: <1> |
| 87 | + - claimMappings: |
| 88 | + groups: |
| 89 | + claim: groups <2> |
| 90 | + prefix: 'oidc-groups-test:' |
| 91 | + username: |
| 92 | + claim: email <3> |
| 93 | + prefixPolicy: Prefix |
| 94 | + prefix: |
| 95 | + prefixString: 'oidc-user-test:' |
| 96 | + issuer: |
| 97 | + audiences: <4> |
| 98 | + - console-test |
| 99 | + - oc-cli-test |
| 100 | + issuerCertificateAuthority: |
| 101 | + name: keycloak-oidc-ca <5> |
| 102 | + issuerURL: https://keycloak-keycloak.apps.example.com/realms/master <6> |
| 103 | + name: 'keycloak-oidc-server' <7> |
| 104 | + oidcClients: |
| 105 | + - clientID: oc-cli-test <8> |
| 106 | + componentName: cli |
| 107 | + componentNamespace: openshift-console |
| 108 | + - clientID: console-test <9> |
| 109 | + clientSecret: |
| 110 | + name: console-secret <10> |
| 111 | + componentName: console |
| 112 | + componentNamespace: openshift-console |
| 113 | + type: OIDC <11> |
| 114 | + webhookTokenAuthenticator: null <12> |
| 115 | +---- |
| 116 | +<1> The OIDC provider configuration. |
| 117 | +<2> The name of the claim to construct group names for the cluster identity. |
| 118 | +<3> The name of the claim to construct usernames for the cluster identity. |
| 119 | +<4> The list of audience IDs that this authentication provider issues tokens for. |
| 120 | +<5> The name of the config map that contains the `ca-bundle.crt` key. If unset, system trust is used instead. |
| 121 | +<6> The URL for the token issuer. |
| 122 | +<7> The name for external OIDC provider. |
| 123 | +<8> The client ID that your provider uses for the {oc-first}. |
| 124 | +<9> The client ID that your provider uses for the {product-title} web console. |
| 125 | +<10> The name of the secret that stores the secret value for the console client. |
| 126 | +<11> A value of `OIDC` indicates to use an external OIDC identity provider. |
| 127 | +<12> Must be set to `null` when `type` is set to `OIDC`. |
| 128 | ++ |
| 129 | +//TODO what does end of #5 mean? https://polarion.engineering.redhat.com/polarion/#/project/OSE/workitem?id=OCP-79807 - don't see the difference in config for issuerCertificateAuthority being unset |
| 130 | ++ |
| 131 | +For the more details on all available parameters, see "OIDC provider configuration parameters". |
| 132 | + |
| 133 | +.Verification |
| 134 | + |
| 135 | +. Wait for the cluster to roll out new revisions to all nodes. |
| 136 | + |
| 137 | +.. Check the Kubernetes API server Operator status by running the following command: |
| 138 | ++ |
| 139 | +[source,terminal] |
| 140 | +---- |
| 141 | +$ oc get co kube-apiserver |
| 142 | +---- |
| 143 | ++ |
| 144 | +.Example output |
| 145 | +[source,terminal] |
| 146 | +---- |
| 147 | +NAME VERSION AVAILABLE PROGRESSING DEGRADED SINCE MESSAGE |
| 148 | +kube-apiserver 4.19.0 True True False 85m NodeInstallerProgressing: 2 node are at revision 8; 1 node is at revision 10 |
| 149 | +---- |
| 150 | ++ |
| 151 | +The message in the above example shows that one node has progressed to the new revision and two nodes have not yet updated. It can take 30 minutes or more to roll out the new revision to all nodes, depending on the size of your cluster. |
| 152 | + |
| 153 | +.. |
| 154 | + |
| 155 | + |
| 156 | +Auth Operator |
| 157 | + |
| 158 | + |
| 159 | +Check kube-apiserver pods |
| 160 | +oc get po -n openshift-kube-apiserver -L revision -l apiserver |
| 161 | + |
| 162 | +Can see the revisions there |
| 163 | + |
| 164 | +Check auth operator |
| 165 | +oc get co authentication |
| 166 | + |
| 167 | +Not sure what to check for here, but not sure if it’s necessary anyways |
| 168 | + |
| 169 | +Check console cluster operator |
| 170 | +oc get co console |
| 171 | + |
| 172 | +Not sure what to check for here, but not sure if it’s necessary anyways |
| 173 | + |
| 174 | +Check console pods |
| 175 | +oc get po -n openshift-console |
| 176 | + |
| 177 | +Assume looking for the pods age to be new |
| 178 | + |
| 179 | + |
| 180 | +TODO: I guess test logging in via CLI and console? Could take awhile for them to roll out though. |
0 commit comments