Setup client proxy command in GitLab CLI to handle KAS connection forwarding
MR: Pending
Description
As part of our plan to proxy SSH traffic from the user's machine to a workspace, we would need to set up a glab CLI command ( something along the lines of glab workspaces-ssh proxy) that will accept SSH traffic from stdin and wrap it in the appropriate proto message to be sent via KAS and proxying KAS responses back. This command would be called when the user attempts to SSH into any GitLab workspace as a side effect of the configuration command the user calls to set up their ~/.ssh/config, see Setup GitLab CLI to modify client SSH config (#7967)
Building this into glab gives us the benefit of not needing users to set up any extra dependency except glab itself, but we expect power users to already be leveraging the CLI ( and if they are not integrating workspace SSH this way boosts CLI adoption!)
Acceptance criteria
-
glab workspaces-ssh proxycommand proxies SSH traffic to KAS and back
Implementation plan
- Fetch the relevant configuration needed to establish the gRPC connection to KAS ( I think we should get this via an endpoint somehow
) - Include the protobuf schema that will be exported by the agent repo into the CLI repo
- Extract the OAuth token CLI uses and include it in the outgoing RPC connection metadata (Note the user might not have set up CLI access via OAuth, so we might need to force that flow as a prerequisite)
- Initialize a client Connection to KAS that will start a bidirectional streamer between the CLI and KAS
- Implement concurrent code that will forward stream from
stdinto KAS and from KAS back