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

scp with OpenSSH client #1048

Closed
kontsevoy opened this issue Jun 7, 2017 · 0 comments · Fixed by #1059
Closed

scp with OpenSSH client #1048

kontsevoy opened this issue Jun 7, 2017 · 0 comments · Fixed by #1059
Assignees
Labels
Milestone

Comments

@kontsevoy
Copy link
Contributor

kontsevoy commented Jun 7, 2017

To reproduce:

$ scp host:/home/dir/* .
unexpected /home/dir/greplog

Happens when:

openssh client -> teleport proxy -> teleport sshd

This works as expected:

openssh client -> teleport proxy -> opens sshd

adding -r flag does not help

@kontsevoy kontsevoy added this to the 2.2 milestone Jun 7, 2017
@kontsevoy kontsevoy added the bug label Jun 7, 2017
@kontsevoy kontsevoy self-assigned this Jun 7, 2017
@kontsevoy kontsevoy added the P0 label Jun 7, 2017
kontsevoy added a commit that referenced this issue Jun 8, 2017
When this command is executed:

```
$ scp host:path/with/wildcards/* .
```

Teleport would launch "SSH exec" request on the sever side, which in
turn would execute the following:

```
/bin/bash -c /usr/bin/teleport scp --remote-addr=127.0.0.1:44226 --local-addr=127.0.0.1:3022 -r -f path/with/wildcards/*
```

The problem is that bash will attempt to "expand" the wildcard, sending
a bunch of files as an input into -f, but `teleport scp` needs to see
the _exact_ string as passed via scp client.

The proposed solution is to detect shell wildcard characters and wrap
them in single quotes preventing them from being expanded.

Another potential solution is to NOT use shell to execute SCP commands.
kontsevoy added a commit that referenced this issue Jun 9, 2017
When this command is executed:

```
$ scp host:path/with/wildcards/* .
```

Teleport would launch "SSH exec" request on the sever side, which in
turn would execute the following:

```
/bin/bash -c /usr/bin/teleport scp --remote-addr=127.0.0.1:44226 --local-addr=127.0.0.1:3022 -r -f path/with/wildcards/*
```

The problem is that bash will attempt to "expand" the wildcard, sending
a bunch of files as an input into -f, but `teleport scp` needs to see
the _exact_ string as passed via scp client.

The proposed solution is to detect shell wildcard characters and wrap
them in single quotes preventing them from being expanded.

Another potential solution is to NOT use shell to execute SCP commands.
hatched pushed a commit to hatched/teleport-merge that referenced this issue Nov 30, 2022
hatched pushed a commit that referenced this issue Dec 20, 2022
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 a pull request may close this issue.

1 participant