Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verify if kubeadmin can be a regular OAuth user with latest Keycloak and OpenShift #16835

Closed
l0rd opened this issue May 4, 2020 · 8 comments
Closed
Assignees
Labels
area/che-operator Issues and PRs related to Eclipse Che Kubernetes Operator kind/enhancement A feature request - must adhere to the feature request template. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. severity/P1 Has a major impact to usage or development of the system.

Comments

@l0rd
Copy link
Contributor

l0rd commented May 4, 2020

Is your enhancement related to a problem? Please describe.

We currently do not support using OpenShift OAuth when kubeadmin is the only user of the cluster. That's because we assume that Keycloak doesn't support it. But that's something we verfied 1 year ago. And things may have changed.

Describe the solution you'd like

Verify if latest versions of Keycloak and OpenShift allow to use kubeadmin as a valid OAuth identity.

@l0rd l0rd added kind/enhancement A feature request - must adhere to the feature request template. team/devex labels May 4, 2020
@l0rd l0rd added the severity/P1 Has a major impact to usage or development of the system. label May 4, 2020
@l0rd l0rd added the area/che-operator Issues and PRs related to Eclipse Che Kubernetes Operator label May 5, 2020
@davidfestal
Copy link
Contributor

davidfestal commented May 5, 2020

I justed tested on a 4.3.9 OpenShift cluster, and the JSON profile returned for the kube:admin user is the following:

╰─ curl -k -H "Authorization: Bearer xxxxxxxxx" "https://api.test-ocp43.codereadyqe.com:6443/apis/user.openshift.io/v1/users/~"
{
  "kind": "User",
  "apiVersion": "user.openshift.io/v1",
  "metadata": {
    "name": "kube:admin",
    "selfLink": "/apis/user.openshift.io/v1/users/kube%3Aadmin",
    "creationTimestamp": null
  },
  "identities": null,
  "groups": [
    "system:authenticated",
    "system:cluster-admins"
  ]
}                                                                                                                                                                                                                                            

Note that there is no "identity", since the kube:admin user is a hard-coded internal user that is not linked to any OAuth identity provider: it exists by default before installing any identity provider.

As a comparison, here is the profile of a user created with the htpasswd identity provider:

╰─ curl -k -H "Authorization: Bearer xxxxxxx" "https://api.test-ocp43.codereadyqe.com:6443/apis/user.openshift.io/v1/users/~"
{
  "kind": "User",
  "apiVersion": "user.openshift.io/v1",
  "metadata": {
    "name": "user",
    "selfLink": "/apis/user.openshift.io/v1/users/user",
    "uid": "e01e78aa-50d9-482e-8bb4-3442a5247313",
    "resourceVersion": "5462325",
    "creationTimestamp": "2020-04-17T09:47:59Z"
  },
  "identities": [
    "htpasswd:user"
  ],
  "groups": [
    "system:authenticated",
    "system:authenticated:oauth"
  ]
}

Now here is why the limitation is still there in the latest Keycloak: The openshift-v4 Keycloak identity provider requires a non-null uid in order to be able to link the openshift user to the Keycloak user, as shown here:

In the case of the user kubeadmin, the user profile metadata doesn't contain such a uid.
If we could either:

  • return an uid in the user profile OS endpoint
  • or use a hard-coded, kubeadmin-dedicated uid in the Keycloak code shown above,
    I assume this could allow releasing this limitation from the Keycloak-Openshift integration.

To summarize: For now the kubeadmin user still cannot be linked to a Keycloak user with the openshift-v4 Keycloak indentity provider. And it seems this can be fixed only by one of the 2 solutions mentioned above.

cc @slaskawi

@davidfestal
Copy link
Contributor

On the Openshift side, I created the following issue: openshift/origin#24950

@che-bot
Copy link
Contributor

che-bot commented Jan 4, 2021

Issues go stale after 180 days of inactivity. lifecycle/stale issues rot after an additional 7 days of inactivity and eventually close.

Mark the issue as fresh with /remove-lifecycle stale in a new comment.

If this issue is safe to close now please do so.

Moderators: Add lifecycle/frozen label to avoid stale mode.

@che-bot che-bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 4, 2021
@l0rd
Copy link
Contributor Author

l0rd commented Jan 4, 2021

Closing this issue since the verification has been done.

@l0rd l0rd closed this as completed Jan 4, 2021
@iam-veeramalla
Copy link

Just to update here ... This is now posible.
@l0rd

@l0rd
Copy link
Contributor Author

l0rd commented Feb 17, 2022

@iam-veeramalla this is possible since Che v7.42. If you are testing on CRW it will be possible starting with CRW 2.16.

@iam-veeramalla
Copy link

I am not using CRW. I was waiting for Keycloak to support this feature, I saw previously that you were also waiting for this feature like me.

I just thought of updating that it's possible now but looks like you guys already knew it :)

@l0rd
Copy link
Contributor Author

l0rd commented Feb 17, 2022

Oh sorry, I didn't know about Keycloak. What we did is that we removed it as a Che dependency: on OpenShift we use the embedded OAuth service.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/che-operator Issues and PRs related to Eclipse Che Kubernetes Operator kind/enhancement A feature request - must adhere to the feature request template. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. severity/P1 Has a major impact to usage or development of the system.
Projects
None yet
Development

No branches or pull requests

4 participants