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

Use serverUID for web scp target #23124

Merged
merged 7 commits into from Mar 15, 2023
Merged

Conversation

avatus
Copy link
Contributor

@avatus avatus commented Mar 15, 2023

Fixes #22507

To fix this, I pass the unique server id present in the http request rather than a node name. A similar fix for Connect exists here

Revert unneeded hostname change

Remove comment

Get name
@avatus
Copy link
Contributor Author

avatus commented Mar 15, 2023

Changing the TeleportClient.ExecuteSCP signature wasn't my first option but then I realized it's only referenced in these two places (files.upload and files.download) so it was the simplest approach

lib/web/files.go Outdated
@@ -106,7 +106,7 @@ func (f *fileTransfer) download(req fileTransferRequest, httpReq *http.Request,
return trace.Wrap(err)
}

err = tc.ExecuteSCP(httpReq.Context(), cmd)
err = tc.ExecuteSCP(httpReq.Context(), req.server, cmd)
Copy link
Contributor

Choose a reason for hiding this comment

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

if not too much trouble, can we rename server to serverID?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No trouble at all! Fixed. much more clear this way.

nodeClient, err := tc.ConnectToNode(
ctx,
proxyClient,
NodeDetails{Addr: nodeAddrs[0], Namespace: tc.Namespace, Cluster: tc.SiteName},
NodeDetails{Addr: serverAddr + ":0", Namespace: tc.Namespace, Cluster: tc.SiteName},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah I'm not sure what the :0 is or why it's necessary. Once you figure it out, a comment is probably warranted.

Copy link
Contributor Author

@avatus avatus Mar 15, 2023

Choose a reason for hiding this comment

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

Add a comment!

lib/client/api.go Outdated Show resolved Hide resolved
@avatus avatus enabled auto-merge March 15, 2023 21:41
@avatus avatus added this pull request to the merge queue Mar 15, 2023
Merged via the queue into master with commit eeb1596 Mar 15, 2023
avatus added a commit that referenced this pull request Mar 15, 2023
* Use serverUID for scp target

Revert unneeded hostname change

Remove comment

Get name

* Change name to serverId

* Fix lint errors

* Add comment

* Fix comment and signature format
avatus added a commit that referenced this pull request Mar 15, 2023
* Use serverUID for scp target

Revert unneeded hostname change

Remove comment

Get name

* Change name to serverId

* Fix lint errors

* Add comment

* Fix comment and signature format
avatus added a commit that referenced this pull request Mar 16, 2023
* Use serverUID for scp target

Revert unneeded hostname change

Remove comment

Get name

* Change name to serverId

* Fix lint errors

* Add comment

* Fix comment and signature format
avatus added a commit that referenced this pull request Mar 16, 2023
* Use serverUID for scp target

Revert unneeded hostname change

Remove comment

Get name

* Change name to serverId

* Fix lint errors

* Add comment

* Fix comment and signature format
@avatus avatus deleted the michaelmyers/web-scp-ambiguous-fix branch August 21, 2023 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SSH Nodes: Download Files Ambiguous Error
3 participants