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

Role-based Access Controls for SSO #3525

Closed
alexec opened this issue Jul 20, 2020 · 25 comments · Fixed by #4198
Closed

Role-based Access Controls for SSO #3525

alexec opened this issue Jul 20, 2020 · 25 comments · Fixed by #4198
Assignees
Labels
Milestone

Comments

@alexec
Copy link
Contributor

alexec commented Jul 20, 2020

Summary

Currently any user that logs in using SSO escalates to the argo-server service account. We would like other options.

Motivation

TBD

Proposal

Either:

  • Casbin style similar to Argo CD.
  • Client mode style i.e. map groups to a service account.

See:


Message from the maintainers:

If you wish to see this enhancement implemented please add a 👍 reaction to this issue! We often sort issues this way to know what to prioritize.

@alexec
Copy link
Contributor Author

alexec commented Jul 24, 2020

We need some requirements for this issue. How do you want RBAC to work and be configured? Please be specific!

alexec added a commit to alexec/argo-workflows that referenced this issue Jul 24, 2020
@alexec
Copy link
Contributor Author

alexec commented Jul 27, 2020

We need something beyond 👍 for this issue to be worked on. Please can you add some information about how you expect RBAC to work?

@kabilan6
Copy link

Just a thought to start with - Read only user ( can only view workflow, all submit button should be disabled) and admin user with all privileges

@alexec
Copy link
Contributor Author

alexec commented Jul 28, 2020

One cheap solution to RBAC is to base it on the URL of each request to the server using Casbin.

Operators must configure a model.conf and policy.csv and add them as files to the argo-server container (I would use a config-map volume for this):

So...

  • sub - the OAuth2 subject.
  • obj - the URL
  • act - the HTTP method: GET/PUT/POST/DELETE etc

Casbin model:

model.conf

[request_definition]
r = sub, obj, act

[policy_definition]
p = sub, obj, act

[policy_effect]
e = some(where (p.eft == allow))

[matchers]
m = r.sub == p.sub && keyMatch(r.obj, p.obj) && (r.act == p.act || p.act == "*") 

Casbin policy (you would configure this):

policy.csv

