Problem / Background
When bssh attempts SSH connection to certain servers, OpenSSH succeeds but bssh fails.
Symptoms
Reproduction Environment
- When user's id_rsa public key is not registered on the server
- OpenSSH succeeds by falling back to password after key failure
- bssh fails because connection is dropped after key failure
Root Cause Analysis
Root Cause: The russh library disconnects the connection before returning is_authenticated.success() == false when key authentication fails
Log Flow
userauth_failure → drop handle → disconnected SshError(Disconnect)
Issue Details
- Password fallback logic in connection.rs does not receive
KeyAuthFailed error
- Instead, it receives
SshError(Disconnect) or other errors
SshError(Disconnect) is excluded from fallback condition matching, so password prompt is not displayed
Proposed Solutions
Apply one or more of the following approaches:
-
Improve error handling after russh authenticate_publickey call
- Check connection state before and after authentication attempt and handle appropriately
-
Add all error types returned on authentication failure to password fallback conditions
- Handle additional error types like
SshError(Disconnect) as fallback triggers
-
Negotiate password authentication method during SSH algorithm negotiation phase
- Switch to password authentication on the same connection when key authentication fails
Acceptance Criteria
Technical Considerations
- Analysis of russh library behavior on authentication failure required
- Logic needed to distinguish between connection drop and authentication failure
- For security, password fallback should only work when explicitly allowed by user
References
Problem / Background
When bssh attempts SSH connection to certain servers, OpenSSH succeeds but bssh fails.
Symptoms
~/.ssh/id_rsakey but server rejects it (userauth_failure)Reproduction Environment
Root Cause Analysis
Root Cause: The russh library disconnects the connection before returning
is_authenticated.success() == falsewhen key authentication failsLog Flow
Issue Details
KeyAuthFailederrorSshError(Disconnect)or other errorsSshError(Disconnect)is excluded from fallback condition matching, so password prompt is not displayedProposed Solutions
Apply one or more of the following approaches:
Improve error handling after russh authenticate_publickey call
Add all error types returned on authentication failure to password fallback conditions
SshError(Disconnect)as fallback triggersNegotiate password authentication method during SSH algorithm negotiation phase
Acceptance Criteria
Technical Considerations
References