🔐 SSH Tunnel Manager
Manage multiple SSH tunnels with auto-reconnect, health checks and SOCKS5 proxy.

Why SSH Tunnel Manager?
Developers constantly need SSH tunnels to access databases, Redis, and internal services. Manually typing ssh -L commands is error-prone and hard to manage. autossh only handles one tunnel at a time. SSH Tunnel Manager gives you:
- 📋 Config file management — Define all tunnels in one YAML file
- 🔄 Auto-reconnect — Automatically reconnect on connection loss
- 💚 Health checks — Monitor tunnel connectivity and latency
- 🧦 SOCKS5 proxy — Dynamic port forwarding support
- 🔗 Connection pooling — Share SSH connections across multiple tunnels
- 🎨 Colored output — Clear, colored terminal output for tunnel status
Comparison with autossh
| Feature |
SSH Tunnel Manager |
autossh |
| Multiple tunnels |
✅ |
❌ (one at a time) |
| Config file |
✅ YAML |
❌ |
| SOCKS5 proxy |
✅ |
❌ |
| Health checks |
✅ TCP + latency |
✅ TCP only |
| Connection pooling |
✅ |
❌ |
| Remote forwarding |
✅ |
✅ |
| Status dashboard |
✅ |
❌ |
| Environment variables |
✅ |
❌ |
Quick Start
Install
go install github.com/gal111111/ssh-tunnel-manager@latest
Create Config
# Initialize a sample config file
ssh-tunnel-manager add --name mysql --type local --local 3306:localhost:3306 --ssh-host bastion.example.com
Or create tunnels.yaml manually:
tunnels:
- name: mysql
type: local
local_addr: "127.0.0.1:3306"
remote_addr: "localhost:3306"
ssh_host: "bastion.example.com"
ssh_user: "deploy"
ssh_key: "~/.ssh/id_rsa"
- name: redis
type: local
local_addr: "127.0.0.1:6379"
remote_addr: "10.0.0.5:6379"
ssh_host: "bastion.example.com"
ssh_user: "deploy"
ssh_key: "~/.ssh/id_rsa"
- name: socks5
type: dynamic
local_addr: "127.0.0.1:1080"
ssh_host: "bastion.example.com"
ssh_user: "deploy"
ssh_key: "~/.ssh/id_rsa"
CLI Usage
# Start all tunnels
ssh-tunnel-manager start
# Start a specific tunnel
ssh-tunnel-manager start --name mysql
# Stop all tunnels
ssh-tunnel-manager stop
# Check tunnel status
ssh-tunnel-manager status
# Add a new tunnel
ssh-tunnel-manager add --name api --type local --local 8080:internal.api:80 --ssh-host jumpbox
# List all configured tunnels
ssh-tunnel-manager list
Configuration
Environment Variables
Use ${VAR_NAME} or $VAR_NAME syntax in config values:
tunnels:
- name: db
type: local
local_addr: "127.0.0.1:${DB_PORT}"
remote_addr: "${DB_HOST}:5432"
ssh_host: "${BASTION_HOST}"
ssh_user: "${SSH_USER}"
ssh_key: "${SSH_KEY_PATH}"
Auto-Reconnect
tunnels:
- name: mysql
type: local
local_addr: "127.0.0.1:3306"
remote_addr: "localhost:3306"
ssh_host: "bastion.example.com"
auto_reconnect: true # Enable auto-reconnect (default: true)
reconnect_delay: 5s # Delay before reconnect (default: 5s)
max_retries: 0 # Max retries, 0 = unlimited (default: 0)
Health Checks
tunnels:
- name: mysql
# ... other config ...
health_check:
enabled: true # Enable health checks (default: true)
interval: 10s # Check interval (default: 10s)
timeout: 5s # Check timeout (default: 5s)
Examples
See the examples directory for sample configuration files.
License
MIT License. See LICENSE for details.