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

Full Cilogon integration #1089

Merged
merged 75 commits into from
Mar 25, 2022
Merged

Conversation

GeorgianaElena
Copy link
Member

@GeorgianaElena GeorgianaElena commented Mar 11, 2022

This PR adds another way to use CILogon auth for our hubs, one that doesn't require relying on Auth0.

It adds a script, cilogon_app.py that:

  • uses the administrative client credentials that we received from CILogon to create/udpate/delete/get approved OAuth applications for our hubs.
  • stores and ecrypts the credentials of each hub in `config/clusters/<cluster_name>/enc-<hub_name>.secret.values.yaml

The process to activate CILogon for a hub using the credentials generated above is very similar to the current process of using GitHubOAuthenticator.

Also, this PR enables CILogon for our 2i2c dask-staging hub and 2i2c demo hub. It also adds credentials for the 2i2c staging hub also, but without activating it for this hub.

The dask-staging hub uses this, so you can play with it. It works from what I've tested so far.

Reference #967

@GeorgianaElena GeorgianaElena changed the title Cilogon admin Full Cilogon integration Mar 11, 2022
@GeorgianaElena GeorgianaElena marked this pull request as draft March 11, 2022 23:41
@GeorgianaElena GeorgianaElena marked this pull request as ready for review March 14, 2022 16:24
@GeorgianaElena GeorgianaElena requested a review from a team March 14, 2022 16:24
Copy link
Member

@choldgraf choldgraf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks nice to me! A few comments and questions. I'll let others on the @2i2c-org/tech-team give a more technical review!

  • Could we add the start of some lightweight docs for how we'd use CILogon auth? I think it could be helpful exercise to think about the changes from a user's perspective. It doesn't need to be totally complete since I know you'd like to get the PR in quickly, but something to help people start would be useful.
  • Given what you've seen, are there any major decision-points that you can think of where we'd want to use Auth0 vs. CILogon?
  • Have you encountered any major downsides or concerns about this approach? Or have you encountered any major benefits?

connection: google-oauth2
enabled: false
# connection: google-oauth2
cilogon:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that we are allowing them to co-exist for a bit! As long as we don't have too much headaches maintaining both, this should give us time to try out CILogon without disrupting our current workflows as much

deployer/cilogon_auth.py Outdated Show resolved Hide resolved
Copy link
Member

@yuvipanda yuvipanda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for working on this, @GeorgianaElena!!!!

The primary reason the auth0 stuff was baked into the deployer was so we won't have to keep secret files in the repo. However, given that is not possible with CILogon (we can not retrieve secret key multiple times), I think we should instead change this to something where the script just spits out appropriate sops encrypted files as enc-<hub-name>.secret.values.yaml file (just using the CILogon authenticator), which we can just check-in. This also simplifies the deployer (once we can get rid of auth0 at least), and enhances right to replicate.

So we could have something like a new-hub script or cookie-cutter that talks to the CILogon API, generates the appropriate secrets and puts it in place. I think the code for this already exists here.

Once we move off auth0 completely, we can just get rid of the dynamic auth part of the deployer completely.

@GeorgianaElena GeorgianaElena marked this pull request as draft March 17, 2022 16:21
@GeorgianaElena
Copy link
Member Author

GeorgianaElena commented Mar 17, 2022

Thanks for the feedback @yuvipanda. I just pushed some changes with the cilogon client provider turned into a script.
It's not ready, but I would appreciate an early feedback so that I don't get into another rabbit hole.

Also, weird thing, I just got a 500 error with a message saying that the cilogon credentials I was trying to use don't have an "admin" role. @choldgraf do you mind asking the CILogon folks if they've revoked our admin credentials? I'm afraid they think we've abused their system since I've created quite a few dummy clients while testing the implementation 😕

requests.exceptions.JSONDecodeError: [Errno Expecting value] error="server_error"
error_description="Error%3A+the+given+id+of+%22cilogon%3A%2Fclient_id%<encrypted-client-id>+is+not+recognized+as+an+admin+client."
: 0

@choldgraf
Copy link
Member

@GeorgianaElena will send them an email today!

@GeorgianaElena
Copy link
Member Author

Thanks a lot @choldgraf 🌼

@yuvipanda
Copy link
Member

@GeorgianaElena i haven't done a deep dive into the code but overall this seems the right direction to me!

@GeorgianaElena
Copy link
Member Author

GeorgianaElena commented Mar 23, 2022

@2i2c-org/tech-team, this should be now ready for a new review 👀 or a merge

@yuvipanda
Copy link
Member

@GeorgianaElena i've left some suggested changes in GeorgianaElena#2! I'm going to now test deploying this on the demo hub.

@yuvipanda
Copy link
Member

GeorgianaElena#3 is me trying to deploy this to the demo hub, but ran into problems :( I've detailed them in the PR. I think if we can resolve this, this is good to go.

This is such a huge step forward, thank you for working on this @GeorgianaElena!

@yuvipanda
Copy link
Member

The test failure is a link to a file introduced in this PR, so is alright to let fail.

yuvipanda and others added 3 commits March 24, 2022 15:09
Co-authored-by: Georgiana Elena <[email protected]>
Move demo hub to use cilogon directly
Continue to rely on username_pattern right now as we
figure out how to use IDPs
Copy link
Member

@yuvipanda yuvipanda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GeorgianaElena this is super awesome, am very excited to get this to land!

  1. Remove allowed_idps for demo hub GeorgianaElena/pilot-hubs#4 keeps status quo for demo hub, and we can figure out what to do with IDPs
  2. Remove CILogonOAuthenticator default scopes GeorgianaElena/pilot-hubs#5 removes some extra config
  3. Can you update the PR description here too?

I think you can merge after these two are done.

@GeorgianaElena
Copy link
Member Author

Merging this now! THANK YOU! 🚀

@GeorgianaElena GeorgianaElena merged commit dc43c6e into 2i2c-org:master Mar 25, 2022
@choldgraf
Copy link
Member

YayYesGIF (2)

@GeorgianaElena GeorgianaElena deleted the cilogon-admin branch March 28, 2022 10:28
@damianavila
Copy link
Contributor

Lovely piece of work, @GeorgianaElena!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants