-
Notifications
You must be signed in to change notification settings - Fork 45
feat: add 35+ SSH config fields and tabbed UI interface #48
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
…aged fields, comments, and directives (Adembc#45) This PR introduces a major refactor of the SSH config parsing and writing logic. The new implementation is more robust and secure, ensuring that only the intended changes are applied while preserving the original file’s structure. Key changes - Lossless parsing/writing: Preserve unmanaged fields (e.g., `ProxyJump`), comments, and directives such as `Include` and `Match`. - Library update: Switched to [github.com/kevinburke/ssh_config](https://github.com/kevinburke/ssh_config) as the base parser, with a custom fork to support required modifications https://github.com/adembc/ssh_config. - Backup policy: Before any modification, create a backup of the SSH config file. Maintain up to 10 backups (configurable in the future) and automatically delete older ones. - IdentityFile handling: Parse IdentityFile as an array instead of a single string, with improved update logic. - Bug fix: Resolve issue where tags could not be fully removed. - Multiple aliases: Support defining and managing multiple aliases for a single server. - Testability: Code has been refactored with testability in mind. Follow-up PRs will include dedicated tests.
Add comprehensive support for commonly used SSH configuration options: Connection and proxy settings: - ProxyJump: Jump host configuration - ProxyCommand: Custom proxy command - RemoteCommand: Execute command on remote host - RequestTTY: TTY allocation control Authentication settings: - PubkeyAuthentication: Enable/disable public key auth - PasswordAuthentication: Enable/disable password auth - PreferredAuthentications: Authentication method preference Agent and forwarding: - ForwardAgent: SSH agent forwarding Connection reliability: - ServerAliveInterval: Keep-alive interval - ServerAliveCountMax: Max keep-alive count - Compression: Enable/disable compression Security settings: - StrictHostKeyChecking: Host key verification mode - UserKnownHostsFile: Custom known_hosts file - HostKeyAlgorithms: Preferred host key algorithms Debugging: - LogLevel: SSH client log verbosity All fields are properly organized by usage frequency and logical grouping in both the UI forms and server details view. The SSH config parser and writer have been updated to handle these fields while preserving existing formatting and comments.
UI improvements: - Add visual section headers for better field grouping - Use white bold text for section headers - Indent fields with 2 spaces for clear hierarchy - Implement dynamic field lookup to handle mixed TextViews and InputFields SSH config optimization: - Skip default port 22 to reduce config clutter - Group related fields together in logical sections - Organize fields by usage frequency and relevance - Maintain compact output without unnecessary blank lines The form now provides better visual organization with clear sections: Basic Configuration, Connection & Proxy, Authentication, Agent & Forwarding, Connection Reliability, Security, and Debugging.
Update BuildSSHCommand to generate complete SSH commands with all supported options: Proxy and connection options: - ProxyJump (-J flag) - ProxyCommand (-o option) - RemoteCommand (appended after host) Authentication options: - PubkeyAuthentication - PasswordAuthentication - PreferredAuthentications Agent and forwarding: - ForwardAgent (-A/-a flags) Connection reliability: - ServerAliveInterval - ServerAliveCountMax - Compression (-C flag) Security options: - StrictHostKeyChecking - UserKnownHostsFile - HostKeyAlgorithms TTY and logging: - RequestTTY (-t/-T/-tt flags) - LogLevel (-q/-v/-vv/-vvv flags) Enhanced features: - Support multiple identity files (all included with -i) - Proper command ordering (options, host, remote command) - Quote values with spaces automatically This ensures copied SSH commands include all configured options, making them functionally equivalent to using ssh with the config file.
Refactor to fix linting issues: - Extract SSH option constants to reduce string duplication - Split BuildSSHCommand into smaller focused functions - Reduce cyclomatic complexity from 34 to acceptable levels Improvements: - Add support for RequestTTY=auto (SSH default behavior) - Add fallback for unknown RequestTTY values via -o option - Update form hint to show all valid options (yes/no/force/auto) Code organization: - addProxyOptions(): ProxyJump, ProxyCommand - addAuthOptions(): Authentication and ForwardAgent - addConnectionOptions(): ServerAlive settings, Compression - addSecurityOptions(): HostKey and known_hosts settings - addTTYAndLoggingOptions(): RequestTTY and LogLevel All SSH config fields and command-line mappings verified against SSH manual pages for correctness.
- Convert yes/no fields to dropdowns: ForwardAgent, Compression, PubkeyAuthentication, PasswordAuthentication - Convert RequestTTY to dropdown with yes/no/force/auto options - Convert StrictHostKeyChecking to dropdown with yes/no/ask/accept-new options - Convert LogLevel to dropdown with QUIET/FATAL/ERROR/INFO/VERBOSE/DEBUG levels - Add findOptionIndex helper for case-insensitive option matching - Add getDropdownValue helper to extract dropdown selections - Display 'seconds' unit in ServerAliveInterval field label - All dropdowns default to empty (no selection) when not set
- Add 20+ new SSH config fields organized by category - Connection & proxy: ConnectTimeout, ConnectionAttempts - Port forwarding: LocalForward, RemoteForward, DynamicForward - Authentication: IdentitiesOnly, AddKeysToAgent, IdentityAgent - X11 forwarding: ForwardX11, ForwardX11Trusted - Connection multiplexing: ControlMaster, ControlPath, ControlPersist - Reliability: TCPKeepAlive - Command execution: LocalCommand, PermitLocalCommand - Environment: SendEnv, SetEnv - Debugging: BatchMode UI improvements: - Reorganize form fields into logical groups - Add dropdowns for enumerated values - Support comma-separated multi-value fields - Visual section headers with proper indentation SSH command generation: - Support all new fields in copy SSH command - Proper flag mapping for all options - Handle multi-value fields correctly
- Split mapKVToServer into 8 specialized mapping functions - Group related SSH config fields by category - Each function handles a specific category of config fields - Reduces cyclomatic complexity from 40 to under 10 per function
…avigation - Restructure ServerForm to use tabbed interface with Pages - Add Basic, Connection, Forwarding, Authentication, Multiplexing, and Advanced tabs - Implement tab navigation with Ctrl+L/Ctrl+H shortcuts - Add visual tab bar with current tab highlighting - Organize SSH config options into logical groups - Improve form layout and user experience 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Thanks for this PR @tan9 , it looks amazing! I’m reviewing it now and will merge it ASAP. |
Update: Enhanced SSH Configuration SupportRecent Changes1. Added PubkeyAcceptedAlgorithms SupportIn response to #10, I've added support for the
2. Advanced Algorithm Configuration with AutocompleteSignificantly improved the user experience for configuring SSH algorithms:
Why These Changes Matter
Testing
These enhancements make LazySSH more powerful for users who need fine-grained control over their SSH security configurations while keeping the interface intuitive. |
6b93a3f
to
76b152a
Compare
- Move ControlMaster, ControlPath, and ControlPersist fields to Connection tab - Remove standalone Multiplexing tab to simplify interface (6 tabs -> 5 tabs) - Group multiplexing options under yellow "Multiplexing" header in Connection tab - Better organization by keeping all connection-related settings together
- Add PubkeyAcceptedAlgorithms field to domain model (modern name, replaces deprecated PubkeyAcceptedKeyTypes) - Implement dropdown in Authentication tab with common key algorithms (Ed25519, ECDSA, RSA, etc.) - Position field right after PubkeyAuthentication for logical grouping - Support both new (PubkeyAcceptedAlgorithms) and legacy (PubkeyAcceptedKeyTypes) names in SSH config - Include in Copy SSH command generation with -o flag
- Convert algorithm fields to input fields with prefix support (+append, -remove, ^prepend) - Add intelligent autocomplete/typeahead for all algorithm fields: * PubkeyAcceptedAlgorithms (public key algorithms) * Ciphers (encryption algorithms) * MACs (message authentication codes) * KexAlgorithms (key exchange algorithms) * HostKeyAlgorithms (host key algorithms) - Support comma-separated multiple values with autocomplete for each segment - Handle prefix characters (+, -, ^) correctly in autocomplete suggestions - Display helpful hints for syntax and Tab key usage - Include comprehensive algorithm lists for each field type This makes it much easier for users to configure complex SSH algorithm settings without having to remember exact algorithm names.
- Move PubkeyAcceptedAlgorithms from Authentication tab to Advanced tab's Cryptography section - Position after HostKeyAlgorithms for better logical grouping with other algorithm fields - Update all related data structures (ServerFormData, getDefaultValues, getFormData, dataToServer) to reflect new position - Maintain autocomplete functionality and prefix syntax support (+, -, ^) This change groups all cryptographic algorithm settings together in the Advanced tab, making it easier for advanced users to find and configure all security-related algorithms in one place. The Authentication tab now focuses on authentication methods and basic options.
- Implement smart Tab key behavior that navigates to next field when empty - Only trigger autocomplete when there's actual input to complete - Simplify cryptography hint text to save screen space - Return nil from autocomplete when no matches to allow Tab navigation This resolves the Tab key conflict between field navigation and autocomplete selection, providing a more intuitive user experience.
- Add HostbasedAcceptedAlgorithms field to domain model - Support deprecated aliases: HostbasedKeyTypes, HostbasedAcceptedKeyTypes - Add clear comments documenting which options are deprecated since OpenSSH 8.5 - Update mapper, CRUD operations, and SSH command builder accordingly This ensures backward compatibility with older SSH configurations while supporting the newer, more accurate naming conventions introduced in OpenSSH 8.5.
- Add HostbasedAcceptedAlgorithms input field in Advanced tab - Include autocomplete support with algorithm suggestions - Position field after PubkeyAcceptedAlgorithms in Cryptography section - Update form data structures to handle the new field This completes the UI support for hostbased authentication algorithm configuration alongside the existing backend support.
- Add all newly supported SSH config fields to details view - Create extensible structure with logical field grouping - Maintain clean display without group labels for clarity - Apply consistent 2-space indentation throughout - Include fields: ConnectTimeout, ConnectionAttempts, TCPKeepAlive, IdentitiesOnly, AddKeysToAgent, IdentityAgent, ForwardX11, ForwardX11Trusted, port forwarding options, environment settings, PubkeyAcceptedAlgorithms, HostbasedAcceptedAlgorithms, etc. This provides a comprehensive view of all SSH configuration while maintaining a clean, organized display that's easy to extend.
76b152a
to
f64bcac
Compare
- Replace prefix matching with sequential character matching - Allows typing "ct" to match "aes128-ctr", "aes256-ctr", etc. - Typing "3c" matches "3des-cbc", "256gcm" matches "aes256-gcm@openssh.com" - Provides more intelligent filtering for long algorithm lists This makes it much easier to find specific algorithms by typing just a few key characters that appear in sequence within the algorithm name.
…rrectly This commit improves the UX for SSH configuration by: 1. Display SSH defaults in dropdown options as "default (value)" - Users can now see what SSH will use if they don't specify a value - Makes it clear when they're overriding defaults vs using them 2. Fix logic error when switching back to default values - Add removeKVNode function to delete config entries when user selects default - Update logic to remove fields when empty (default selected) instead of keeping old values - Handle Port field specially to remove when set to default (22) - Preserve unknown SSH config fields during updates 3. Add comprehensive SSH defaults map covering: - Connection settings (Port, TCPKeepAlive, Compression, etc.) - Authentication (PubkeyAuthentication, PasswordAuthentication, etc.) - Forwarding (ForwardAgent, ForwardX11, etc.) - Multiplexing (ControlMaster, ControlPath, etc.) - Security and debugging options This ensures users have better visibility into SSH behavior and can cleanly reset values to defaults.
…ter UX - Replace "(comma)" suffix with placeholder text showing actual examples: * Keys: "e.g., ~/.ssh/id_rsa, ~/.ssh/id_ed25519" * Tags: "comma-separated tags" * LocalForward: "e.g., 8080:localhost:80, 3000:localhost:3000" * RemoteForward: "e.g., 80:localhost:8080" * DynamicForward: "e.g., 1080, 1081" * SendEnv: "e.g., LANG, LC_*, TERM" * SetEnv: "e.g., FOO=bar, DEBUG=1" - Replace "(seconds)" suffix with placeholder "seconds": * ConnectTimeout * ServerAliveInterval - Convert InputField creation to use tview.NewInputField() for placeholder support - Update getFormData() to use correct field labels with colons - Make UI more consistent and intuitive by showing examples instead of format hints
…cuts - Show confirmation dialog when exiting form with unsaved changes - Add keyboard shortcuts (S)ave, (D)iscard, (C)ancel for quick navigation - Implement smart change detection using reflection to compare all fields - Skip metadata fields (LastSeen, PinnedAt, SSHCount) in change detection - Preserve metadata fields when saving to avoid data loss - Handle nil vs empty slice differences correctly - Simplify LogLevel handling to use uppercase values per SSH spec
- Return boolean from handleSave() to indicate success/failure - Show form with error message when validation fails from modal - Add handleSaveWrapper() for button callbacks - Ensure users see validation errors instead of silent failure
…reen style - Remove verbose shortcut hints from title bar - Add clean hint bar at bottom with consistent format - Use ^H/^L notation to match main screen convention - Improve visual consistency across UI components
- Move hint bar to screen bottom similar to main screen's status bar layout - Apply same background color (tcell.Color235) as main screen's status bar - Add white color highlighting to keyboard shortcuts in hint text - Separate form panel from hint bar for better visual hierarchy The hint bar now appears at the very bottom of the screen with a darker background, outside the form panel border, providing a consistent UI experience with the main screen.
- Add header field to ServerForm struct with version and commit info - Implement SetVersionInfo method to configure header version data - Update handlers to pass version/commit info when creating server forms - Reorganize layout: header at top, form panel in middle, hint bar at bottom - Fix build order to ensure version info is set before creating header - Ensure visual consistency with main screen by displaying app header
…ontainer When validation fails after clicking Save from the confirmation modal, the error message is now correctly displayed in the form panel's title bar (which has a border) rather than the root container title.
Prevent accidental commits of the compiled binary
7297f04
to
8c2d33d
Compare
8c2d33d
to
8031a03
Compare
Summary
This PR significantly expands LazySSH's SSH configuration support by adding 25+ high-priority fields commonly used by developers and system administrators. The implementation focuses on the most requested features including port forwarding, connection multiplexing, enhanced authentication options, and advanced cryptography settings. Additionally, the UI has been completely reorganized with a tabbed interface for better usability.
What's Changed
🚀 New High-Priority SSH Config Fields
Connection & Proxy Settings:
ConnectTimeout
- Connection timeout in secondsConnectionAttempts
- Number of connection retry attemptsBindAddress
- Bind to specific local address (using native -b flag)BindInterface
- Bind to network interface with auto-detection dropdown (using native -B flag)Port Forwarding (Major Feature):
LocalForward
- Local port forwarding (supports multiple entries)RemoteForward
- Remote port forwarding (supports multiple entries)DynamicForward
- SOCKS dynamic forwarding (supports multiple entries)Authentication & Key Management:
PubkeyAuthentication
- Enable/disable public key authPasswordAuthentication
- Enable/disable password authPreferredAuthentications
- Order of authentication methodsIdentitiesOnly
- Use only specified identity filesAddKeysToAgent
- Auto-add keys to SSH agent (yes/no/ask/confirm)IdentityAgent
- Custom SSH agent socket pathAgent & X11 Forwarding:
ForwardAgent
- Enable SSH agent forwardingForwardX11
- Enable X11 forwarding for GUI applicationsForwardX11Trusted
- Trusted X11 forwardingConnection Multiplexing (Performance Feature):
ControlMaster
- SSH connection multiplexing (yes/no/auto/ask/autoask)ControlPath
- Control socket pathControlPersist
- Keep control connection alive durationConnection Reliability:
ServerAliveInterval
- Server keepalive interval in secondsServerAliveCountMax
- Max server keepalive countCompression
- Enable compressionTCPKeepAlive
- TCP keepalive messagesSecurity & Cryptography:
StrictHostKeyChecking
- Host key verification (yes/no/ask/accept-new)UserKnownHostsFile
- Custom known hosts file pathHostKeyAlgorithms
- Preferred host key algorithmsMACs
- Message Authentication Codes with dropdown (using native -m flag)Ciphers
- Encryption algorithms with dropdown (using native -c flag)KexAlgorithms
- Key exchange algorithms with dropdownCommand Execution:
RequestTTY
- Request TTY allocation (yes/no/force/auto)RemoteCommand
- Execute command on remoteLocalCommand
- Execute command locally after connectionPermitLocalCommand
- Allow LocalCommand executionEnvironment Settings:
SendEnv
- Send environment variables to remote (supports multiple)SetEnv
- Set remote environment variables (supports multiple)Debugging:
LogLevel
- SSH log verbosity (quiet/fatal/error/info/verbose/debug/debug1/debug2/debug3)BatchMode
- Batch mode for non-interactive sessions🎨 UI/UX Improvements
Ctrl+H
/Ctrl+L
- Navigate between tabsCtrl+S
- SaveEsc
- Cancel🔧 Technical Improvements
-m
for MACs instead of-o MACs=
-c
for Ciphers instead of-o Ciphers=
-b
for BindAddress instead of-o BindAddress=
-B
for BindInterface instead of-o BindInterface=
-p
,-i
,-J
,-L
,-R
,-D
,-A
/-a
,-X
/-x
,-Y
,-C
,-t
/-T
/-tt
,-q
/-v
/-vv
/-vvv
Implementation Details
The implementation follows a systematic approach:
Testing
Use Cases
This update enables common SSH workflows:
Breaking Changes
None. All changes are backwards compatible.
Screenshots
The edit form now features a tabbed interface with 6 organized sections:
Closes #46