vscode-sshfs icon indicating copy to clipboard operation
vscode-sshfs copied to clipboard

Disconnects immediately when adding folder as a workspace -- yet connecting via terminal works fine.

Open billdacat opened this issue 1 year ago • 1 comments

User can open VS Code and use the 'Open remote SSH terminal' option in SSH FS to connect. That works.

User tries to 'Add as Workspace folder'. Fails. Looked at the /var/log/messages and /var/log/secure, it's apparently successfully authenticating the user, then immediately disconnecting. I'd think the user didn't have a shell or something, but they can connect via the terminal in SSH FS and it's fine.

billdacat avatar Oct 27 '22 20:10 billdacat

Relevant log parts:

[INFO]    [createConnection(dcstats-etl,config)] Remote version: OpenSSH_7.7
[DEBUG]   [ssh2(dcstats-etl)] Outbound: Sending CHANNEL_OPEN (r:0, session)
[DEBUG]   [ssh2(dcstats-etl)] Inbound: GLOBAL_REQUEST ([[email protected]](mailto:[email protected]))
[DEBUG]   [ssh2(dcstats-etl)] Outbound: Sending GLOBAL_REQUEST ([[email protected]](mailto:[email protected]))
[DEBUG]   [ssh2(dcstats-etl)] Inbound: CHANNEL_OPEN_CONFIRMATION (r:0, s:0)
[DEBUG]   [ssh2(dcstats-etl)] Outbound: Sending CHANNEL_REQUEST (r:0, exec: echo :::SHELL:$SHELL:SHELL:::)
[DEBUG]   [ssh2(dcstats-etl)] Inbound: REQUEST_SUCCESS
[DEBUG]   [ssh2(dcstats-etl)] Inbound: CHANNEL_WINDOW_ADJUST (r:0, 2097152)
[DEBUG]   [ssh2(dcstats-etl)] Inbound: CHANNEL_SUCCESS (r:0)
[DEBUG]   [ssh2(dcstats-etl)] Inbound: CHANNEL_DATA (r:0, 28)
[DEBUG]   [ssh2(dcstats-etl)] Inbound: CHANNEL_EOF (r:0)
[DEBUG]   [ssh2(dcstats-etl)] Inbound: CHANNEL_REQUEST (r:0, exit-status: 0)
[DEBUG]   [ssh2(dcstats-etl)] Inbound: CHANNEL_CLOSE (r:0)
[DEBUG]   [ssh2(dcstats-etl)] Outbound: Sending CHANNEL_CLOSE (r:0)
[DEBUG]   [createConnection(dcstats-etl,config)] Detected known $SHELL '/bin/bash' (bash)
[DEBUG]   [ssh2(dcstats-etl)] Outbound: Sending CHANNEL_OPEN (r:1, session)
[DEBUG]   [ssh2(dcstats-etl)] Inbound: CHANNEL_OPEN_CONFIRMATION (r:1, s:0)
[DEBUG]   [ssh2(dcstats-etl)] Outbound: Sending CHANNEL_REQUEST (r:0, exec: echo "::`echo 26283`:echo_result:`echo ~`:`echo 26283`::")
[DEBUG]   [ssh2(dcstats-etl)] Inbound: CHANNEL_WINDOW_ADJUST (r:1, 2097152)
[DEBUG]   [ssh2(dcstats-etl)] Inbound: CHANNEL_SUCCESS (r:1)
[DEBUG]   [ssh2(dcstats-etl)] Inbound: CHANNEL_DATA (r:1, 52)
[DEBUG]   [ssh2(dcstats-etl)] Inbound: CHANNEL_EOF (r:1)
[DEBUG]   [ssh2(dcstats-etl)] Inbound: CHANNEL_REQUEST (r:1, exit-status: 0)
[DEBUG]   [ssh2(dcstats-etl)] Inbound: CHANNEL_CLOSE (r:1)
[DEBUG]   [ssh2(dcstats-etl)] Outbound: Sending CHANNEL_CLOSE (r:0)
[DEBUG]   [createConnection(dcstats-etl,config)] Home path: /home/[email protected]
[DEBUG]   [createConnection(dcstats-etl,config)] Environment: []
[INFO]    [getSFTP(dcstats-etl)] Creating SFTP session using standard sftp subsystem
[DEBUG]   [ssh2(dcstats-etl)] Outbound: Sending CHANNEL_OPEN (r:2, session)
[DEBUG]   [ssh2(dcstats-etl)] Inbound: CHANNEL_OPEN_CONFIRMATION (r:2, s:0)
[DEBUG]   [ssh2(dcstats-etl)] Outbound: Sending CHANNEL_REQUEST (r:0, subsystem: sftp)
[DEBUG]   [ssh2(dcstats-etl)] Inbound: CHANNEL_WINDOW_ADJUST (r:2, 2097152)
[DEBUG]   [ssh2(dcstats-etl)] Inbound: CHANNEL_SUCCESS (r:2)
[DEBUG]   [ssh2(dcstats-etl)] Outbound: Sending CHANNEL_DATA (r:0, 9)
[DEBUG]   [ssh2(dcstats-etl)] Inbound: CHANNEL_EOF (r:2)
[DEBUG]   [ssh2(dcstats-etl)] Inbound: CHANNEL_REQUEST (r:2, exit-status: 255)
[DEBUG]   [ssh2(dcstats-etl)] Inbound: CHANNEL_CLOSE (r:2)
[ERROR]   Error while connecting to SSH FS dcstats-etl:
Error: Received exit code 255 while establishing SFTP session
JSON: {"code":255}
Error: Received exit code 255 while establishing SFTP session
    at SFTP.a (c:\Users\hiraic\.vscode\extensions\kelvin.vscode-sshfs-1.25.0\dist\14f8.extension.js:1:105838)
    at SFTP.emit (events.js:315:20)
    at CHANNEL_REQUEST (c:\Users\hiraic\.vscode\extensions\kelvin.vscode-sshfs-1.25.0\dist\14f8.extension.js:1:93922)
    at 98 (c:\Users\hiraic\.vscode\extensions\kelvin.vscode-sshfs-1.25.0\dist\14f8.extension.js:1:247038)
    at e.exports.D (c:\Users\hiraic\.vscode\extensions\kelvin.vscode-sshfs-1.25.0\dist\14f8.extension.js:1:109909)
    at D.decrypt (c:\Users\hiraic\.vscode\extensions\kelvin.vscode-sshfs-1.25.0\dist\14f8.extension.js:1:201682)
    at e.exports.H [as _parse] (c:\Users\hiraic\.vscode\extensions\kelvin.vscode-sshfs-1.25.0\dist\14f8.extension.js:1:109433)
    at e.exports.parse (c:\Users\hiraic\.vscode\extensions\kelvin.vscode-sshfs-1.25.0\dist\14f8.extension.js:1:113236)
    at Socket.<anonymous> (c:\Users\hiraic\.vscode\extensions\kelvin.vscode-sshfs-1.25.0\dist\14f8.extension.js:1:95036)
    at Socket.emit (events.js:315:20)
