Install
Activate OIDC in rancher UI​
First connect to keycloak with admin user
-
Retrieve admin credentials to connect to Keycloak
echo kc_username = $(kubectl -n kosmos-iam get secret import-admin-keycloak -ojsonpath='{.data.username}'| base64 -d)
echo kc_password = $(kubectl -n kosmos-iam get secret import-admin-keycloak -ojsonpath='{.data.password}'| base64 -d) -
Reach
rancherclient:- Select the realm
kosmosin the upper left corner - Click on
Clientsin the left panel to show the client list and then onrancherin this list
- Select the realm
- Retrieve configuration information:
- Click on the tab
Credentialsand retrieve theClient Secret - Click on
Realm Settingson the left panel and then at the bottom of the settings click on theOpenID Endpoint Configurationlink. - Keep the new browser tab open
- Click on the tab
Then connect to Rancher UI and connect with an admin user:
-
Retrieve the bootstrap password to log in to Rancher
kubectl -n cattle-system get secret bootstrap-secret -o go-template='{{.data.bootstrapPassword|base64decode}}{{"\n"}}' -
Log in to Rancher
https://rancher.$KOSMOS_DOMAIN
- Enter the bootstrap password when logging into the Rancher UI for the first time
- Click “Log in with local user”
- In the new window, check “Use a randomly generated password” (default)
- Save the randomly generated password provided by Rancher (e.g., OccQ2cHb0P0luOdt)
- Check “By checking the box, you accept …”
- Click “Continue”
- Click on the user icon in the bottom left corner
- Click on the
Auth providertab in the new left panel - Click on the
Keycloaklabeled with an orangeOIDC - Fill the fields in the
Configure a Keycloak OIDC accountsection:- the
Client IDisrancher - the
Client Secretis the one retrieved in the Keycloak UI previously - do not fill the
Private KeyandCertificatefields
- the
- Activate the option
Enable group search - In the
Endpointssection selectSpecify, click on theShow Advancedbutton and have your keycloakOpenID Endpoint Configurationpreviously opened nearby:- leave the
Rancher URLas is Issuer: paste the value from the fieldissuerin keycloak configuration (eg:https://auth.$KOSMOS_DOMAIN/realms/kosmos)Auth Endpoint: paste the value from the fieldauthorization_endpointin keycloak configuration (eg:https://auth.$KOSMOS_DOMAIN/realms/kosmos/protocol/openid-connect/auth)Token Endpoint: paste the value from the fieldtoken_endpointin keycloak configuration (eg:https://auth.$KOSMOS_DOMAIN/realms/kosmos/protocol/openid-connect/token)User Info Endpoint: paste the value from the fielduserinfo_endpointin keycloak configuration (eg:https://auth.$KOSMOS_DOMAIN/realms/kosmos/protocol/openid-connect/userinfo)JWKS URL&Authorization Context Reference: do not fill
- leave the
- Click on the
- Click on
Enableand when asked, authenticate with therancher-admin@athea.techuser-
the password can be retrieved with the command:
kubectl -n cattle-system get secret rancher-admin-oidc -o jsonpath='{.data.password}' | base64 --decode ; echo
-
With the OIDC now activated, you can setup basic authorizations:
- While on the
Authentication Provider:Keycloak (OIDC)result page click onRestrict access to only the authorized users & groups
- In the new
Authorized Users & Groupssection, add the following groups and click onSave- adminsysteme
- adminsecurite
- admintrait
- adminapp
- dev
- intg
- In the left panel click on
Groups - In the new menu, click on the
Assign Global Roles - In
Select Memberchoose theadminsystemegroup, and give it the global permissionsAdministratorand click onSave - In the new menu, click on the
Assign Global Roles - In
Select Memberchoose theadminsecuritegroup, and give it the global permissionsAdministratorand click onSave - In the new menu, click on the
Assign Global Roles - In
Select Memberchoose theadmintraitgroup, and give it the global permissionsStandard Userand click onSave - In the new menu, click on the
Assign Global Roles - In
Select Memberchoose theadminappgroup, and give it the global permissionsStandard Userand click onSave - In the new menu, click on the
Assign Global Roles - In
Select Memberchoose thedevgroup, and give it the global permissionsStandard Userand click onSave - In the new menu, click on the
Assign Global Roles - In
Select Memberchoose theintggroup, and give it the global permissionsStandard Userand click onSave