-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
RFD 0178: GitHub proxy #44527
base: master
Are you sure you want to change the base?
RFD 0178: GitHub proxy #44527
Conversation
754a830
to
e584b61
Compare
6bd61fe
to
62b8ace
Compare
62b8ace
to
fe9cccf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First quick pass.
rfd/0178-github-proxy.md
Outdated
#### RBAC on GitHub proxy server | ||
|
||
Existing RBAC for a SSH node is used. Teleport users that require the GitHub | ||
proxy should be granted through existing `node_labels` (or | ||
`node_labels_expression`) that match the GitHub proxy server. And GitHub | ||
usernames are specified in existing `logins`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a thought:
The GitHub organization node allows access to repositories with built-in permissions.
I wonder if there is a way to delegate permission management for GitHub via Teleport's RBAC model and enforce RBAC checks at the protocol level.
For instance, using an RBAC role to define the repositories and operations a user is allowed to perform, and enforcing this at the GitHub protocol level so if we can audit GH action we can model the GH RBAC in teleport.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For instance, using an RBAC role to define the repositories and operations a user is allowed to perform, and enforcing this at the GitHub protocol level so if we can audit GH action we can model the GH RBAC in teleport.
I think the repo and action (fetch vs push) are the only ones we can control.
Like you said in other comments, today we are relying on the Organization that has existing GitHub users. Users can still perform actions through Web UI.
|
||
## Details | ||
|
||
### UX - User stories |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now, the GitHub Proxy seems to be a good fit for automation flows like CI, but missing support for GitHub web UI access will be a blocker for day-to-day user workflows. Alternatively, we could rely on two access models, such as GitHub SSO and Teleport GitHub Proxy, but this raises the question: why use the GitHub Proxy when a user already has access to GitHub via SSO?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RBAC should be controlled with GitHub IAM integrartion. The proxy is more like an addon to it. As mentioned in the stories, the benefit using the GitHub Proxy include per-session MFA, audit log (e.g. generating reporting using Access Monitoring). I can certainly add specific stories for those like I want to generate an audit report that xxx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that role spec and internal representation of Github's "server" need a bit more work. Reusing part of SSH implementation since git is essentially SSH protocol is one thing but from the UX and configuration perspective it is very confusing that it relies on access controls designed for SSH nodes, feels like leaking implementation details.
It would also be helpful to see an end-to-end MVP in action that showcases your user scenarios e.g. a demo where:
- An admin goes to Integrations tab and sets up Github integration.
- A user logs into Teleport and uses git to interact with the repository.
rfd/0178-github-proxy.md
Outdated
labels: | ||
"github-organization": "my-org" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this both in the labels and in the spec?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is for RBAC. it will be a lot better to switch to repo-specific RBAC! will update!
rfd/0178-github-proxy.md
Outdated
logins: | ||
- {{external.github_usernames}} | ||
node_labels: | ||
"github-organization": "my-org" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is fairly confusing to use node_labels and logins for Github access. I understand we're relying on a lot of SSH implementation under the hood but from user's perspective this is very confusing.
First of all - why do we need "logins"? There will never be a list here as each user will have a single Github username in 99% of cases, can we just take it directly from the user's traits?
For the labels - instead of using node labels can we piggy-back on the role spec proposed in Github IAM RFD and extend the repo_permissions section with something like this:
spec:
allow:
repo_permissions:
- orgs:
- goteleport
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I am overthinking this. How do we plan to differentiate between different types of Git hostings? For example, both GitHub and GitLab can have organizations.
For the proxying purpose, what do you think something like this?
spec:
allow:
github_organizations:
- my-org
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can just call it github_permissions
rather than generic repo_permissions
I think. So:
allow:
github_permissions:
orgs:
- gravitational
repos:
- teleport
- teleport.e
roles:
- push
rfd/0178-github-proxy.md
Outdated
kind: node | ||
sub_kind: openssh-github |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will increase the amount of work we need to do to treat these node resources specially. If we use node
resource, we'll probably have to take a special care then to filter it out from things like "tsh ls" and web UI listing of nodes, etc. Can we use a different resource type instead? cc @rosstimothy @espadolini
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it will be more work to make existing transport take another resource kind (but still types.Server
) but i agree it's cleaner that way. Let me look into that.
rfd/0178-github-proxy.md
Outdated
#### Recordings and events | ||
|
||
Regular SSH recordings for the GitHub proxy server will be disabled. "Git | ||
Command" events will replace the "Command Executation" events: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Command" events will replace the "Command Executation" events: | |
Command" events will replace the "Command Execution" events: |
b4299f3
to
7683258
Compare
7683258
to
ca39ade
Compare
13657ca
to
01d410d
Compare
01d410d
to
2031c76
Compare
Hi team! I completed the review of the RDF. The concerns outlined in the "Security" section are valid. Both suggested alternatives would help prevent potential account impersonation, and the listed trade-offs are accurate. I have, however, a questions regarding the "Alternative 2" proposal. Have you looked into the From my limited testing, changing an account's username does not have impact its ID. Given that, a variant of the "Alternative 2" flow might be:
Once the GitHub account ID is stored, the OAuth flow should no longer be required. This should help smooth out the UX and reduce the number of times the user needs to perform the OAuth flow. If the user wishes to use another GitHub account later on, the ID can be overwritten by requiring the user to go through the above flow once more. Let me know what are your thoughts on this. |
rfd/0178-github-proxy.md
Outdated
|
||
<img src="./assets/0178-enroll-step3.png" width="600" /> | ||
|
||
3. Next Alice creates a Git server resource and a Teleport role for Teleport |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is too low-level for the enrollment flow, we should just create this server resource internally automatically.
The first `git` command (including the `clone`) will open a browser window to | ||
trigger the GitHub OAuth flow for Teleport to grab Bob's GitHub ID and | ||
username. Once Bob sees "Login Successful" from the brower and goes back to his | ||
terminal. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would the flow be in a non-interactive/headless scenario? I.e. if you want to do this from a development box where there is no browser.
To be more specific, the current GitHub SSO flow initiates an unauthenticated | ||
HTTP call to Teleport to create a GitHub auth request. Once the Auth service | ||
verifies the GitHub callback, it creates a new user associated with a GitHub | ||
connector. | ||
|
||
In contrast, the new flow uses an authenticated gRPC call to Teleport to create | ||
the GitHub auth request. Once the Auth service verifies the GitHub callback, it | ||
attaches the GitHub identity information directly to the authenticated user who | ||
initiated the request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To follow up on my question above, sounds like this should work for scenarios where you do tsh login
from a development box and not your laptop as well, correct? Have you tested this scenario? Can we give them a link to click instead of opening the browser?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed in person, one mitigation we decided to do is to preserve github identity info so user only needs to do OAuth flow once on their laptop.
I found today user login state is refreshed upon new user login. I have updated the refresh logic to preserve the github identity info during refresh so that another login wouldn't void the GitHub OAuth flow. We might need a way to properly void the GitHub identity saved though. I might add a tctl call later or adjust tsh git login
.
The other alternative is port-forwarding. For example, from user's laptop:
(local)$ tsh ssh -L 8080:localhost:8080 bob@remote-box
(remote)$ tsh login xxxx
(remote)$ tsh git login --github-org my-org --callback-addr localhost:8080
Then bob
can open the URL on his laptop's browser to finish the flow.
I will update the RFD to reflect this.
rfd/0178-github-proxy.md
Outdated
In the design described above, GitHub usernames are provided through an user | ||
trait. For local users, only Teleport "admins" can set the traits as modifying | ||
users is considered an admin action. For external users, only "admins" of the | ||
external identity provider, say an Okta admin, can configure the values of the | ||
traits. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is no longer true so probably should be removed or marked as discarded design.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm once you've made the changes we discussed in the latest feedback round
rendered: https://github.com/gravitational/teleport/blob/rfd/0178-github-proxy/rfd/0178-github-proxy.md
poc branch https://github.com/gravitational/teleport/tree/STeve/proxy_github_v5