-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Support SSH keepalive settings in interactive mode #172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Fix #168: Interactive mode now properly honors SSH keepalive configuration (--server-alive-interval and --server-alive-count-max CLI options, SSH config file settings, and YAML config file settings). Changes: - Add ssh_connection_config field to InteractiveCommand struct - Create build_ssh_connection_config helper in dispatcher for code reuse - Update establish_connection to use Client::connect_with_ssh_config - Pass SshConnectionConfig to JumpHostChain for jump host connections - Add connection health check timeout to PTY session loop - Add interactive mode keepalive tests to ssh_keepalive_test.rs This fix ensures that interactive mode connections: 1. Honor CLI --server-alive-interval/--server-alive-count-max options 2. Honor SSH config file ServerAliveInterval/ServerAliveCountMax settings 3. Honor YAML config file server_alive_interval/server_alive_count_max settings 4. Apply keepalive settings to both direct and jump host connections 5. Have periodic health checks to detect dead connections
Security & Performance ReviewAnalysis Summary
Prioritized Fix RoadmapHIGH
MEDIUM
LOW
Security ReviewPositive findings:
No security vulnerabilities found. Performance ReviewPositive findings:
Observations:
Correctness ReviewConfiguration precedence is correctly implemented: // CLI > SSH config > YAML config > defaults
let keepalive_interval = cli.server_alive_interval
.or_else(|| ctx.ssh_config.get_int_option(...))
.or_else(|| ctx.config.get_server_alive_interval(...))
.unwrap_or(DEFAULT_KEEPALIVE_INTERVAL);Zero interval handling: // Correctly treats 0 as "disable keepalive"
.with_keepalive_interval(if keepalive_interval == 0 {
None
} else {
Some(keepalive_interval)
})Test coverage is comprehensive (199 lines of new tests covering):
Required ActionThe example file must be fixed for the PR to pass CI: // In examples/interactive_demo.rs, add this field to InteractiveCommand:
ssh_connection_config: bssh::ssh::tokio_client::SshConnectionConfig::default(), |
Priority: HIGH Issue: Build failure due to missing field in InteractiveCommand struct Review-Iteration: 1 The PR added ssh_connection_config field to InteractiveCommand but missed updating the example file and test files that instantiate this struct.
Review Update - Fixes AppliedCompleted Fixes
VerificationRemaining Items (Not Blocking)
The clippy warning about SummaryThe PR is now ready for merge. All build-breaking issues have been fixed, and the code properly implements SSH keepalive support for interactive mode with:
|
- Add #[allow(clippy::too_many_arguments)] for establish_connection function - Apply cargo fmt formatting fixes - Add interactive mode + keepalive example to README and manpage
PR Finalization ReportProject Structure Discovered
ChecklistTests
Documentation
Code Quality
Changes Made
Verification Results
All checks are now passing. The PR is ready for merge. |
Summary
Fix #168: Interactive mode now properly honors SSH keepalive configuration.
This PR addresses a bug where interactive mode ignored keepalive settings:
--server-alive-intervaland--server-alive-count-maxwere ignoredServerAliveInterval,ServerAliveCountMax) were ignoredKey Changes:
ssh_connection_configfield toInteractiveCommandstructbuild_ssh_connection_confighelper function in dispatcher for code reuse between exec and interactive modesestablish_connectionto useClient::connect_with_ssh_config()instead ofClient::connect()SshConnectionConfigtoJumpHostChainfor jump host connectionsBefore this fix:
After this fix:
Test plan