g, alexec, admin
g, kablin6, readonly
p, admin, /*, *
p, readonly, /*, GET

Some examples of the URLs:

  • /api/v1/info
  • /api/v1/version
  • /api/v1/userinfo
  • /api/v1/workflow/{namespace}
  • /api/v1/workflow/{namespace}/{name}
  • /api/v1/workflow/{namespace}/{name}/retry
  • /api/v1/workflow-templates/{namespace}/{name}
  • /api/v1/archived-workflows/{uid}
  • /artifacts/{namespace}/{name}/{nodeId}{artifactName}
  • /artifacts-by-uid/{uid}/{nodeId}{artifactName}
  • /oauth2/redirect
  • /oauth2/callback
  • /index.html
  • /main.js

Many users want to use namespace for data segregation, but this would not work for artifacts archived workflows (we could fix that).

@alexec
Copy link
Contributor Author

alexec commented Jul 28, 2020

I'd like to hear more uses cases please.

@sudarshntn
Copy link

@alexec The SSO enablement in ArgoWorkflow is not seem less like we have in ArgoCD where we allow existing OIDC provider also. We would like to have a simplified SSO functionality along with RBAC enabled.

@vladlosev
Copy link
Contributor

The casbin based policy is quite a bit more complex than simply mapping a group returned by OIDC to a k8s service account. This is mostly due to the burden of having to write and maintain a policy covering constantly expanding and changing set of URLs.

@alexec
Copy link
Contributor Author

alexec commented Jul 29, 2020

The casbin based policy is quite a bit more complex than simply mapping a group returned by OIDC to a k8s service account. This is mostly due to the burden of having to write and maintain a policy covering constantly expanding and changing set of URLs.

I think you're probably correct about that.

@alexec
Copy link
Contributor Author

alexec commented Aug 11, 2020

We still don't have enough use cases to be confident we can implement the right solution for this issue.

I've added as a topic to the next community meeting:

http:https://bit.ly/argo-wf-cmty-mtng

@alexec
Copy link
Contributor Author

alexec commented Aug 19, 2020

I think the community meeting gave a couple of key use cases

  • Anonymous read-only access.
  • Authenticated read-only access.
  • Authenticated access by mapping OIDC groups to service accounts.

@alexec
Copy link
Contributor Author

alexec commented Aug 19, 2020

RBAC configuration proposal:

kind: ConfigMap
metadata:
  name: workflow-controller-configmap
data:
  rbac: 
    # to configure the default account to use:
    defaultServiceAccount: my-sa
    # use the first matching rule
    rules:
    - groups: 
        anyOf:
        - my-oidc-group
       serviceAccount:
         name: my-sa

@alexec alexec added the backlog label Aug 19, 2020
alexec added a commit to alexec/argo-workflows that referenced this issue Aug 20, 2020
@alexec
Copy link
Contributor Author

alexec commented Aug 20, 2020

We have a number of question on this feature and have put them into a proposal:

https://docs.google.com/document/d/1OTVPpWCKM_oO4Z2_pMN1LTyTjWbPv4G9SDmTIpGnIQo/edit?usp=sharing

@alexec
Copy link
Contributor Author

alexec commented Aug 20, 2020

Please comment.

@alexec
Copy link
Contributor Author

alexec commented Aug 24, 2020

@alexec
Copy link
Contributor Author

alexec commented Aug 24, 2020

@alexec alexec self-assigned this Aug 28, 2020
@alexec alexec linked a pull request Sep 1, 2020 that will close this issue
6 tasks
@alexec
Copy link
Contributor Author

alexec commented Sep 1, 2020

I've created a developer build for your testing: argoproj/argocli:rbac

To test this, you need the following extra configuration:

Please test and tell me if it meets your needs.

@alexec
Copy link
Contributor Author

alexec commented Sep 3, 2020

@danxmoran, @clelange, @ephemeral, @kabilan6, @vladlosev, @lukasmrtvy, @gordonbondon, @dcd000, @rgoldfinger-quizlet, @SM616, and 23 people who reacted with thumbs up emoji.

Your feedback is key to ensuring that this feature gets merged. I'd love to get it into the v2.12 release next month, but I really need more feedback from the community. Ideally I'm looking for people to take a deep dive and test it, but reviewing the YAML configuration and reasoning about it would be very valuable too.

To test this, you only need to upgrade the Argo Server.

@vladlosev thank you for your feedback!

Alex

@ephemeral
Copy link

Hey @alexec, our use case is quite simple atm. We are heavy users of ArgoCD, and we use Okta + Dex for auth. We would like to use something similar for Argo Workflows. (Casbin style)

Happy to join the next community meeting to discuss further.

Thanks,
Pierre

@alexec alexec added this to the v2.12 milestone Sep 14, 2020
@alexec
Copy link
Contributor Author

alexec commented Sep 14, 2020

Don't forget to try out argoproj/argocli:rbac to see it works for you.

@vladlosev
Copy link
Contributor

@alexec I tried installing this image in our cluster but have no success making it work. I noticed in the server's logs that it was not outputting the rbac field as coded on line 130 in server/auth/sso/sso.go in the PR. Can it be that the image has been built of some earlier code revision, not reflecting the latest changes in the PR?

@alexec
Copy link
Contributor Author

alexec commented Sep 15, 2020

@alexec I tried installing this image in our cluster but have no success making it work. I noticed in the server's logs that it was not outputting the rbac field as coded on line 130 in server/auth/sso/sso.go in the PR. Can it be that the image has been built of some earlier code revision, not reflecting the latest changes in the PR?

Thank you. I'll investigate.

@alexec
Copy link
Contributor Author

alexec commented Sep 15, 2020

Try this:

docker run argoproj/argocli:rbac version
argo: v2.3.0-rc3
  BuildDate: 2020-09-15T21:56:10Z
  GitCommit: dd5aad87e4cd64c126b3fa2209903c566bbaee86 # <-- check this is same
  GitTreeState: clean
  GitTag: v2.3.0-rc3 # <-- ignore this :)
  GoVersion: go1.13.4
  Compiler: gc
  Platform: linux/amd64

@vladlosev
Copy link
Contributor

vladlosev commented Sep 15, 2020

@alexec it works like a charm with the updated image! The operation is very transparent when permissions are sufficient and the error messages are quite conspicuous when the user lacks the permissions. I could go and use it right now.

Sorry you didn't get to ship it in 2.11.

@alexec
Copy link
Contributor Author

alexec commented Oct 1, 2020

image

@bnbrijesh
Copy link

bnbrijesh commented Nov 11, 2022

Doesnt this support email scope ? Azure doesnt seem to support groups scope, I mean for RBAC mapping. in rbac-rule

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment