Uh oh!
There was an error while loading. Please reload this page.
Handle unknown channel messages correctly - #1363
Conversation
See discussion sshnet#1218 . Some servers send custom channel messages like 'keepalive@proftpd.org' as keep alive messages. This currently causes a NotSupportedException. According to the spec https://datatracker.ietf.org/doc/html/rfc4254#section-5.4 : "If the request is not recognized or is not supported for the channel, SSH_MSG_CHANNEL_FAILURE is returned." Send a failure message back instead of throwing an exception.
beb09ac to
1ab1300CompareRob-Hague
commented
Mar 31, 2024
The whole paragraph is (emphasis mine): To me, that says we should only send SSH_MSG_CHANNEL_FAILURE if 'want reply' is true. i.e. // Raise request specific event
OnRequest(requestInfo);
}
- else+ else if (e.Message.WantReply)
{
var reply = new ChannelFailureMessage(LocalChannelNumber);
SendMessage(reply);
Unfortunately,
2 is probably easiest. What do you think? |
mus65
commented
Apr 1, 2024
@Rob-Hague Pushed. Moved UnknownRequestInfo to production code and it checks WantReply now. The test still needs its own class to set WantReply=true . |
This RFC clarification (draft) may be relevant here, though it's a slightly different issue arising from the same RFC paragraph: This issue has been discussed before in other SSH packages: And this implementation also agrees with your interpretation of WantReply: |
Rob-Hague
commented
Apr 1, 2024
Thanks. The relevant text is: I think we are covered here because SSH.NET/src/Renci.SshNet/Channels/Channel.cs Lines 479 to 488 in db3d7e8 SSH.NET/src/Renci.SshNet/Channels/Channel.cs Lines 547 to 575 in db3d7e8 |
Uh oh!
There was an error while loading. Please reload this page.
not directly related to the PR, was noticed during Code Review.
anandgmenon
commented
Apr 23, 2024
@Rob-Hague/ @WojciechNagorski Can we have a release with this fix please? |
Rob-Hague
commented
Apr 24, 2024
Probably some time in May |
anandgmenon
commented
Jun 18, 2024
@Rob-Hague can we please have a release for this? |
Rob-Hague
commented
Jun 19, 2024
Yes, soon |
Hey @Rob-Hague can you provide a tentative ETA on when you're planning to do the next release? |
See discussion #1218 . Some servers send custom channel messages like 'keepalive@proftpd.org' as keep alive messages. This currently causes a NotSupportedException.
According to the spec https://datatracker.ietf.org/doc/html/rfc4254#section-5.4 :
"If the request is not recognized or is not
supported for the channel, SSH_MSG_CHANNEL_FAILURE is returned."
Send a failure message back instead of throwing an exception.
The test is mostly copy&paste from ChannelTest_OnSessionChannelRequestReceived_OnRequest_Exception. I also reproduced the issue and tested the fix with an actual ProFTPD server locally.