earthlab / hub-ops

Infrastructure and operations for the Earth Lab JupyterHub
https://earthlab-hub-ops.readthedocs.io/en/latest/
4 stars 8 forks source link

revoke user tokens at end of class #320

Open kcranston opened 3 years ago

kcranston commented 3 years ago

tl;dr

At the end of a class, we should ensure that students no longer have access to the hub:

Long version

Authentication to the hub is managed by a GitHub App for each hub. Adding a github username to the hubname.yaml file (under auth.admin.users or auth.whitelist.users) allows that user to authenticate. Removing a username from that file does not revoke access, though, because they still have a valid authentication token via the GitHub App. So, at the end of each class, we should edit the yaml file and also revoke all user tokens. You can do this through the Settings for the EarthLab organization: under Developer Settings, select the App and clicking the Revoke all user tokens button.

This also needs to be added to the docs about removing hubs.

lwasser commented 3 years ago

oh! so is our login protocol different now? or it's still github but i add users in a different yaml file than before? it sounds like it's different because previously i could just remove them from the list and within a few days they'd lose access. this reminds me i will shut down the ea hub this morning

lwasser commented 3 years ago

@kcranston ok i think i need a run through of how this works. does the authentication list in the yaml file no longer work?

kcranston commented 3 years ago

From what I understand, the authentication process has multiple steps, which go something like this:

So, if a user already has an authentication token, the whitelist is not checked. If you remove a user from the whitelist, they may still be able to log in if they have an unexpired token (and I do not know how long before tokens expire). This happened in the fall, when I reinstated a hub and @nkorinek was able to log in without being on the whitelist!

lwasser commented 3 years ago

ok so for the ea-hub i did remove a few users from the whitelist. do i then need to remove their tokens?

lwasser commented 3 years ago

oh wait . this is what i have to revoke all tokens is that right? i think i remember this conversation. so if i revoke all tokens then the users on the whitelist can still get onto the hub. is that correct?