- Notifications
You must be signed in to change notification settings - Fork928
fix(agent/agentssh): allow remote forwarding a socket multiple times#11631
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
5ce1baf
to96c0724
Compare96c0724
todab6034
CompareUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
// Ensure the SSH connection is ready by testing the shell | ||
// input/output. | ||
pty.WriteLine("echo ping' 'pong") | ||
pty.ExpectMatchContext(ctx, "ping pong") |
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.
using the CLI to test the agent is awkward and this is an example. This test would be easier to write and easier to understand if were inagent_test.go
and we could use the go ssh client.
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 do somewhat agree, but I'm not sureagent_test.go
is a much better place since the actual forwarding is implemented here, incli/remoteforward.go
. This test should ensure that the behavior we want works with the actualcoder ssh
client.
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 already have tests forcoder ssh
in terms of making a unix socket remote forward and verifying it works. None of that behavior is changing in this PR.
What's changing is on the agent side of the connection. And it's not justcoder ssh
that talks to that SSH server: it could be OpenSSH or JetBrains Gateway or VSCode (viacoder ssh --stdio
), or even a custom SSH client written in go usingcodersdk
. Therefore, we need to think about the required behavior in terms of what the SSH server is supposed to do, not just end-to-end with a specific client.
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.
Yeah, I'm not opposed tbh. I think the best place for most of this testing is within theagentssh
package itself. I'll create an issue for this since if we go this route, there's some other restructuring that needs to be done as well. Like moving the forwarding logic fromcli
toagentssh
, etc. Otherwise I think we'll end up with "many implementations of an SSH client".
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.
Uh oh!
There was an error while loading.Please reload this page.
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.
One thing to fixup; but I don't need to review again.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Fixes#11198
Fixeshttps://github.com/coder/customers/issues/407
For this PR, I implemented a new test in
cli/ssh_test.go
, however, in future, we should consider doing more extensive testing for forwarding within theagent/agentssh
package.