-
Notifications
You must be signed in to change notification settings - Fork 0
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
IAM <-> Workspace integration for initial workspace provisioning #34
Comments
We have concluded that Keycloak groups will represent teams and be used to manage the "user association" with workspaces. Note that the association is many-to-many (i.e., workspaces can be accessed by multiple users, and users can belong to multiple workspaces). Sign-off:
|
I generally agree with your comment above. Regarding points 4 and 5: |
thanks for your fast response, comments inline
Yes, matches my understanding
I assume the need for multiple Keycloak clients arises from handling different domains, correct? Keycloak doesn’t seem to support subdomain whitelisting with something like *.develop.eoepca.org, does it? If not, we could explore making these workspace UI deployments accessible under different subpaths within the same domain? That approach should work, right? I understand the rationale behind point 5, but why do you see the need for dynamic clients also for point 4? |
A single Keycloak client can span multiple domains, but it is probably cleaner to add a client for each new domain than to update an existing client by adding URLs again and again. I tried to specify a base URL with wildcard or no base URL at all, but (as expected) this does not work. Keycloak allows wildcards for the path, but apparently not for the host part of the URL. |
so regardless which strategy we will follow, we need to not just authenticate the user but also check if he is allowed to access the url based on the user<->group association lets assume we have userA and userB associated to team ws-team4, what must be setup upfront in keycloak and how does the K8s kind: ApisixRoute will then look like for talking to the team I'm also afraid that the subroute path won't generally work as many applications will expect to be served at root path (for sure we can adapt for workspace-ui but there will be also other applications deployed in future so same problem then...) can you prepare a setup with keycloak, ?OPA policy if needed?, ApisixRoute please and we will try to automate during workspace provisioning- do you agree and does that make sense to you? |
Let me first check if my understanding is roughly correct: |
Thanks & yes, correct (https://ws-test4.develop.eoepca.org will just be a new Workspace-UI deployment specifically for team Let's forget the path based routing here for the Workspace-UI. Just to clarify - there will be one separate dedicated Workspace-UI Deployment for each team, but there will only be one central Workspace-API Deployment in the cluster - this Workspace-API Deployment is mainly used to retrieve credentials for the team, e.g. to access the buckets (e.g. user triggers Processing BB and this component will impersonate user to get credentials via HTTP GET workspace-api>/workspaces/ and uploads results there - my understanding at the moment at least) |
to explore for the WorkspaceUI we manually applied
can you create a user in keycloak and associate it with group ws-test4, then only this user should have access feel free to adapt accordingly directly in the cluster (it is for testing so not in ArgoCD as it would be reconciled otherwise) similar to what @rconway configured for the completely different topic: the WorkspaceUI uses WebSockets and they don't seem to work, can you enable that on the ingress controller (or does that need something on the route?), thanks |
According to WebSocket support, I assume that this is the intended solution: https://apisix.apache.org/docs/ingress-controller/concepts/apisix_route/#websocket-proxy |
websockets are working now, thanks for fast mitigation! |
As you may already have noticed, I modified the route and added authentification and authorization through Keycloak. On Keycloak side, I added the following:
Altogether, this gives (only) user "ws-test4-user" (and other potential members of group "ws-test4") access to the "ws-test4" workspace. It would be possible to simplify this a bit by omitting the role and letting the policy check the group directly instead, but this would cause too much coupling between user and permission management IMO. |
via https://iam-auth.develop.eoepca.org/admin/eoepca/console/ I added my own user to group ws-test4 and afterwards I could access https://ws-test4.apx.develop.eoepca.org/, cool thanks - good work, also like/agree on your permissions approach!
via our IaC tooling (need to explore now if this all is already supported and possible)
I put the current state of ws-test4 apisix route here as reference, we will build on top of that
|
I added the "view-clients" and "query-clients" roles to your user, which should at least allow you to inspect the client. If anything is still missing, I can add further roles tomorrow. Also tomorrow I am going to amend the "workspace_pipeline" client. |
thanks for clarification you need to help me - where do I find the client policies in this keycloak console UI tool? |
There is an Authorization tab with several subtabs in the client details view. However, you probably could not see it, because I had forgotten to give you the "view-authorization" role. I hope that you can see it now. |
yes, thanks! |
I assigned the following roles to the workspace_pipeline client:
I omitted the view-* and query-* roles for now, assuming that they are either not required for API access or implied in the manage-* roles. I can add some of them later if they turn out to be required. |
while we have managed to automate the provisioning of Client, Role and ClientRolePolicy (see e.g. client we will investigate deeper tomorrow (need to dive into actual IaC code), but can you please explain the keycloak logic here and also check if there perhaps is another way without requiring replacing |
Could you explain what exactly the issue is, so that I know what to look for? Is it a missing (or maybe well-hidden) API, or just weird behaviour of an API that should do the right thing, or anything else? |
we are still struggling with the keycloak-provider of our (declarative) IaC tool to get that permission set properly, so we are still investigating a good way to achieve or workaround so we can automate the whole flow in workspace pipeline thanks for your ideas and the notebook link, we will further explore - have a good weekend |
we have the policy "Role ws_access Policy" in client "ws-test5"
what would be the necessary API call now to get this policy added to the Authorizaton | Permissions for this client, can you help with that or shall we have a short call, e.g. 10am? |
I am not really familiar with Keycloak's authZ API, but I am trying to find out.
This is not exactly what you want to do, but it could be an alternative. I assume that there is a way to add policies to existing permissions, because the Keycloak UI allows doing that, but I do not know how. |
Maybe |
Another way to manipulate permissions may be the UMA-compliant Protection API provided by Keycloak: https://www.keycloak.org/docs/latest/authorization_services/index.html#_service_protection_api |
A request for a new workspace can come from different sources:
The request will typically include details like the project name, the subscription/resources granted (such as storage quotas, compute/mem limits or overall hourse, gpu yes/no, ...) and the email address of the designated project owner.
Task-WS1) Extend with email of project owner
Once the platform operator receives such a request, they review and provision it. This is automated by the (configurable) EOEPCA provisioning pipeline, creating
As discussed, the pipeline should also create a new group in Keycloak using the project name and associate the user (whose email was provided in the request as owner) with this new Keycloak group. By convention the Keycloak group and Workspace name should match, the concrete Project Name should be an attribute on the Keycloak group.
Current Assumption: the user has already registered and already exists in the system (will be tracked in separate GitHub Issue TBD)
Task-IAM1) IAM BB to setup properly scoped client allowing the provisioning pipeline to execute these actions, i.e. with ability to list and create groups in Keycloak, associate users within a group, and check if a user already exists in the system
Task-WS2) Workspace BB to automate theses actions within the provisioning pipeline
Access to the workspace and its resources needs to be controlled. Only users who are part of the Keycloak group associated with the project should be allowed to access the deployments to the workspace. To achieve this, the pipeline can automatically create a properly configured Kubernetes Ingress Object (or custom CRD). If necessary the provisioning pipeline can also create additional "resources" (like a policy) on Keycloak side
Task-IAM2) IAM BB to specify what needs to be created
Task-WS3) Workspace BB to implement accordingly
The text was updated successfully, but these errors were encountered: