Skip to content

Use the standard GetConfigForClient in sshGRPCServer#37093

Merged
espadolini merged 4 commits intomasterfrom
espadolini/sshgrpc-clustercas
Jan 25, 2024
Merged

Use the standard GetConfigForClient in sshGRPCServer#37093
espadolini merged 4 commits intomasterfrom
espadolini/sshgrpc-clustercas

Conversation

@espadolini
Copy link
Copy Markdown
Contributor

@espadolini espadolini commented Jan 23, 2024

The "SSH gRPC" service currently only trusts the host and user CAs for the local cluster; it should, however, since it's necessary for the tsh ProxyJump functionality (tsh ssh -J addr-of-leaf-proxy user@host ...). This PR changes the TLS config for the service to use the same GetConfigForClient used by most other servers, which will load user CAs on demand.

The changes to the test make it fail without the fix (in the "ssh jump host access" subtest) and succeed with; however, this PR introduces some minor go:debug hackery (in test code) to extend the system cert pool.
Fixes #36964

changelog: Fixed incompatibility between leaf clusters and ProxyJump

@espadolini espadolini force-pushed the espadolini/sshgrpc-clustercas branch 2 times, most recently from 4f5f4bd to 509151b Compare January 24, 2024 20:33
@espadolini espadolini force-pushed the espadolini/sshgrpc-clustercas branch from 509151b to 4cfb69e Compare January 24, 2024 21:24
@espadolini espadolini marked this pull request as ready for review January 24, 2024 21:43
@github-actions github-actions Bot added size/sm tsh tsh - Teleport's command line tool for logging into nodes running Teleport. labels Jan 24, 2024
Copy link
Copy Markdown
Collaborator

@zmb3 zmb3 left a comment

Choose a reason for hiding this comment

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

I'm on the fence about the testing changes. They seem both complicated and brittle.

In this case I would be okay with merging without the tests since you've demonstrated already that the fix is good.

Comment thread integration/helpers/x509.go Outdated
)

//go:linkname x509_systemRootsMu crypto/x509.systemRootsMu
//go:linkname x509_systemRoots crypto/x509.systemRoots
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we at least do this in a _test.go file to be sure it doesn't ever affect a production build?

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.

The issue with that is that other packages' test files don't exist when building tests.

Should I move this back to tools/tsh/common/proxy_test.go for now?

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.

I figured out that with //go:debug x509usefallbackroots=1 (which is far more supported) we get to replace the system cert pool without using linkname hacks or changing all the test running environments to add the matching GODEBUG envvar (b986a46)

@kimlisa kimlisa removed their request for review January 25, 2024 18:21
@espadolini espadolini requested a review from zmb3 January 25, 2024 19:31
@zmb3
Copy link
Copy Markdown
Collaborator

zmb3 commented Jan 25, 2024

/excludeflake *

@espadolini espadolini added this pull request to the merge queue Jan 25, 2024
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jan 25, 2024
@espadolini espadolini added this pull request to the merge queue Jan 25, 2024
Merged via the queue into master with commit 729edec Jan 25, 2024
@espadolini espadolini deleted the espadolini/sshgrpc-clustercas branch January 25, 2024 22:21
@public-teleport-github-review-bot
Copy link
Copy Markdown

@espadolini See the table below for backport results.

Branch Result
branch/v14 Failed
branch/v15 Create PR

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

Labels

size/md 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.

Jump host fails with unknown certificate authority

3 participants