Skip to content

Adjust diagnostic messages of connection test for Connect My Computer#35308

Merged
ravicious merged 15 commits intomasterfrom
ravicious/cmc-conn-test
Dec 12, 2023
Merged

Adjust diagnostic messages of connection test for Connect My Computer#35308
ravicious merged 15 commits intomasterfrom
ravicious/cmc-conn-test

Conversation

@ravicious
Copy link
Copy Markdown
Member

@ravicious ravicious commented Dec 4, 2023

Closes #32206, closes #32185.

The messages had to be adjusted in two places:

  • lib/srv/authhandlers.go – this is on the side of the server agent. Here we use the fact that h.c.Server.GetInfo() returns types.Server, so to detect a Connect My Computer node we can check if the node has types.ConnectMyComputerNodeOwnerLabel in its labels.
  • lib/client/conntest/ssh.go – this is on the side of the proxy and the request to perform a connection diagnostic. We don't have access to info about the target (unless we explicitly fetch it). But at the time of making the request, we know that we're inside the Connect My Computer flow, so we pass another argument through TestConnectionRequest.

I also included a couple of UI improvements, each one is in its own separate commit.

Details hidden Details shown
conntest-no-details conntest-details

Changelog: Added a connection test when enrolling a new Connect My Computer resource in Web UI

Comment thread lib/client/conntest/connection_tester.go Outdated
Comment thread lib/client/conntest/ssh.go Outdated
Comment on lines 273 to 279
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I feel like this could be considered controversial but I think it should be fine? Unless we want to explicitly include another field in the trace for those longer messages that would be shown in "Show details" along with the actual error.

@ravicious ravicious marked this pull request as ready for review December 4, 2023 09:40
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 4, 2023

The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with changelog: followed by the changelog entries for the PR.

@github-actions github-actions Bot requested review from rudream and ryanclark December 4, 2023 09:41
@ravicious ravicious changed the title Add Discover connection test for Connect My Computer Adjust diagnostic messages of connection test for Connect My Computer Dec 4, 2023
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 4, 2023

The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with changelog: followed by the changelog entries for the PR.

2 similar comments
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 4, 2023

The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with changelog: followed by the changelog entries for the PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 4, 2023

The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with changelog: followed by the changelog entries for the PR.

Comment thread lib/client/conntest/connection_tester.go Outdated
Comment thread lib/client/conntest/ssh.go Outdated
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.

idk if i'm just brain farting or is a dumb question... but what about non-linux login? same with systemctl, what about mac equivalent launctl? i know it was here before, and was just curious

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It doesn't look like this was handled. I think we could add yet another field to TestConnectionRequest which describes the platform used to differentiate between systemctl/launchctl. In this specific line we can just drop "Linux" from the message and say "system" or "OS" I suppose.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'll push a commit tomorrow which addresses this.

Comment thread lib/client/conntest/ssh.go Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 6, 2023

The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with changelog: followed by the changelog entries for the PR.

@ravicious ravicious force-pushed the ravicious/cmc-conn-test branch from 606cc64 to 41ec232 Compare December 7, 2023 10:36
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 7, 2023

The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with changelog: followed by the changelog entries for the PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 7, 2023

The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with changelog: followed by the changelog entries for the PR.

@ravicious
Copy link
Copy Markdown
Member Author

@kimlisa Ping.

Comment thread lib/client/conntest/connection_tester.go
@ravicious
Copy link
Copy Markdown
Member Author

The failing test made me realize that SSHConnectionTester does have tests. I added some for the behavior specific to Connect My Computer.

I didn't add any for the behavior expressed in lib/srv/authhandlers.go. Testing those would require refactoring webPack to support launching a node with a specific set of static labels. newWebPack already accepts opts ...proxyOption and I couldn't figure out an easy way to make it support lib/srv/regular.ServerOption so that we can use lib/srv/regular.SetLabels.

In CI, it looks like we can absolutely spawn a new session as root, so
the test is meaningless there.

Instead, I'm going to add authhandlers tests and this test to the Connect
My Computer test plan.
@ravicious ravicious added this pull request to the merge queue Dec 12, 2023
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Dec 12, 2023
@ravicious ravicious added this pull request to the merge queue Dec 12, 2023
Merged via the queue into master with commit f17ace0 Dec 12, 2023
@ravicious ravicious deleted the ravicious/cmc-conn-test branch December 12, 2023 11:45
@public-teleport-github-review-bot
Copy link
Copy Markdown

@ravicious See the table below for backport results.

Branch Result
branch/v14 Failed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement connection test for Connect My Computer node Discover tile for Connect My Computer

3 participants