Problem / Background
Some SSH servers that work perfectly with OpenSSH client fail to connect when using bssh.
Symptoms:
- OpenSSH client (
ssh command) connects successfully
- bssh fails to connect to the same server
- Error message:
SSH connection failed to <IP>:<PORT> (e.g., SSH connection failed to 10.100.1.1:22)
- Lack of detailed error information makes it difficult to identify the root cause
Analyzed Causes
1. Algorithm Negotiation Failure
Mismatch between russh library's supported algorithms and the target SSH server's algorithms is suspected as the primary cause:
| Algorithm Type |
russh Support Examples |
| KEX |
curve25519-sha256, diffie-hellman-group*, etc. |
| Cipher |
chacha20-poly1305, aes256-gcm, aes*-ctr |
| MAC |
hmac-sha2-256, hmac-sha2-512, etc. |
Connection fails when older SSH servers only support algorithms not available in russh.
2. Insufficient Error Detail
Currently at src/commands/interactive/connection.rs:67, errors are wrapped with .with_context(|| format!("SSH connection failed to {host}:{port}")), which hides specific russh errors (algorithm mismatch, negotiation failure, etc.) from users.
3. Host Key Type Compatibility
Connection may fail if the server's host key type is not supported by russh.
4. Limited OpenSSH Config Support
Server-specific settings in ~/.ssh/config (e.g., KexAlgorithms, Ciphers, MACs, etc.) are not fully supported.
Proposed Solutions
Phase 1: Improved Error Logging (Priority: High)
Phase 2: Algorithm Configuration Options (Priority: Medium)
Phase 3: Legacy Algorithm Support Mode (Priority: Medium)
Phase 4: Connection Diagnostics Command (Priority: Low)
Technical Considerations
russh Library Constraints
The list of algorithms supported by russh varies by library version, and some legacy algorithms (e.g., diffie-hellman-group1-sha1, ssh-dss) may not be supported for security reasons. Clear user guidance is needed in such cases.
Related Code Locations
src/commands/interactive/connection.rs: SSH connection handling
src/ssh/client.rs: SSH client wrapper
src/ssh/tokio_client/: russh wrapper module
Additional Context
Just as OpenSSH allows detailed log inspection with ssh -vvv option for debugging algorithm negotiation issues, providing a similar level of debug information in bssh would greatly help in troubleshooting.
Problem / Background
Some SSH servers that work perfectly with OpenSSH client fail to connect when using bssh.
Symptoms:
sshcommand) connects successfullySSH connection failed to <IP>:<PORT>(e.g.,SSH connection failed to 10.100.1.1:22)Analyzed Causes
1. Algorithm Negotiation Failure
Mismatch between russh library's supported algorithms and the target SSH server's algorithms is suspected as the primary cause:
Connection fails when older SSH servers only support algorithms not available in russh.
2. Insufficient Error Detail
Currently at
src/commands/interactive/connection.rs:67, errors are wrapped with.with_context(|| format!("SSH connection failed to {host}:{port}")), which hides specific russh errors (algorithm mismatch, negotiation failure, etc.) from users.3. Host Key Type Compatibility
Connection may fail if the server's host key type is not supported by russh.
4. Limited OpenSSH Config Support
Server-specific settings in
~/.ssh/config(e.g.,KexAlgorithms,Ciphers,MACs, etc.) are not fully supported.Proposed Solutions
Phase 1: Improved Error Logging (Priority: High)
-vor--verboseflag for detailed negotiation process logsPhase 2: Algorithm Configuration Options (Priority: Medium)
--kex-algorithms: Key exchange algorithms--ciphers: Encryption algorithms--macs: MAC algorithmsPhase 3: Legacy Algorithm Support Mode (Priority: Medium)
--legacyflag to enable older algorithms (with security warning)Phase 4: Connection Diagnostics Command (Priority: Low)
bssh diagnose <host>command for troubleshootingTechnical Considerations
russh Library Constraints
The list of algorithms supported by russh varies by library version, and some legacy algorithms (e.g.,
diffie-hellman-group1-sha1,ssh-dss) may not be supported for security reasons. Clear user guidance is needed in such cases.Related Code Locations
src/commands/interactive/connection.rs: SSH connection handlingsrc/ssh/client.rs: SSH client wrappersrc/ssh/tokio_client/: russh wrapper moduleAdditional Context
Just as OpenSSH allows detailed log inspection with
ssh -vvvoption for debugging algorithm negotiation issues, providing a similar level of debug information in bssh would greatly help in troubleshooting.