Caused by toPromise:
    at I (c:\Users\hiraic\.vscode\extensions\kelvin.vscode-sshfs-1.25.0\dist\14f8.extension.js:1:62949)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at c:\Users\hiraic\.vscode\extensions\kelvin.vscode-sshfs-1.25.0\dist\extension.js:11:23642
Caused by catchingPromise:
    at i (c:\Users\hiraic\.vscode\extensions\kelvin.vscode-sshfs-1.25.0\dist\extension.js:11:6396)
    at m.createFileSystem (c:\Users\hiraic\.vscode\extensions\kelvin.vscode-sshfs-1.25.0\dist\extension.js:11:23282)
    at r.assertFs (c:\Users\hiraic\.vscode\extensions\kelvin.vscode-sshfs-1.25.0\dist\extension.js:11:11864)
    at r.stat (c:\Users\hiraic\.vscode\extensions\kelvin.vscode-sshfs-1.25.0\dist\extension.js:11:11971)
    at P.$stat (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:84:164584)
    at c._doInvokeHandler (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:88:12743)
    at c._invokeHandler (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:88:12435)
    at c._receiveRequest (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:88:11097)
    at c._receiveOneMessage (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:88:9900)
    at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:88:8004
Logged at:
    at c:\Users\hiraic\.vscode\extensions\kelvin.vscode-sshfs-1.25.0\dist\extension.js:11:24945
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
[DEBUG]   [ssh2(dcstats-etl)] Outbound: Sending ping (GLOBAL_REQUEST: [[email protected]](mailto:[email protected]))
[DEBUG]   [ssh2(dcstats-etl)] Inbound: Received REQUEST_FAILURE
[DEBUG]   [ssh2(dcstats-etl)] Outbound: Sending ping (GLOBAL_REQUEST: [[email protected]](mailto:[email protected]))
[DEBUG]   [ssh2(dcstats-etl)] Inbound: Received REQUEST_FAILURE
[DEBUG]   [ssh2(dcstats-etl)] Outbound: Sending ping (GLOBAL_REQUEST: [[email protected]](mailto:[email protected]))
[DEBUG]   [ssh2(dcstats-etl)] Inbound: Received REQUEST_FAILURE

billdacat avatar Oct 27 '22 20:10 billdacat

Appears to have been some Cyberark issue, but still not understanding fully why it would allow a normal SSH terminal connection through VS/SSH-FS, and not adding a folder as a workspace.

billdacat avatar Oct 31 '22 14:10 billdacat

I don't dev this extension, but it could possible be due to a change in the VS Code API when adding folders to the workspace.

worksofliam avatar Feb 01 '23 18:02 worksofliam

Does this issue still occur?

While the sftp subsystem call failing with a status code 255 doesn't tell me much, the little what I can find about it mentions the user not having configured a proper terminal. Since you can still create a terminal, that shouldn't an issue (unless you changed SFTP Command or Terminal Command or similar).

Does SFTP work outside the extension? Perhaps running the subsystem (or /usr/lib/openssh/sftp-server which OpenSSH uses) got blocked by Cyberark.

SchoofsKelvin avatar Mar 24 '23 21:03 SchoofsKelvin

It was some sort of configuration issue on the CyberArk side they resolved. That's another team/division from where I'm at, so unfortunately I don't have a lot of insight into what they actually changed.

SFTP was working outside the extension, from a normal terminal prompt, yes.

billdacat avatar Mar 30 '23 13:03 billdacat

Then I'll assume it's a security feature based on e.g. the SSH client's ident (SSH-2.0-ssh2js) or similar, hard to diagnose/fix at this point. I'll close the ticket since that team figured out what's causing it on their end.

SchoofsKelvin avatar Apr 02 '23 17:04 SchoofsKelvin