Example SSO Implementation
In this example, SSO is implemented by exposing three endpoints with Uyuni, and using Keycloak 9.0.2 or later as the identity service provider (IdP).
Start by setting up the Uyuni Server, and the Keycloak IdP. Then you can add the endpoints as clients, and create users.
|
This example is provided for illustrative purposes only. SUSE does not recommend or support third-party identity service providers, and is not affiliated with Keycloak. For Keycloak support, see https://www.keycloak.org/. |
-
On the Uyuni Server, open the
/etc/rhn/rhn.confconfiguration file and edit these parameters. Replace<FQDN>with the fully qualified domain name of your Uyuni installation:java.sso.onelogin.saml2.sp.entityid = https://<FQDN>/rhn/manager/sso/metadata java.sso.onelogin.saml2.sp.assertion_consumer_service.url = https://<FQDN>/rhn/manager/sso/acs java.sso.onelogin.saml2.sp.single_logout_service.url = https://<FQDN>/rhn/manager/sso/sls
-
In the configuration file, determine the three endpoints to expose:
java.sso.onelogin.saml2.idp.entityid java.sso.onelogin.saml2.idp.single_sign_on_service.url java.sso.onelogin.saml2.idp.single_logout_service.url
-
In the IdP metadata, locate the public x509 certificate. It uses this format:
<IdP_URL>/auth/realms/<Your_Realm>/protocol/saml/descriptor. In the configuration file, specify the public x509 certificate of the IdP:java.sso.onelogin.saml2.idp.x509cert
When you have prepared the Uyuni Server, you can install Keycloak. You can install Keycloak directly on your machine, or run it in a container. In this example, we run Keycloak in a Docker container. For more information about installing Keycloak, see the Keycloak documentation at https://www.keycloak.org/getting-started/getting-started-docker.
-
Install Keycloak in a Docker container, according to the Keycloak documentation.
-
Run the container using the
-tdargument to ensure the process remains running:docker run -td --name=idp -p 8080:8080 -e KEYCLOAK_USER=<user> -e KEYCLOAK_PASSWORD=<password> quay.io/keycloak/keycloak:9.0.2
-
Sign in the Keycloak Web UI as a privileged user, and create a realm using these details:
-
In the
Namefield, enter a name for the realm. For example,SUMA. -
Toggle the
Enabledswitch toOn. -
In the
Endpointsfield, click theSAML 2.0 Identity Provider Metadatalink. This will lead you to<IdP_URL>/auth/realms/<Realm_Name>/protocol/saml/descriptor, where you will see the endpoints and certificate to copy into the Uyuni configuration file.
-
When you have Keycloak running and set up, you can add the endpoints. Keycloak refers to endpoints as clients.
-
In the Keycloak Web UI, create a new client using these details:
-
In the
Client IDfield, enter the endpoint specified in the server configuration file asjava.sso.onelogin.saml2.idp.entityid. For example,https://<FQDN>/rhn/manager/sso/metadata. -
In the
Client Protocolfield, selectSAML. -
Toggle the
Include AuthnStatementswitch toOn. -
Toggle the
Sign Assertionsswitch toOn. -
In the
Signature Algorithmfield, selectRSA_SHA1. -
In the
SAML Signature Key Namefield, selectKey ID. -
In the
Canonicalization Methodfield, selectExclusive.
-
-
In the
Fine Grain SAML Endpoint Configurationsection, add the two endpoints using these details:-
In both the
Assertion Consumer Servicefields, enter the endpoint specified in the server configuration file asjava.sso.onelogin.saml2.sp.assertion_consumer_service.url. For example,https://<FQDN>/rhn/manager/sso/acs. -
In both the
Logout Servicefields, enter the endpoint specified in the server configuration file asjava.sso.onelogin.saml2.sp.single_logout_service.url. For example,https://<FQDN>/rhn/manager/sso/sls.
-
When you have added the endpoints as clients, you can configure the client scope, and map the users between Keycloak and Uyuni.
-
In the Keycloak Web UI, navigate to the tab and assign
role_listas the default client scope. -
Navigate to the tab and add a mapper for user attribute
uid, using the default values. This SAML attribute is expected by Uyuni. -
Navigate to the section and create an administrative user. This user does not need to match the Uyuni administrative user.
-
Navigate to the tab, add an attribute named
uidwith a value that matches the username of the Uyuni administrative user. -
Navigate to the tab, and set the same password as used by the Uyuni administrative user. . Save your changes.
When you have completed configuration, you can test that the installation is working as expected. Restart the Uyuni Server to pick up your changes, and navigate to the Uyuni Web UI. If your installation is working correctly, you are redirected to the Keycloak SSO page, where you can authenticate successfully.