A Go CLI tool that signs SSH keys with HashiCorp Vault and uses signed certificates for SSH authentication. The tool acts as a wrapper around SSH, providing seamless certificate-based authentication through Vault.
- Multiple Authentication Methods: Support for Token, Username/Password, LDAP, and OIDC authentication
- Username-based Roles: Automatically uses SSH username as Vault role (matches
vault write ssh-client-signer/sign/usernamepattern) - Multi-User Support: Different users can have different SSH keys and Vault roles
- Automatic Certificate Management: Validates and renews certificates automatically
- SSH Compatibility: Works like regular SSH with additional Vault integration
- Certificate Caching: Reuses valid certificates until expiration
- Comprehensive Logging: Debug and verbose logging for troubleshooting
vssh provides multiple installation methods to suit different preferences and environments.
curl -fsSL https://raw.githubusercontent.com/ncecere/vssh/main/install.sh | bashiwr -useb https://raw.githubusercontent.com/ncecere/vssh/main/install.ps1 | iexDownload the appropriate binary for your platform from the latest release:
# AMD64 (Intel/AMD 64-bit)
curl -L https://github.com/ncecere/vssh/releases/latest/download/vssh-v0.1.0-linux-amd64 -o vssh
chmod +x vssh
sudo mv vssh /usr/local/bin/
# ARM64 (ARM 64-bit)
curl -L https://github.com/ncecere/vssh/releases/latest/download/vssh-v0.1.0-linux-arm64 -o vssh
chmod +x vssh
sudo mv vssh /usr/local/bin/# Intel Mac
curl -L https://github.com/ncecere/vssh/releases/latest/download/vssh-v0.1.0-darwin-amd64 -o vssh
chmod +x vssh
sudo mv vssh /usr/local/bin/
# Apple Silicon (M1/M2)
curl -L https://github.com/ncecere/vssh/releases/latest/download/vssh-v0.1.0-darwin-arm64 -o vssh
chmod +x vssh
sudo mv vssh /usr/local/bin/# AMD64 (Intel/AMD 64-bit)
Invoke-WebRequest -Uri "https://github.com/ncecere/vssh/releases/latest/download/vssh-v0.1.0-windows-amd64.exe" -OutFile "vssh.exe"
# ARM64 (ARM 64-bit)
Invoke-WebRequest -Uri "https://github.com/ncecere/vssh/releases/latest/download/vssh-v0.1.0-windows-arm64.exe" -OutFile "vssh.exe"
# Add to PATH (optional)
$env:PATH += ";$(Get-Location)"If you have Go installed, you can install vssh directly:
# Install latest version
go install github.com/ncecere/vssh@latest
# Install specific version
go install github.com/ncecere/vssh@v0.1.0If you have GitHub CLI installed:
# Download latest release
gh release download -R ncecere/vssh
# Download specific version
gh release download v0.1.0 -R ncecere/vsshFor developers who want to build from source:
git clone https://github.com/ncecere/vssh.git
cd vssh
go mod download
go build -o vssh
sudo mv vssh /usr/local/bin/After installation, verify vssh is working:
# Check version
vssh version
# Show help
vssh --help
# Initialize configuration
vssh init- Access to a HashiCorp Vault server with SSH secrets engine enabled
- SSH client installed on your system
- SSH key pair generated (
ssh-keygen -t rsaorssh-keygen -t ed25519)
To upgrade to a newer version:
# Linux/macOS
curl -fsSL https://raw.githubusercontent.com/ncecere/vssh/main/install.sh | bash
# Windows
iwr -useb https://raw.githubusercontent.com/ncecere/vssh/main/install.ps1 | iexgo install github.com/ncecere/vssh@latestDownload the new binary and replace the existing one following the manual installation steps above.
# Remove binary
sudo rm /usr/local/bin/vssh
# Remove configuration (optional)
rm -rf ~/.config/vssh
# Remove cached certificates (optional)
rm -f ~/.ssh/vault_signed_*.pub# Remove binary (adjust path as needed)
Remove-Item "$env:LOCALAPPDATA\vssh\bin\vssh.exe"
# Remove from PATH if added manually
# Edit environment variables through System Properties
# Remove configuration (optional)
Remove-Item -Recurse "$env:USERPROFILE\.config\vssh"
# Remove cached certificates (optional)
Remove-Item "$env:USERPROFILE\.ssh\vault_signed_*.pub"-
Initialize configuration:
vssh init
-
Edit the configuration file at
~/.config/vssh/config.yaml:vault: address: "https://your-vault-server.com" auth_method: "ldap" # or token, userpass, oidc ssh: key_directory: "~/.ssh" certificate_ttl: "4h" signing_engine: "ssh-client-signer"
-
Connect to a server:
vssh user@server.com
vssh [flags] [user@]hostname [command]| Flag | Short | Description | Example |
|---|---|---|---|
--config |
Custom config file path | --config /path/to/config.yaml |
|
--verbose |
-v |
Enable verbose output | vssh -v user@server.com |
--debug |
-d |
Enable debug output | vssh --debug user@server.com |
--help |
-h |
Show help information | vssh --help |
| Flag | Short | Description | Example |
|---|---|---|---|
--port |
-p |
Port to connect to | vssh -p 2222 user@server.com |
--identity |
-i |
Identity (private key) file | vssh -i ~/.ssh/custom_key user@server.com |
--ipv4 |
-4 |
Force IPv4 addresses only | vssh -4 user@server.com |
--ipv6 |
-6 |
Force IPv6 addresses only | vssh -6 user@server.com |
vssh init # Create default config file
vssh init --help # Show init command help# Connect to server with username
vssh user@server.com
# Connect using current system username
vssh server.com
# Run a single command
vssh user@server.com "ls -la /home"
# Interactive session with debug logging
vssh --debug user@server.com# Custom port
vssh -p 2222 user@server.com
# Custom identity file
vssh -i ~/.ssh/custom_key user@server.com
# Force IPv4
vssh -4 user@server.com
# Combine multiple options
vssh --debug -p 2222 -4 user@server.com "uptime"The configuration file is located at ~/.config/vssh/config.yaml. You can specify a custom location with the --config flag.
# Vault server configuration
vault:
address: "https://vault.example.com:8200"
auth_method: "ldap" # token, userpass, ldap, oidc
namespace: "my-namespace" # Optional: Vault namespace
# Token authentication
token:
token_path: "~/.vault-token" # Path to Vault token file
# Username/Password authentication
userpass:
username: "your-username" # Optional: can be prompted
mount: "userpass" # Optional: auth mount path
# LDAP authentication
ldap:
username: "your-username" # Optional: can be prompted
mount: "ldap" # Optional: auth mount path
# OIDC authentication
oidc:
role: "your-oidc-role" # Required for OIDC
mount: "oidc" # Optional: auth mount path
# SSH configuration
ssh:
key_directory: "~/.ssh" # Directory containing SSH keys
certificate_ttl: "4h" # Certificate validity period
signing_engine: "ssh-client-signer" # Vault SSH secrets engine mount
# Per-user SSH key configuration (optional)
users:
user1:
private_key: "~/.ssh/user1_rsa" # Path to user's private key
vault_role: "custom-role" # Optional: override username-based role
user2:
private_key: "~/.ssh/user2_rsa"
vault_role: "user2-special-role"
# Enable debug logging globally
debug: false| Option | Type | Required | Description | Default |
|---|---|---|---|---|
address |
string | Yes | Vault server URL | - |
auth_method |
string | Yes | Authentication method | token |
namespace |
string | No | Vault namespace | - |
Token Authentication (default)
vault:
auth_method: "token"
token:
token_path: "~/.vault-token" # Path to token fileUsername/Password Authentication
vault:
auth_method: "userpass"
userpass:
username: "your-username" # Optional: prompted if not provided
mount: "userpass" # Optional: defaults to "userpass"LDAP Authentication
vault:
auth_method: "ldap"
ldap:
username: "your-username" # Optional: prompted if not provided
mount: "ldap" # Optional: defaults to "ldap"OIDC Authentication
vault:
auth_method: "oidc"
oidc:
role: "your-oidc-role" # Required
mount: "oidc" # Optional: defaults to "oidc"| Option | Type | Required | Description | Default |
|---|---|---|---|---|
key_directory |
string | Yes | SSH keys directory | ~/.ssh |
certificate_ttl |
duration | Yes | Certificate validity | 4h |
signing_engine |
string | Yes | Vault SSH engine mount | ssh-client-signer |
Per-user configuration for custom SSH keys and Vault roles:
| Option | Type | Required | Description |
|---|---|---|---|
private_key |
string | Yes | Path to user's private key |
vault_role |
string | No | Custom Vault role (defaults to username) |
- Load Configuration: Read settings from
~/.config/vssh/config.yaml - Parse SSH Target: Extract username and hostname from command arguments
- Vault Authentication: Authenticate using configured method (token/userpass/ldap/oidc)
- Token Caching: Cache valid tokens for reuse
- Certificate Check: Verify if existing certificate is still valid
- Key Signing: Request new certificate from Vault if needed using username as role
- SSH Execution: Connect using signed certificate and private key
- Naming Convention: Certificates are named
vault_signed_{username}.pub - Role Mapping: Username is used as Vault role (e.g.,
user1@server.com→ roleuser1) - Automatic Renewal: Certificates are renewed when they expire or have <5 minutes remaining
- Validation: Certificates are validated before each use
- Storage: Certificates are stored in the configured SSH key directory
vssh integrates with Vault's SSH secrets engine:
# Equivalent Vault CLI command
vault write ssh-client-signer/sign/username \
public_key=@~/.ssh/id_rsa.pub \
ttl=4hThe tool automatically:
- Uses the SSH username as the Vault role name
- Reads the corresponding public key
- Requests certificate signing
- Saves the signed certificate
- Uses it for SSH authentication
# Check Vault connectivity
curl -k https://your-vault-server.com/v1/sys/health
# Test authentication manually
vault auth -method=ldap username=your-username
# Enable debug logging
vssh --debug user@server.com# Check certificate validity
ssh-keygen -L -f ~/.ssh/vault_signed_username.pub
# Force certificate renewal by removing existing certificate
rm ~/.ssh/vault_signed_username.pub
vssh user@server.com# Test SSH manually with certificate
ssh -o CertificateFile=~/.ssh/vault_signed_username.pub \
-i ~/.ssh/id_rsa \
user@server.com
# Check SSH server configuration
# Ensure TrustedUserCAKeys is configured on the serverEnable debug logging to troubleshoot issues:
vssh --debug user@server.comDebug output includes:
- Configuration loading
- Vault authentication details
- Certificate validation
- SSH command construction
- Connection attempts
vssh respects standard environment variables:
| Variable | Description |
|---|---|
VAULT_ADDR |
Vault server address (overrides config) |
VAULT_TOKEN |
Vault token (for token auth) |
VAULT_NAMESPACE |
Vault namespace |
USER |
Current username (fallback if not specified) |
- Token Storage: Vault tokens are cached with secure file permissions (0600)
- Private Key Protection: Private keys remain on the local system and are never sent to Vault
- Certificate Lifecycle: Certificates have configurable TTL and are automatically renewed
- Audit Logging: All authentication and signing events are logged by Vault
- Least Privilege: Each user can only sign certificates for their own username role
See DEVELOPMENT.md for detailed development instructions.
git clone https://github.com/ncecere/vssh.git
cd vssh
go mod download
go build -o vssh
./vssh init- README.md - This file, comprehensive user guide
- CONFIG.md - Detailed configuration reference
- DEVELOPMENT.md - Developer setup and build instructions
- CONTRIBUTING.md - Guidelines for contributors
- SECURITY.md - Security policy and vulnerability reporting
- CHANGELOG.md - Version history and release notes
We welcome contributions! Please see our Contributing Guide for details on:
- Setting up the development environment
- Code style guidelines
- Testing requirements
- Pull request process
Quick start for contributors:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes and add tests
- Run tests (
make test) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Security is important to us. If you discover a security vulnerability, please see our Security Policy for responsible disclosure guidelines.
For general security best practices when using vssh, refer to the Security Considerations section above and the Security Policy.
This project is licensed under the MIT License - see the LICENSE file for details.
- Issues: Report bugs and request features on GitHub Issues
- Security: Report security vulnerabilities via our Security Policy
- Documentation: Comprehensive documentation available in the repository
- Community: Join discussions in GitHub Discussions
- Current Version: v0.1.5
- Status: Active development
- Stability: Beta - suitable for testing and development environments
- Platform Support: Linux, macOS, Windows (AMD64, ARM64)
See TASK.md for current development tasks and CHANGELOG.md for version history.
Upcoming features:
- Enhanced error handling and user experience
- Additional authentication methods
- Performance optimizations
- Integration tests
- HashiCorp Vault for the excellent secrets management platform
- Cobra for the CLI framework
- Viper for configuration management
- Logrus for structured logging
- The Go community for excellent tooling and libraries