osp-keycloak¶
Overview¶
The Keycloak module provides the user management for OnSphere. The module requires a Mysql database to store its data. By default, we provide the osp-mysql but it is recommended to create an external database.
Value¶
Based on the event generated by Keycloak, we can create values to signal operations done like a user login, logout, error or the modification of the configuration.
Theming¶
The theme (logo, name and background) is configured via stack.cfg. Images must be added on the module via the module.resources file.
The name is used below the logo on the login page.
The logo without text is used on the login page.
The logo with text is used on the account edition navigation bar.
The background image is used on the login page.
Configuration¶
On the module.service file, the following options allow to change the database used to store the current state and the administrator credential.
Database connection¶
As an environment variable :
Variable |
Default |
Description |
---|---|---|
|
mysql |
The provider of the DB to use |
|
osp-mysql |
The address of the database. |
|
3306 |
The port of the database. |
|
keycloak |
The name of the database to use. |
|
keycloak |
The user to connect to the database. |
As secrets :
database_password
: The password for the database (<stack_name>_database_password
by default).
Change the database password¶
See Rotate database password to change the database password.
Administrator username and password¶
admin-user
: The username of the administrator (<stack_name>_admin-user
by default).admin-pwd
: The password for the admin user (<stack_name>_admin-pwd
by default).
Change the administrator user¶
See Rotate admin user to change the database password.
Change the administrator password¶
See Rotate admin password to change the database password.
List of configuration files¶
Filename |
Short description |
Format |
Documentation |
---|---|---|---|
module.service |
Each service is described in its onw file and then assembled |
yaml |
See the Swarm administration or Official documentation |
module.keycloak |
Defines the communication parameter, logging, … |
json |
|
federations.keycloak |
Defines the configuration to access a LDAP, RADIUS server to import the user |
json |
|
realm.keycloak |
Defines the base configuration of the OnSphere realm |
json |
|
groups.keycloak |
Defines the stack local group (The group can also be used in the mapper of a federation or a identity provider) |
json |
|
users.keycloak |
Defines the stack local user |
json |
|
identityProviders.keycloak |
Defines the configuration to delegate the authentication to a LDAP, RADIUS server |
json |
|
owner.keycloak |
Defines the value generated by Keycloak when event occurs |
json |
Complementary information about the definition of some files¶
For the following file, we encourage you to configure the realm via the Keycloak UI and once the configuration is working, export the it (Keycloak configuration) and extract the part you need.
Warning
The Keycloak export hides passwords with *********
. It is necessary to replace them for Keycloak to work after the push.
Note
The id
might cause problem if the configuration is added to a different stack.
-
This file contains the standard configuration of OnSphere realm. It is automatically generated if not present. If you need to edit this part, be very careful, it can completely break Keycloak. We encourage you to test it on a standalone Keycloak.
-
This file contains the configuration for the federations. The federation is automatically imported at startup.
To use LDAP with SSL, you need to configure the
connectionUrl` with `ldaps://...
. If your CA certificate is self-signed, you need to add your CA certificate intocerts/external
. Otherwise, you can setincludeSystemCA` to `true` in `module.keycloak
. This will load all CA provided into Keycloak.In either case, the module will need to be manually restarted.
-
This file contains the identity providers configuration. Identity providers are automatically imported at startup.
Offline access¶
Offline access allows a user to keep a connection going permanently. This is used the front-end to give access to a 24/7 display.
To be able to issue an offline access, users need to have the role offline_access
. We recommend creating a group dedicated to the Wall screen
as you can limit or completely block any action.
To set a role, the following steps are needed:
For a group defined in the configuration (preferred choice):
Open the
groups.keycloak
fileAdd the
offline_access
onrealmRoles
Push the configuration
For a user
Connect to
<stack-ip>:<front-end-port>/auth/admin
with the admin passwordGo to User view
In the Role Mappings tab, assign role
offline_access
Revoking offline access¶
Once an offline access has been granted, it will never expire unless no action is made at least once every 30 days (corresponds to Offline Session Idle timeout
). In order to revoke an access, you need to revoke it manually.
To revoke an offline access, following steps are needed:
For a user:
Connect to OnSphere normally
On the side menu, go to
Account management
Then go on the
Applications
menuClick on
revoke
for the wantedoffline_token
For a supervisor:
Connect to OnSphere normally
On the side menu, go to
User management
Then go on the
Users
menuSelect the user owning the token to revoke
Go to
Consents
Click on
revoke
For an administrator
Connect to
<stack-ip>:<front-end-port>/auth/admin
with the admin passwordGo to User view
Start by logging out all potential active sessions of the user, in the Sessions tab
Revoke the granted Offline Token in the Consents tab
Healthcheck¶
The keycloak health check tests the HTTP availability of the master domain, the health check timer value is the default.