mscdex / mscdex/ssh2

SFTP session fails to close

Open
#1,153 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
5.8k
Forks
734
PR merge metrics
No merged PRs in 30d

Description

I'm trying to upgrade from ssh2 0.8.7 to git master (1.7.0 failed to build due to #1149 or something similar), and I'm having troubles with my sftp server not closing the connection correctly. If I'm using the standard tool sftp -vvv to retreive a file, this is where it stops:

debug3: Sent message SSH2_FXP_CLOSE I:8
debug3: SSH2_FXP_STATUS 0
debug2: channel 0: read<=0 rfd 4 len 0
debug2: channel 0: read failed
debug2: channel 0: close_read
debug2: channel 0: input open -> drain
debug2: channel 0: ibuf empty
debug2: channel 0: send eof
debug3: send packet: type 96
debug2: channel 0: input drain -> closed

After some research, I found RFC 4254 which claims that type 96 is SSH_MSG_CHANNEL_EOF and that Upon receiving this message, a party MUST send back an SSH_MSG_CHANNEL_CLOSE.

It looks to me like the sftp server does not do this correctly (i e, send back a SSH_MSG_CHANNEL_CLOSE), and so the connection stalls.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the stall with the standard sftp -vvv tool and compare the exchange with RFC 4254, especially the SSH_MSG_CHANNEL_EOF and SSH_MSG_CHANNEL_CLOSE messages. Done means determining whether the ssh2 server-side behavior or the SFTP server is responsible and documenting a concrete path to prevent the connection from stalling.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.