Skip to content

feature: Updating ssh protocol to support disconnect message and language in packet#1455

Open
Luwdo wants to merge 1 commit intomscdex:masterfrom
Luwdo:ssh-connection-disconnect-message-option
Open

feature: Updating ssh protocol to support disconnect message and language in packet#1455
Luwdo wants to merge 1 commit intomscdex:masterfrom
Luwdo:ssh-connection-disconnect-message-option

Conversation

@Luwdo
Copy link
Copy Markdown

@Luwdo Luwdo commented Jun 4, 2025

This allows more fine grained control of the disconnect message packet. Allowing custom authentication implementations to communicate to clients the reason for connection failure.

A common pattern that openssh implements is an authentication failure limit. Resulting in the following message:

Received disconnect from 10.99.33.252 port 30372:2: Too many authentication failures
Disconnected from 10.99.33.252 port 30372

ssh2 js can implement this but there was no way to pass back a human readable message or change the reason to PROTOCOL_ERROR: 2 which is most appropriate for a "Too many authentication failures" message.

Fall back is set to reason: BY_APPLICATION so those who do not implement custom authentication exit patterns won't be affected.

@Luwdo
Copy link
Copy Markdown
Author

Luwdo commented Jul 15, 2025

This is still an issue that is hiding ssh client visibility of messages concerning the reason why a connection was rejected.

@mscdex
Copy link
Copy Markdown
Owner

mscdex commented Jul 15, 2025

This needs a test.

@Luwdo
Copy link
Copy Markdown
Author

Luwdo commented Jul 16, 2025

This needs a test.

I can work on getting a test added to my PR.

ProTogen11
ProTogen11 previously approved these changes Jul 31, 2025
…er end()

Update Protocol.disconnect() to write the description message and
language tag fields per RFC 4253 §11.1 instead of zero-filling them.

Expose the new parameters through Client.end() and the server-side
Connection.end() so callers can specify a disconnect reason code,
a human-readable message, and an optional language tag.

Add test for server disconnect with custom reason and message.
@Luwdo Luwdo force-pushed the ssh-connection-disconnect-message-option branch from 432ea13 to 747ffa1 Compare April 7, 2026 17:05
@Luwdo
Copy link
Copy Markdown
Author

Luwdo commented Apr 7, 2026

@mscdex this is updated now with tests

@Luwdo Luwdo changed the title Updating ssh protocol to support disconnect message and language in packet feature: Updating ssh protocol to support disconnect message and language in packet Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants