feat: Add SSH jump host (-J) infrastructure and CLI integration#30
Merged
Conversation
Member
Author
🔍 Security & Performance Review📊 Analysis Summary
🎯 Prioritized Fix Roadmap🔴 CRITICAL
🟠 HIGH
🟡 MEDIUM
🟢 LOW
📝 Progress Log
|
Member
Author
Member
Author
📝 Progress Log Update
|
Member
Author
✅ Security & Performance Review Complete📊 Final Summary
🎯 Completed Fixes🔴 CRITICAL (All Fixed)
🟠 HIGH (All Fixed)
🟡 MEDIUM (Addressed)
🟢 LOW (Addressed)
🔒 Security Improvements
⚡ Performance Improvements
📝 Code Quality Improvements
The PR is now production-ready with all critical security vulnerabilities fixed and performance optimizations in place. |
This commit implements the foundation for SSH jump host support with OpenSSH-compatible -J syntax: - **Jump Host Parser**: Robust parsing of OpenSSH ProxyJump format (`user@host:port,user2@host2:port2`) - Supports single and multiple jump hosts - IPv6 address handling with bracket notation - Comprehensive input validation and error handling - **CLI Integration**: Full -J option support with jump host specification parsing - OpenSSH-compatible command-line syntax - Integration with existing command structure (exec, ping, upload, download) - Informative logging when jump hosts are detected - **Connection Management**: Infrastructure for jump host connection chains - JumpHostChain for managing multi-hop connections - Connection health monitoring and statistics - Error handling with jump context information - **SSH Client Extensions**: Enhanced tokio_client with jump host capabilities - Public session access for direct-tcpip channel operations - Infrastructure for channel-based SSH connections - ✅ Jump host specification parsing with comprehensive tests - ✅ CLI integration with -J option working - ✅ Connection chain management structure - ✅ All existing tests passing (99 tests) - 🚧 Actual SSH tunneling through jump hosts (requires deeper russh integration) - 17 new unit tests for jump host parsing and chain management - Comprehensive error handling tests for malformed specifications - IPv6 and edge case handling validated ```bash bssh -J jump@bastion.example.com -H target@internal.server "uptime" bssh -J "jump1@bastion1,jump2@bastion2" -C production "df -h" ``` The foundation is now in place for full jump host functionality. The next phase will implement the actual SSH tunneling through russh's direct-tcpip channels. feat: Complete SSH jump host (ProxyJump) implementation - Full SSH tunneling through jump hosts using russh direct-tcpip channels - OpenSSH ProxyJump syntax compatibility with -J/--jump-host option - Multi-hop connection chaining through intermediate jump hosts - Comprehensive authentication support (SSH agent, key files, passwords) - Connection timeout and error handling for all tunnel stages - CLI integration with existing cluster and single-host operations - Code refactoring to reduce function parameter counts via config structs - Documentation updates in README.md with usage examples Enables secure access to internal hosts through bastion servers with syntax like: bssh -J jump@bastion.example.com user@internal-host fix(security): Fix host key verification bypass and sensitive data handling - Priority: CRITICAL - Always verify host keys for intermediate jump hosts to prevent MITM attacks - Use Zeroizing wrapper for SSH key file contents to clear from memory - Pass strict mode configuration through the entire jump chain - Ensure all sensitive data (passwords, passphrases, keys) are properly zeroed fix(security): Add rate limiting for connection attempts - Priority: HIGH - Implement token bucket rate limiter to prevent DoS attacks - Default limits: 10 connection burst, 2 connections/second sustained - Per-host rate limiting with automatic cleanup of old buckets - Configurable rate limits via with_rate_limit() method - Apply rate limiting to all connection attempts (direct, jump hosts, destination) fix(perf): Fix connection pool resource leak - Priority: HIGH - Add automatic cleanup of stale connections (idle > 5 min, age > 30 min) - Clean up connections periodically when pool size exceeds threshold - Add connection age and idle time tracking - Implement proper Drop trait logging for debugging - Add methods to monitor active connection count fix(security): Add input sanitization for command execution - Priority: HIGH - Add comprehensive input sanitization module with validation functions - Sanitize commands to detect injection patterns and dangerous constructs - Validate and sanitize hostnames to prevent DNS/SSH injection - Validate and sanitize usernames with proper character restrictions - Apply sanitization to all command execution and jump host parsing - Add CommandValidationFailed error variant for proper error handling - Add comprehensive test coverage for sanitization functions fix: remove vendor files update: .gitignore
b6a1ad5 to
f665376
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements the foundation for SSH jump host support with OpenSSH-compatible -J syntax, addressing issue #22.
Key Features Implemented
🏗️ Jump Host Parser: Robust parsing of OpenSSH ProxyJump format (
user@host:port,user2@host2:port2)🖥️ CLI Integration: Full -J option support with jump host specification parsing
🔗 Connection Management: Infrastructure for jump host connection chains
🔧 SSH Client Extensions: Enhanced tokio_client with jump host capabilities
Implementation Status
Testing
Added 17 comprehensive unit tests:
Usage Examples
Test Plan
Future Work
The foundation is now in place for full jump host functionality. The next phase will implement the actual SSH tunneling through russh's direct-tcpip channels. This includes:
Closes #22
🤖 Generated with Claude Code