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

x/build/cmd/gomote: add ssh access to builders #19956

Closed
bradfitz opened this issue Apr 13, 2017 · 6 comments
Closed

x/build/cmd/gomote: add ssh access to builders #19956

bradfitz opened this issue Apr 13, 2017 · 6 comments
Labels
Builders x/build issues (builders, bots, dashboards) FrozenDueToAge help wanted
Milestone

Comments

@bradfitz
Copy link
Contributor

People have long been requesting ssh access to gomote-creatable builders.

The idea being it'd be something like:

you@laptop$ gomote create <instance-type>
user-bradfitz-inst-type0
you@laptop$ gomote ssh user-bradfitz-inst-type0

And then you're in bash or whatever (let's ignore Windows and Plan 9 for version 1):

gopher@user-bradfitz-inst-type0$ 

Architecturally, the connections would be like:

    [ Client ]  <-----> [ farmer.golang.org ] <-----> [ ephemeral buildlets ]

We'd modify the x/build/cmd/buildlet code to have auth-less ssh support (they're network-isolated), and then modify the x/build/cmd/coordinator (farmer.golang.org) to have an ssh server (well, an additional one on a different port) that did the authentication and proxied to the buildlet's ssh.

I haven't used the x/crypto/ssh package much. I imagine on the buildlet it needs to create a pty (?) or something and run bash.

On the coordinator side, I'm not exactly sure what I need to do in that ssh server after authenticating the client. I'm only vaguely aware of the ssh protocol. At some level I proxy it to the buildlet.

Help wanted. What I'd love to see is:

  1. Go ssh server on localhost:2200 that has no auth and drops into bash.
  2. Go ssh server on localhost:2201 with auth, proxying to the localhost:2200 ssh server.

(no openssh server; just Go is most deployable in our current environments where we can update the buildlet binaries quickly but the OS images are often more baked)

Alternative I considered: only one ssh server (on the buildlet) with a random password, and have the coordinator only be a TCP proxy. But then I'd still know how to route incoming TCP connections to different backends, implying some protocol there anyway, and I think it can just be ssh.

/cc @hanwen @aclements @ianlancetaylor

@bradfitz bradfitz added Builders x/build issues (builders, bots, dashboards) help wanted labels Apr 13, 2017
@bradfitz bradfitz added this to the Unreleased milestone Apr 13, 2017
@hanwen
Copy link
Contributor

hanwen commented Apr 13, 2017

there is no standard SSH server in crypto/ssh, because it would have to interact with all the nasty platform bits (process control, ptys, etc.)

I think the fastest solution would be: run openssh on the buildlet (configure it for authless login), and use the coordinator as proxy at the channel level: the proxy passes on all OpenChannel requests. The x/cprypto/ssh/test show how you can start opensshd (but you'll probbably want to run it in daemon mode).

The proxying takes the input from NewClientConn and passes it into the NewServerConn output and vice versa.

@bradfitz
Copy link
Contributor Author

@hanwen, if I wanted to take advantage of the machines' existing ssh servers, could I do that?

Can the OpenChannel dialer do the ssh client auth (mix of fixed passwords & keys), establish the channel, and then stitch them together?

@hanwen
Copy link
Contributor

hanwen commented Apr 14, 2017

Yes, that should work.

I would avoid passwords if you can. Public keys are easier to manage: you have to protect the secret in just one place, and they're immune to MITM attacks.

@bradfitz
Copy link
Contributor Author

A lot of our build VM images have fixed passwords. e.g. gopher/gopher:

https://github.com/golang/build/blob/9412838986dd9e33dcc936f994012a6941c55bbf/env/openbsd-amd64/make.bash#L99

We're not exactly secret about those. They're one-off VMs and run on isolated networks.

But good to hear using the existing ssh server should work. I'll play.

@gopherbot
Copy link

CL https://golang.org/cl/50750 mentions this issue.

@gopherbot
Copy link

CL https://golang.org/cl/50890 mentions this issue.

gopherbot pushed a commit to golang/build that referenced this issue Jul 24, 2017
In the Plan 9 image, we remove "exec rio" from lib/profile,
so users without graphical interface support will be able
to connect to the Plan 9 instance.

Updates golang/go#19956

Change-Id: I64b220d7e8a322b2d8b3a78dfd7773a95cc54f5b
Reviewed-on: https://go-review.googlesource.com/50890
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
@golang golang locked and limited conversation to collaborators Jul 28, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Builders x/build issues (builders, bots, dashboards) FrozenDueToAge help wanted
Projects
None yet
Development

No branches or pull requests

3 participants