-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Implement SSH keepalive to prevent idle connection timeouts #122
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
Add configurable SSH keepalive settings (ServerAliveInterval and ServerAliveCountMax) to prevent connections from timing out during long-running operations. Changes: - Add SshConnectionConfig struct with keepalive settings (default: 60s interval, 3 max) - Add CLI options --server-alive-interval and --server-alive-count-max - Add YAML config support for server_alive_interval and server_alive_count_max - Implement config precedence: CLI > SSH config > YAML config > defaults - Update all connection paths (direct, tunnel, jump hosts) to use keepalive - Update documentation (README.md, ARCHITECTURE.md) Closes #121
Security & Performance ReviewAnalysis Summary
Review FindingsAfter thorough analysis of the SSH keepalive implementation, I found no security vulnerabilities or performance issues. Security Analysis1. Input Validation - PASS
2. Configuration Precedence - PASS (Secure Design) This follows OpenSSH conventions and allows users to override defaults securely. 3. Default Values - PASS
4. No Sensitive Data Exposure - PASS
5. Proper Resource Management - PASS
Performance Analysis1. Memory Overhead - MINIMAL
2. CPU Overhead - NEGLIGIBLE
3. Network Impact - MINIMAL (Expected Behavior)
Code Quality1. API Design - EXCELLENT
2. Backward Compatibility - PRESERVED
3. Test & Lint Status - PASS
Implementation Review SummaryThe implementation correctly:
VerdictAPPROVED - This PR implements SSH keepalive functionality correctly and securely. No issues found that require fixing. Status: Review Complete
|
- Add comprehensive test suite for SSH keepalive (27 tests) - SshConnectionConfig struct tests - SSH config parsing tests for ServerAlive* options - Config resolution tests for keepalive settings - ParallelExecutor integration tests - Fix doc test examples (AuthMethod::with_key_file signature change) - Update documentation: - docs/architecture/configuration.md: Add keepalive fields - docs/architecture/ssh-client.md: Document keepalive support
PR Finalization CompleteProject Structure Discovered
ChecklistTests
Documentation
Code Quality
Changes Made
Notes
All checks passing. Ready for merge. |
- Add SSH keepalive support (#122) - Update dependencies to latest versions: - russh: 0.55.0 → 0.56.0 - ratatui: 0.29.0 → 0.30.0 - signal-hook: 0.3.18 → 0.4.1 - whoami: 1.6.1 → 2.0.1 - unicode-width: 0.2.0 → 0.2.2 - Adapt code for whoami 2.0 API changes - Update CHANGELOG.md, README.md, debian/changelog
Summary
--server-alive-intervaland--server-alive-count-maxCLI options (matching OpenSSH syntax)server_alive_intervalandserver_alive_count_maxin defaults and cluster settingsChanges
Core Implementation
SshConnectionConfigstruct insrc/ssh/tokio_client/connection.rswith builder patternconnect_with_ssh_config()method toClientfor custom keepalive settingsConfiguration Integration
src/cli/bssh.rs:--server-alive-interval,--server-alive-count-maxsrc/config/types.rs:server_alive_interval,server_alive_count_maxFiles Modified
src/ssh/tokio_client/connection.rs- Core keepalive config structsrc/ssh/tokio_client/mod.rs- Export new typessrc/jump/chain/tunnel.rs- Jump host tunnel connectionssrc/jump/chain/chain_connection.rs- Direct connectionssrc/jump/chain.rs- Jump host chain managementsrc/cli/bssh.rs- CLI optionssrc/config/types.rs- YAML config typessrc/config/resolver.rs- Config resolutionsrc/executor/parallel.rs- ParallelExecutor integrationsrc/commands/exec.rs- Execute command paramssrc/app/dispatcher.rs- Wire CLI to executorTest Plan
cargo buildsucceeds with no warningscargo testpasses (excluding macOS keychain tests that require user interaction)cargo clippypasses with no warningsbssh --help | grep server-alive--server-alive-interval 0Closes #121