question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Moving users/groups definition from qhub-config.yaml to Keycloak

See original GitHub issue

Background

Keycloak has been added to Qhub in development main branch. This allows users and groups to be created and managed through the Keycloak web console. It is also possible to configure Keycloak so that, for example, users are federated from an external database such as LDAP.

In previous versions (and current, v0.3.13) of QHub, users and groups had to be added within the qhub-config.yaml file, and a redeployment of the whole system needed to be triggered.

In tandem with the move to Keycloak, uid and gid values are no longer required (in the YAML or anywhere else). Everyone is user jovyan and shared group folders are only mounted for users within those groups - previously, all shared group folders were visible but were only accessible to authorized users.

A separate ‘root’ user has a password into the Keycloak web console. That user can manage Keycloak but is not a regular QHub user - it cannot login to the usual QHub JupyterHub/Lab area etc.

Discussion

As part of the upgrade to a Keycloak-enabled version of QHub, a new qhub upgrade command will process an existing qhub-config.yaml. It will remove the users and groups keys from the YAML file permanently, and will also spit out a JSON file containing the users and groups. That file is intended to be used as a one-off import into the new Keycloak instance once it is running. It can be imported through the Keycloak web console.

Going forward, users and groups will be managed through the Keycloak web console. I believe this is more natural for most admins, and avoids the need for redeployment. However, I am aware that heavy ‘gitops’ users may miss the ability to edit the YAML file to add/remove users.

Right now in main branch, it is still possible to add users and groups keys to the qhub-config.yaml file (uid/gid no longer allowed or needed). These users/groups will be synced with the Keycloak database when redeployed. However, these then become managed by Terraform meaning that the users/groups will be deleted automatically if they are dropped from the YAML file at some point (although it is technically possible to remove them from Terraform management). If users/groups are deleted from Keycloak manually, they will be reinstated whenever redeployment happens. However, that will not be the case when manually-added users are manually deleted. If a user is added manually to Keycloak, an error will occur if that same user is subsequently added to the qhub-config.yaml file.

While it could be tempting to allow both approaches - YAML or Keycloak web console - to be available alongside each other, I believe it will be confusing and lead to mistakes in user management.

My proposal is to remove this temporary functionality (users/groups still being allowed in qhub-config.yaml) from the main branch before the next full release of QHub.

Please let us know if you have any views about the proposed move to managing users/groups in Keycloak, or about making user/group management unavailable in the YAML file.

Value/benefit

This will leave only one approach to user management that we need to support, in a configurable environment (Keycloak), and will cause less confusion for admins. It avoids having an extra choice that admins need to make at deployment time.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
danlestercommented, Dec 1, 2021

I will move forward with a PR for my proposal as described initially.

0reactions
rsignell-usgscommented, Nov 19, 2021

I like the suggested approach of having only one way to manage users, and I’m in favor of only one way to manage the users. While I did like just editing the yaml file to add new users, we now have 90 users and it’s becoming a bit annoying that most of the config is just user info.

We already are in the position with the ESIP Qhub that we need to deploy a new version and then migrate user data, so we are fine doing this all at once when v0.4 is released.

Read more comments on GitHub >

github_iconTop Results From Across the Web

create user with temporary password keycloak later sendo ...
I've reset user password and set it to new temporary in keycloak. ... specify an initial root password for master realm in qhub-config.yaml...
Read more >
Keycloak - What is QHub? — Docs
QHub includes a deployment of Keycloak to centralise user management. ... in the Keycloak deployment's values.yaml file) from the qhub-config.yaml file.
Read more >
qhub Changelog - PyUp.io
Explicit user facing changes: - Upgrading to `v0.4.0` will require a filesystem backup given the scope and size of the current change set....
Read more >
qhub - bytemeta
Moving users/groups definition from qhub-config.yaml to Keycloak. danlester ... Manual Keycloak backup - write up in docs[documentation]. trallard.
Read more >
Keycloak docs
A typical workflow is as follows: A client sends an authentication request over SSL/TLS channel. During SSL/TLS handshake, the server and the client...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found