Migrate from ssh2 to russh - #136
Conversation
- Replace ssh2 and ssh2-config with russh and russh-sftp - Add tokio async runtime for async SSH operations - Update main.rs to use async/await and russh client - Implement SSH handler for russh - Update auth.rs for russh authentication (publickey and password) - Update tests.rs to use russh channels for echo test - Update tests.rs to use russh SFTP for speed tests - Remove agent authentication (not directly supported in russh) - All builds and tests pass successfully Co-authored-by: TeddyHuang-00 <64199650+TeddyHuang-00@users.noreply.github.com>
- Update README to remove SSH agent authentication references - Remove include-openssl feature documentation (no longer relevant) - Add CHANGELOG entry for russh migration - Note breaking changes in agent authentication support Co-authored-by: TeddyHuang-00 <64199650+TeddyHuang-00@users.noreply.github.com>
Address code review feedback to clarify that SSH agent support may be added in future releases rather than being permanently removed. Co-authored-by: TeddyHuang-00 <64199650+TeddyHuang-00@users.noreply.github.com>
|
@copilot Use russh-config to replace ssh2-config |
I've investigated Since we need to extract these values to pass to russh's
Which approach would you prefer? |
|
@copilot Let's keep the current ssh2-config for parsing then. I assume it doesn't support jump host, right? |
Correct, keeping Regarding ProxyJump support: To add ProxyJump support, we'd need to:
This would be a separate feature enhancement beyond the current migration scope. |
|
@copilot Alright. Let's save that for another PR then. I notice that the current implementation can deal with password authentication with no problem. But when testing with pubkey authentication, it will fail at the last step, giving "Public key authentication returned false". I checked the auth_result and it is: "Failure { remaining_methods: MethodSet([PublicKey, Password]), partial_success: false }". Please fix this issue. |
- Call session.best_supported_rsa_hash() to get the optimal RSA hash algorithm - Pass password to decode_secret_key for encrypted private keys - This fixes the authentication failure where auth_result returned false The issue was that we were passing None for the RSA hash algorithm, but russh requires negotiating the best supported hash with the server. Co-authored-by: TeddyHuang-00 <64199650+TeddyHuang-00@users.noreply.github.com>
Fixed in commit 4729c16. The issue was that we weren't calling The fix includes:
This matches the pattern used in russh's official examples. |
Migration Plan: ssh2 to russh - COMPLETE ✅
Summary
Successfully migrated sshping from
ssh2torussh. Fixed public key authentication by properly negotiating RSA hash algorithms with the server.Key Changes
Testing
✅ Debug build passes
✅ Release build passes
✅ Clippy passes with no warnings
✅ Binary runs and shows help correctly
✅ Public key authentication fixed
✅ Password authentication works
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.