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

Add ssh_host_key router #8295

Merged
merged 1 commit into from
Feb 21, 2022
Merged

Add ssh_host_key router #8295

merged 1 commit into from
Feb 21, 2022

Conversation

iQQBot
Copy link
Contributor

@iQQBot iQQBot commented Feb 18, 2022

Description

This PR add a router for ssh_host_key, router URL is workspaceURL/_ssh/host_keys it will show all hostkeys

Related Issue(s)

Relate #8296

How to test

  1. Open a workspace
  2. Use curl workspaceURL/_ssh/host_keys to test, it will contain all available public hostkey and type

Release Notes

NONE

Documentation

@codecov
Copy link

codecov bot commented Feb 18, 2022

Codecov Report

Merging #8295 (ae5f486) into main (6497329) will decrease coverage by 2.20%.
The diff coverage is 86.20%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #8295      +/-   ##
==========================================
- Coverage   31.23%   29.02%   -2.21%     
==========================================
  Files          39       39              
  Lines        5910     3335    -2575     
==========================================
- Hits         1846      968     -878     
+ Misses       3923     2313    -1610     
+ Partials      141       54      -87     
Flag Coverage Δ
components-gitpod-cli-app 11.17% <ø> (ø)
components-installer-raw-app 5.62% <ø> (?)
components-local-app-app-darwin-amd64 ?
components-local-app-app-darwin-arm64 ?
components-local-app-app-linux-amd64 ?
components-local-app-app-linux-arm64 ?
components-local-app-app-windows-386 ?
components-local-app-app-windows-amd64 ?
components-local-app-app-windows-arm64 ?
components-supervisor-app ?
components-ws-proxy-app 68.63% <86.20%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
components/ws-proxy/pkg/proxy/routes.go 82.97% <84.61%> (ø)
components/ws-proxy/pkg/proxy/proxy.go 24.65% <100.00%> (ø)
components/supervisor/pkg/terminal/service.go
components/supervisor/pkg/ports/ports-config.go
components/supervisor/pkg/terminal/ring-buffer.go
components/supervisor/pkg/supervisor/tasks.go
components/supervisor/pkg/ports/slirp4netns.go
components/local-app/pkg/auth/pkce.go
...mponents/supervisor/pkg/supervisor/notification.go
components/supervisor/pkg/ports/served-ports.go
... and 34 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6497329...ae5f486. Read the comment docs.

@iQQBot iQQBot force-pushed the pd/ssh-hostkey branch 2 times, most recently from d9a962e to 1befbf3 Compare February 18, 2022 03:38
@iQQBot iQQBot marked this pull request as ready for review February 18, 2022 03:40
@iQQBot iQQBot requested a review from a team February 18, 2022 03:40
@github-actions github-actions bot added the team: workspace Issue belongs to the Workspace team label Feb 18, 2022
@princerachit
Copy link
Contributor

Hi, Do you have any associated issue for this PR to get more context on the changes?

@iQQBot
Copy link
Contributor Author

iQQBot commented Feb 18, 2022

@princerachit just created one #8296
this is the first part of this issue, the second part is add API to Gateway plugin

@iQQBot
Copy link
Contributor Author

iQQBot commented Feb 18, 2022

@princerachit see internal thread

components/ws-proxy/pkg/proxy/routes.go Outdated Show resolved Hide resolved
components/ws-proxy/pkg/proxy/routes.go Outdated Show resolved Hide resolved
r.Use(logHandler)

// Note: the order of routes defines their priority.
// Routes registered first have priority over those that come afterwards.
routes := newIDERoutes(config, ip)

// if host key is not empty, we use /__ws_proxy/ssh_host_key to provider public host key
if len(hostKeyList) > 0 {
routes.HandleSSHHostKeyRoute(r.Path("/__ws_proxy/ssh_host_key"), hostKeyList)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to introduce more component specific routes? Considering this is essentially API, what other cases for ws-proxy provided values do we see?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Want to get a wsProxyRouter like iderouter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I observed that other routers have specific domain rules, and we just want to put it under ideDomain

Copy link
Member

Choose a reason for hiding this comment

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

@csweichel Do you mean to match path for __ws_proxy and have subroute for it?

Copy link
Contributor

Choose a reason for hiding this comment

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

I meant not tying it to ws-proxy, e.g. calling it __ssh or something like that. Just so that if we ever move this functionality elsewhere, we're not left with a misnomer we can't move away from.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

Copy link
Contributor Author

Choose a reason for hiding this comment

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

why does this path use two _ ?

Copy link
Member

Choose a reason for hiding this comment

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

Let's go with one :) I thought we are using two for supervisor, but it is one there as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed

Copy link
Member

Choose a reason for hiding this comment

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

@csweichel Could you have a look again please? 🙏

@akosyakov
Copy link
Member

I verified that it works with JB plugin hooks. @csweichel @kylos101 good to merge and deploy?

@akosyakov
Copy link
Member

Here is a PR for GW plugin: #8317 to auto validate host keys based on changes on this PR.

Copy link
Contributor

@csweichel csweichel left a comment

Choose a reason for hiding this comment

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

works as advertised

}
byt, err := json.Marshal(shk)
if err != nil {
log.WithError(err).Error("ssh_host_key router setup failed")
Copy link
Contributor

Choose a reason for hiding this comment

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

this would produce a subtle failure mode: we'd get this error message once, but SSH access would be broken.

Not a reason not to merge, but maybe a follow up. Instead of just logging, we could bubble up the error and exit.

@roboquat roboquat merged commit 8fa98f9 into main Feb 21, 2022
@roboquat roboquat deleted the pd/ssh-hostkey branch February 21, 2022 11:13
@roboquat roboquat added deployed: workspace Workspace team change is running in production deployed Change is completely running in production labels Feb 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployed: workspace Workspace team change is running in production deployed Change is completely running in production release-note-none size/L team: IDE team: workspace Issue belongs to the Workspace team
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

6 participants