About
Color SSH (csh) is a powerful Rust-based wrapper for SSH that enhances your terminal experience with real-time syntax highlighting and intelligent logging. Built for network engineers, system administrators, and anyone who works extensively with SSH, csh transforms plain SSH output into beautifully highlighted text using customizable, regex-based rules.
Whether you're managing network devices, debugging servers, or analyzing logs, Color SSH makes it easier to spot critical information at a glance. Errors will stand out in red, successful operations will glow green, and everything is configurable to match your workflow.
Features
- π¨ Real-time Syntax Highlighting: Apply regex-based color rules to SSH output as it streams
- βοΈ Highly Configurable: YAML-based configuration with custom color palettes and regex rules
- π Session Logging: Automatic logging of SSH sessions with organized date-based storage
- π Secret Redaction: Automatically remove sensitive data (passwords, keys, hashes) from logs
- π Profile Support: Multiple configuration profiles for different environments (network devices, servers, etc.)
- π― Template Library: Pre-built templates for network equipment and common use cases β community contributions welcome!
- π Hot Reload: Configuration changes apply automatically without restarting
- π Shell Integration: Enhanced tab completion and interactive host selection for Fish and Zsh
- π Drop-in Replacement: Works seamlessly as an SSH wrapperβjust use
cshinstead ofssh
Installation
Using Pre-built Binaries (Recommended)
Download the latest release from GitHub Releases for your platform.
Using Cargo
If you have Rust installed, install directly from crates.io:
From Source
For development or testing the latest changes:
# Clone the repository
# Build the release binary
# Optional: Install to system path
Verify Installation
Usage
Basic Command Structure
Options
| Option | Description |
|---|---|
-d, --debug |
Enable debug mode with detailed logging to ~/.csh/logs/csh.log |
-l, --log |
Enable SSH session logging to ~/.csh/logs/ssh_sessions/ |
-P, --profile <name> |
Use a specific configuration profile |
-h, --help |
Display help information |
-V, --version |
Display version information |
Examples
# Basic SSH connection with syntax highlighting
# Enable session logging
# Use a specific configuration profile
# Debug mode for troubleshooting
# Combine options (logging + profile)
# Pass SSH arguments through
# Non-interactive SSH commands (highlighting disabled automatically)
Session Logs
When using the -l or --log flag, SSH sessions are logged to:
~/.csh/logs/ssh_sessions/YYYY-MM-DD/HOSTNAME.log
Example:
~/.csh/logs/ssh_sessions/2026-01-26/router1.log
Configuration
Configuration File Locations
Color SSH looks for configuration files in the following order:
- Current directory:
./[profile].csh-config.yaml - Home directory:
~/.csh/[profile].csh-config.yaml
If no configuration file exists, Color SSH will automatically create a default configuration at ~/.csh/.csh-config.yaml.
Configuration Profiles
Use profiles to maintain different configurations for different environments:
# Default profile
# Network devices profile
# Usage
Configuration Structure
A configuration file consists of three main sections:
1. Settings
Optional settings for controlling Color SSH behavior:
settings:
show_title: true # Display a colored title banner
debug_mode: false # Enable debug logging
ssh_logging: true # Enable session logging by default
remove_secrets: # Regex patterns to redact from logs
- '9[\s]\$9\$.*' # Juniper type 9 secrets
- 'sha512[\s]\$6\$.*' # SHA-512 hashes
- 'ssh-ed25519[\s].*' # SSH public keys
2. Color Palette
Define reusable colors using hex codes:
palette:
Red: '#c71800'
Green: '#28c501'
Blue: '#5698c8'
Orange: '#e67547'
Gold: '#a35a00'
3. Highlighting Rules
Define regex patterns and their associated colors:
rules:
- description: Highlight successful operations
regex: (?ix)\b(success|ok|connected|up|enabled)\b
color: Green
- description: Highlight errors and failures
regex: (?ix)\b(error|fail|down|disabled|denied)\b
color: Red
- description: Highlight IP addresses
regex: \b(?:\d{1,3}\.){3}\d{1,3}\b
color: Blue
Example: Default Configuration
The default configuration template (templates/default.csh-config.yaml) provides basic keyword highlighting:
palette:
Red: '#c71800'
Green: '#28c501'
Blue: '#5698c8'
rules:
- description: Match on good keywords
regex: (?ix)\b(good|up|success|ok|connected)\b
color: Green
- description: Match on neutral keywords
regex: (?ix)\b(neutral|info|status)\b
color: Blue
- description: Match on bad keywords
regex: (?ix)\b(down|error|disabled|fail|denied)\b
color: Red
Example: Network Devices Configuration
For network engineers, the templates/network.csh-config.yaml template provides extensive highlighting for Cisco and other network devices (Reference the actual file for a detailed config):
settings:
remove_secrets:
- '9[\s]\$9\$.*' # Juniper secrets
- 'sha512[\s]\$6\$.*' # Password hashes
- '7[\s][0-9]{2}[0-9A-Fa-f]+$' # Cisco type 7
show_title: true
ssh_logging: true
palette:
Orange: '#e67547'
Aqua: '#00e0d1'
Gold: '#a35a00'
Green: '#28c501'
Red: '#c71800'
rules:
- description: Cisco enable mode prompt
regex: (\S+)#
color: Orange
- description: Cisco user mode prompt
regex: (\S+)>
color: Gold
- description: Interface names
regex: (?ix)\b(GigabitEthernet|FastEthernet|Vlan|Port-channel)\d+(/\d+)*(\.\d+)?\b
color: Green
Regex Tips
Color SSH uses Rust's regex crate with support for:
- Case-insensitive matching: Use
(?i)flag - Extended mode (ignore whitespace): Use
(?x)flag - Multi-line patterns: Use
|for multi-line regex blocks in YAML - Word boundaries: Use
\bto match whole words - Groups: Use
()for capturing groups
Example of a well-structured rule:
- description: Match Cisco interface types
regex: |
(?ix) # Case-insensitive, extended mode
\b # Word boundary
(gigabitethernet|gi|
tengigabitethernet|te|
fastethernet|fa)
\d+(/\d+)*(\.\d+)? # Port numbers
\b # Word boundary
color: Green
Shell Completion
Color SSH includes advanced shell completion features for Fish and Zsh shells, including:
- Tab completion for SSH hosts from your
~/.ssh/config - Interactive host selection with fuzzy finding (fzf)
- Host descriptions and previews
- Support for SSH config
Includedirectives
For detailed installation and usage instructions, see the Shell Completion README.
Contributing
Contributions are welcomed! Here's how to get started:
1. Fork and Clone
2. Create a Feature Branch
3. Make Your Changes
- Write clean, idiomatic Rust code
- Add tests for new functionality
- Update documentation as needed
- Follow existing code style and conventions
4. Test Your Changes
# Run tests
# Build and test locally
# Run linter
# Format code
5. Commit and Push
6. Open a Pull Request
- Provide a clear description of your changes
- Reference any related issues
- Ensure CI/CD checks pass
Contribution Ideas
- π¨ New configuration templates for specific platforms
- π Bug fixes and performance improvements
- π Documentation enhancements
- β¨ New features β check the roadmap or propose your own ideas
- π§ͺ Additional test coverage
Code of Conduct
Please be respectful and constructive. We're building this together!
License
This project is licensed under the MIT License.
MIT License
Copyright (c) 2025 Karsyboy
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Roadmap
- π Coming Soon