Skip to content

Use the proxy transport for tsh proxy ssh#34396

Merged
espadolini merged 4 commits intomasterfrom
espadolini/tsh-proxy-ssh-grpc
Dec 7, 2023
Merged

Use the proxy transport for tsh proxy ssh#34396
espadolini merged 4 commits intomasterfrom
espadolini/tsh-proxy-ssh-grpc

Conversation

@espadolini
Copy link
Copy Markdown
Contributor

@espadolini espadolini commented Nov 9, 2023

This PR changes the transport used by tsh proxy ssh from the "proxySubsys" mechanism that uses the Teleport Proxy SSH listener to the gRPC teleport.transport.v1.TransportService/ProxySSH endpoint that's already exclusively used by tsh ssh since Teleport v14.

@espadolini espadolini added the no-changelog Indicates that a PR does not require a changelog entry label Nov 9, 2023
@espadolini espadolini force-pushed the espadolini/tsh-proxy-ssh-grpc branch from b8eeec1 to 1c5d3c8 Compare November 9, 2023 18:59
@espadolini espadolini force-pushed the espadolini/tsh-proxy-ssh-grpc branch 2 times, most recently from 9911e8b to e519728 Compare November 20, 2023 18:08
@espadolini espadolini force-pushed the espadolini/tsh-proxy-ssh-grpc branch from 749a4d9 to 4943885 Compare November 21, 2023 13:54
@espadolini espadolini marked this pull request as ready for review November 21, 2023 14:08
@github-actions github-actions Bot added size/sm tsh tsh - Teleport's command line tool for logging into nodes running Teleport. labels Nov 21, 2023
@github-actions github-actions Bot requested review from tcsc and zmb3 November 21, 2023 14:09
@espadolini espadolini requested review from Joerger and rosstimothy and removed request for zmb3 November 21, 2023 14:09
Copy link
Copy Markdown
Contributor

@rosstimothy rosstimothy left a comment

Choose a reason for hiding this comment

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

+52 −269 🎉

Comment thread lib/srv/transport/transportv1/transport.go
Copy link
Copy Markdown
Contributor

@Joerger Joerger left a comment

Choose a reason for hiding this comment

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

LGTM. Only issue I found is that running tsh proxy ssh directly, ctrl+C does not exit, though the ssh connection does still close.

Comment thread tool/tsh/common/proxy.go Outdated
Comment on lines +77 to +94
errC := make(chan error, 2)
go func() {
_, err := io.Copy(os.Stdout, conn)
if err != nil && utils.IsOKNetworkError(err) {
err = nil
}
errC <- err
}()
go func() {
_, err := io.Copy(conn, os.Stdin)
if err != nil && utils.IsOKNetworkError(err) {
err = nil
}
errC <- err
}()

return &sshProxyParams{
proxyHost: sshProxyHost,
proxyPort: sshProxyPort,
clusterName: ping.ClusterName,
tlsRouting: ping.Proxy.TLSRoutingEnabled,
}, nil
return trace.NewAggregate(<-errC, <-errC)
}))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we use utils.ProxyConn here? That has support for terminating on context cancellation which I think would prevent the CTRL+C issue mentioned by @Joerger.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in b8cfcb5

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

(and yes, it does indeed close on ^C now)

@espadolini espadolini requested a review from Joerger December 6, 2023 19:27
@public-teleport-github-review-bot public-teleport-github-review-bot Bot removed the request for review from tcsc December 7, 2023 01:39
@espadolini espadolini added this pull request to the merge queue Dec 7, 2023
Merged via the queue into master with commit 39af8d3 Dec 7, 2023
@espadolini espadolini deleted the espadolini/tsh-proxy-ssh-grpc branch December 7, 2023 09:49
@public-teleport-github-review-bot
Copy link
Copy Markdown

@espadolini See the table below for backport results.

Branch Result
branch/v13 Failed
branch/v14 Create PR

espadolini added a commit that referenced this pull request Dec 7, 2023
* Use the proxy transport for tsh proxy ssh

* Exit cleanly from TransportService/ProxySSH

* Use utils.ProxyConn
espadolini added a commit that referenced this pull request Feb 2, 2024
* Use the proxy transport for tsh proxy ssh

* Exit cleanly from TransportService/ProxySSH

* Use utils.ProxyConn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog Indicates that a PR does not require a changelog entry size/sm tsh tsh - Teleport's command line tool for logging into nodes running Teleport.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants