The Wayback Machine - https://web.archive.org/web/20250517081342/https://github.com/microsoft/vscode-remote-release/issues/6600
Skip to content

Enable SSH agent forwarding for scp #6600

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

Open
BrHal opened this issue Apr 11, 2022 · 5 comments
Open

Enable SSH agent forwarding for scp #6600

BrHal opened this issue Apr 11, 2022 · 5 comments
Assignees
Labels
feature-request Request for new features or functionality ssh Issue in vscode-remote SSH
Milestone

Comments

@BrHal
Copy link

BrHal commented Apr 11, 2022

Hello,

As a specific security requirement, on my lab,
SSH authentication is performed thru a tool named "BalaBit - Shell Control Box (SCB)", which supports SSH agent forwarding.
However, this security tool has a flaw in its current release : it is unable to fallback to ssh interactive password when authentication is set to ssh key exchange.

Therefore, I must use SSH key authentication and agent forwarding.
In addition, hosts I connect to have no internet connection, thus : localServerDownload
Last but not least, I must use cygwin ssh because activating windows openssh forward agent requires admin rights on laptop, I don't have them.

All this works OK for remote ssh editing but the upload of vscode-server fails because scp ignores ForwardAgent ssh directive in config file unless "-A" flag is present on the cmd line.

I am using following explicit remote SSH Setup :
{
"remote.SSH.configFile": "path_to_my_ssh_config",
"remote.SSH.localServerDownload": "always",
"remote.SSH.showLoginTerminal": true,
"remote.SSH.logLevel": "trace",
}
all other options are on default values, including remote.SSH.enableAgentForwarding : true

To overcome this issue, some extra remote.SSH setting for scp command should be useful in this case...
say:
Remote.SSH.scpExtraOptions: "-A" default ""

@github-actions github-actions bot added the ssh Issue in vscode-remote SSH label Apr 11, 2022
@tanhakabir tanhakabir added the feature-request Request for new features or functionality label Apr 12, 2022
@tanhakabir tanhakabir changed the title Issue with forwardAgent Remote-SSH: Add setting for SCP options to pass in additional flags like -A Apr 12, 2022
@tanhakabir
Copy link

scp ignores ForwardAgent ssh directive in config file unless "-A" flag is present on the cmd line.

How do you know this is the case?

@BrHal
Copy link
Author

BrHal commented Apr 13, 2022

How do you know this is the case?

Ran tests on my lab, - sorry not showing because of sensitive details - plus found a rel note there :

https://www.openssh.com/txt/release-8.4

  • scp(1), sftp(1): allow the -A flag to explicitly enable agent
    forwarding in scp and sftp. The default remains to not forward an
    agent, even when ssh_config enables it.

@tanhakabir tanhakabir modified the milestones: Backlog Candidates, back, Backlog Apr 13, 2022
@tanhakabir
Copy link

Ah I see, seems reasonable to add a setting to add the -A flag on scp.

@roblourens roblourens changed the title Remote-SSH: Add setting for SCP options to pass in additional flags like -A Enable SSH agent forwarding for scp Dec 17, 2022
@etozhecyber
Copy link

I have found a workaround for this problem
echo "alias scp='scp -A'" > .bash_profile

@joshspicer
Copy link
Member

enableAgentForwarding is enabled by default, and for security reasons I don't think we'd want to always forward the agent through scp. If adding this we may want to detect if the host's configuration has ForwardAgent yes, and from there add the -A to scp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality ssh Issue in vscode-remote SSH
Projects
None yet
Development

No branches or pull requests

5 participants
@tanhakabir @BrHal @joshspicer @etozhecyber and others