▀▀█▀▀ █ █ █▄ █ █▄ █ █▀▀ █ █▀▀ █▀█ █▀█ █▀▀ █▀▀
█ █ █ █ ▀█ █ ▀█ █▀▀ █ █▀ █ █ █▀█ █ █ █▀▀
█ ▀▀ █ █ █ █ ▀▀▀ ▀▀▀ █ ▀▀▀ █ █ ▀▀▀ ▀▀▀
The Ultimate Single-File SSH Tunnel Manager
One script. Every tunnel type. Full TUI. Live dashboard.
SOCKS5 • Local Forward • Remote Forward • Jump Hosts • TLS Obfuscation • Telegram Bot • Kill Switch • DNS Leak Protection
Quick Start
One-line install:
curl -fsSL https://raw.githubusercontent.com/SamNet-dev/tunnelforge/main/tunnelforge.sh -o tunnelforge.sh && sudo bash tunnelforge.sh install
Or clone the repo:
git clone https://github.com/SamNet-dev/tunnelforge.git
cd tunnelforge
sudo bash tunnelforge.sh install
Launch the interactive menu:
tunnelforge menu
Or use CLI directly:
tunnelforge create # Create your first tunnel
tunnelforge start my-tunnel # Start it
tunnelforge dashboard # Watch it live
Interactive TUI — manage tunnels, security, services, and more from a single menu
Why TunnelForge?
Most SSH tunnel tools are either too simple (just a wrapper around ssh -D) or too complex (requiring Docker, Go, Python, or a dozen config files). TunnelForge is different:
|
TunnelForge |
Others |
| Installation |
Single bash file, zero dependencies |
Python/Go/Node.js + package managers |
| Interface |
Full TUI menu + CLI + live dashboard |
CLI-only or web UI requiring a browser |
| Security |
DNS leak protection, kill switch, audit scoring |
Basic SSH only |
| Obfuscation |
TLS wrapping + PSK to bypass DPI/censorship |
Not available |
| Monitoring |
Real-time sparkline bandwidth graphs |
Log files |
| Notifications |
Telegram bot with remote commands |
None |
| Persistence |
Auto-generated systemd services |
Manual configuration |
| Education |
Built-in Learn menu with diagrams |
External docs |
| Client Sharing |
One-click generated scripts (Linux + Windows) |
Manual setup |
TunnelForge is the most complete SSH tunnel manager available as a single file.
Features Overview
Tunnel Management
- SOCKS5 Dynamic Proxy (
-D) — Route all traffic through SSH server
- Local Port Forwarding (
-L) — Access remote services locally
- Remote/Reverse Forwarding (
-R) — Expose local services remotely
- Jump Host / Multi-Hop (
-J) — Chain through bastion servers
- AutoSSH Integration — Automatic reconnection on drop
- ControlMaster Multiplexing — Reuse SSH connections
- Multi-tunnel Support — Run dozens of tunnels simultaneously
Security
- DNS Leak Protection — Rewrites resolv.conf + locks with
chattr
- Kill Switch — iptables rules block all traffic if tunnel drops (IPv4 + IPv6)
- 6-Point Security Audit — Scored assessment of your tunnel security posture
- SSH Key Generation — Create ed25519, RSA, or ECDSA keys
- SSH Key Deployment — One-command deploy to remote servers
- Host Fingerprint Verification — Verify server identity before connecting
- Server Hardening — Automated sshd, firewall, fail2ban, sysctl configuration
Monitoring & Dashboard
- Live TUI Dashboard — Real-time tunnel status with auto-refresh
- Sparkline Bandwidth Graphs — ASCII sparklines (▁▂▃▄▅▆▇█) for RX/TX
- Traffic Counters — Total bytes transferred per tunnel
- Uptime Tracking — Per-tunnel uptime display
- Connection Quality — Latency measurement with color-coded indicators
- Speed Test — Built-in download speed test through tunnel
- Pagination — Navigate across pages when running many tunnels
Telegram Bot
- Real-time Alerts — Start, stop, fail, reconnect notifications
- Remote Commands —
/tf_status, /tf_list, /tf_ip, /tf_config and more
- Periodic Reports — Scheduled status reports to your phone
- Client Sharing — Send connection scripts + PSK via Telegram
- SOCKS5 Routing — Bot works through your tunnel when Telegram is blocked
TLS Obfuscation (Anti-Censorship)
- Outbound TLS Wrapping — SSH traffic disguised as HTTPS via stunnel
- Inbound PSK Protection — SOCKS5 listener secured with Pre-Shared Key
- Client Script Generator — Auto-generate connect scripts for Linux + Windows
- One-Click Server Setup — Automated stunnel installation and configuration
- DPI Bypass — Traffic appears as normal HTTPS on port 443
System Integration
- Systemd Service Generator — Auto-create hardened unit files
- Backup & Restore — Full configuration backup with rotation
- Server Setup Wizard — Harden a fresh server for receiving tunnels
- Profile Management — Create, edit, delete, import tunnel profiles
- Log Management — Per-tunnel logs with rotation
- Clean Uninstall — Complete removal of all files, services, and configs
Built-in Education
- Learn Menu — 9 interactive lessons on SSH tunneling concepts
- Scenario Examples — Step-by-step real-world use cases with diagrams
- ASCII Diagrams — Visual traffic flow for every tunnel type
Tunnel Types Explained
SOCKS5 Dynamic Proxy (-D)
Route all your TCP traffic through a remote SSH server. Your traffic appears to originate from the server's IP address.
┌──────────┐ ┌──────────┐ ┌──────────┐
│ Client │ SSH │ SSH │ Direct │ Target │
│ ├─────────►│ Server ├─────────►│ Website │
│ :1080 │ Encrypted│ │ │ │
└──────────┘ └──────────┘ └──────────┘
▲
Browser
SOCKS5
Use cases: Private browsing, bypass geo-restrictions, hide your IP, route traffic through a different country.
tunnelforge create # Select "SOCKS5 Proxy" → set port 1080
tunnelforge start my-proxy
# Configure browser: SOCKS5 proxy → 127.0.0.1:1080
curl --socks5-hostname 127.0.0.1:1080 https://ifconfig.me
Local Port Forwarding (-L)
Access a remote service as if it were running locally. Map a local port to a service behind the SSH server.
┌──────────┐ ┌──────────┐ ┌──────────┐
│ Client │ SSH │ SSH │ Local │ MySQL │
│ ├─────────►│ Server ├─────────►│ :3306 │
│ :3306 │ Encrypted│ │ Network │ │
└──────────┘ └──────────┘ └──────────┘
▲
mysql -h
127.0.0.1
Use cases: Access remote databases, internal web apps, admin panels behind firewalls.
tunnelforge create # Select "Local Forward" → local 3306 → remote db:3306
tunnelforge start db-tunnel
mysql -h 127.0.0.1 -P 3306 -u admin -p
Remote/Reverse Forwarding (-R)
Expose a local service to the outside world through a remote SSH server. Users connect to the server and reach your local machine.
┌──────────┐ ┌──────────┐ ┌──────────┐
│ Local │ SSH │ SSH │ Public │ Users │
│ Dev App │◄────────►│ Server │◄─────────│ on Web │
│ :3000 │ Encrypted│ :9090 │ │ │
└──────────┘ └──────────┘ └──────────┘
Use cases: Webhook development, share local app for testing, NAT traversal, demo to clients.
tunnelforge create # Select "Remote Forward" → remote 9090 ← local 3000
tunnelforge start dev-share
# Others access: http://your-server:9090
Jump Hosts / Multi-Hop (-J)
Reach servers behind multiple layers of firewalls by chaining through intermediate SSH servers.
┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐
│ Client │────►│ Bastion │────►│ Jump 2 │────►│ Target │
│ │ SSH │ Server │ SSH │ Server │ SSH │ Server │
└──────────┘ └──────────┘ └──────────┘ └──────────┘
Use cases: Corporate networks, multi-tier architectures, isolated environments, high-security zones.
tunnelforge create # Select "Jump Host" → jumps: admin@bastion:22
tunnelforge start corp-tunnel
Installation
Requirements
| Requirement |
Details |
| OS |
Linux (Ubuntu, Debian, CentOS, Fedora, Arch, Alpine) |
| Bash |
4.3 or higher |
| Privileges |
Root access for installation |
| SSH |
OpenSSH client (pre-installed on most systems) |
| Optional |
autossh (auto-reconnect), stunnel (TLS obfuscation), sshpass (password auth) |
Install
# Option 1: Git clone
git clone https://github.com/SamNet-dev/tunnelforge.git
cd tunnelforge
sudo bash tunnelforge.sh install
# Option 2: Direct download
curl -fsSL https://raw.githubusercontent.com/SamNet-dev/tunnelforge/main/tunnelforge.sh -o tunnelforge.sh
sudo bash tunnelforge.sh install
Verify Installation
tunnelforge version
# TunnelForge v1.0.0
Directory Structure
After installation, TunnelForge creates:
/opt/tunnelforge/
├── tunnelforge.sh # Main script
├── config/
│ └── tunnelforge.conf # Global configuration
├── profiles/
│ └── *.conf # Tunnel profiles
├── pids/ # Running tunnel PIDs
├── logs/ # Per-tunnel log files
├── backups/ # Configuration backups
├── data/
│ ├── bandwidth/ # Bandwidth history (sparklines)
│ └── reconnects/ # Reconnect statistics
└── sockets/ # SSH ControlMaster sockets
A symlink is created at /usr/local/bin/tunnelforge for global access.
Quick Examples
Browse Privately via SOCKS5
tunnelforge create
# → Name: private-proxy
# → Type: SOCKS5
# → Server: user@myserver.com
# → Port: 1080
tunnelforge start private-proxy
# Test it
curl --socks5-hostname 127.0.0.1:1080 https://ifconfig.me
# Configure Firefox: Settings → Network → Manual Proxy → SOCKS5: 127.0.0.1:1080
Access a Remote Database
tunnelforge create
# → Name: prod-db
# → Type: Local Forward
# → Server: admin@db-server.internal
# → Local port: 3306 → Remote: localhost:3306
tunnelforge start prod-db
mysql -h 127.0.0.1 -P 3306 -u dbuser -p
Share Your Local Dev Server
tunnelforge create
# → Name: demo-share
# → Type: Remote Forward
# → Server: user@public-vps.com
# → Remote port: 8080 ← Local: localhost:3000
tunnelforge start demo-share
# Share with anyone: http://public-vps.com:8080
Chain Through Jump Hosts
tunnelforge create
# → Name: corp-access
# → Type: Jump Host
# → Jump: admin@bastion.corp.com:22
# → Target: user@internal-server:22
# → SOCKS5 port: 1080
tunnelforge start corp-access
Bypass Censorship with TLS Obfuscation
# First, set up stunnel on your VPS
tunnelforge obfs-setup my-tunnel
# Now SSH traffic is wrapped in TLS on port 443
# DPI sees: normal HTTPS traffic
# Reality: SSH tunnel inside TLS
tunnelforge start my-tunnel
# Share with others
tunnelforge client-script my-tunnel # Generates connect scripts
tunnelforge telegram share my-tunnel # Send scripts via Telegram
CLI Reference
Tunnel Commands
| Command |
Description |
tunnelforge start <name> |
Start a tunnel |
tunnelforge stop <name> |
Stop a tunnel |
tunnelforge restart <name> |
Restart a tunnel |
tunnelforge start-all |
Start all autostart tunnels |
tunnelforge stop-all |
Stop all running tunnels |
tunnelforge status |
Show all tunnel statuses |
tunnelforge dashboard |
Launch live TUI dashboard |
tunnelforge logs [name] |
Tail tunnel logs |
Profile Commands
| Command |
Description |
tunnelforge create |
Create a new tunnel profile (wizard) |
tunnelforge list |
List all profiles |
tunnelforge delete <name> |
Delete a profile |
Security Commands
| Command |
Description |
tunnelforge audit |
Run 6-point security audit |
tunnelforge key-gen [type] |
Generate SSH key (ed25519/rsa/ecdsa) |
tunnelforge key-deploy <name> |
Deploy SSH key to server |
tunnelforge fingerprint <host> [port] |
Verify SSH host fingerprint |
Telegram Commands