Self-Host WebSSH to Replace Termius: Zero-Cost Docker SSH & SFTP Bastion
Deploy bifrost0x WebSSH with Docker: browser terminal, WebAuthn Passkeys, persistent background tmux, color diff SFTP, and Tailscale mesh isolation.
Key Takeaways & Prerequisites
- Commercial SaaS clients like Termius Pro cost ~0/month per user to sync SSH hosts and keys to third-party cloud infrastructure. bifrost0x/WebSSH is an Apache-2.0 open-source alternative running in a single lightweight Docker container with zero licensing fees.
- Dual-boundary security model: Browser connects to container via HTTPS/WSS on port 5000, while the container proxies internal SSH on port 22 to target servers, keeping port 22 completely closed from the public Internet.
- Biometric authentication with TouchID/FaceID via WebAuthn Passkeys, indestructible shell sessions backed by auto-attaching tmux, and dual-pane SFTP browsing with color diff review before committing changes.
- Core security rule: Never expose port 5000 directly to the public Internet; always shield the bastion behind Tailscale Mesh VPN or Cloudflare Tunnel with WAF.
Architecture & Execution Flow
- 01 →Web BrowserHTTPS / WSS Port 5000
- 02 →WebSSH BastionIsolated Docker Container
- 03 →Tailscale MeshWireGuard Encrypted
- 04 →Target ServerPort 22 Closed to WAN
Table of Contents
Managing homelab infrastructure or distributed server fleets (VPS, cloud instances) from multiple machines—ranging from personal laptops to office workstations and mobile phones on the go—presents DevOps engineers with a common dilemma:
- Commercial SaaS tools (like Termius Pro): Costing 0/month (~20/year) per seat simply to synchronize host lists, SSH private keys, and terminal snippets across devices on third-party cloud infrastructure. Any vendor compromise immediately puts your infrastructure keys at risk.
- Exposing Port 22 to the Public Internet (Port Forwarding): Bypassing subscription fees by opening port 22 on home routers or cloud firewall security groups exposes systems to hundreds of thousands of automated botnet scans and brute-force attempts daily.
The optimal architectural compromise is self-hosting an in-browser WebSSH Bastion Workspace running inside an isolated Docker container. This guide covers how to deploy bifrost0x/WebSSH—a lightweight Apache-2.0 open-source project featuring modern FIDO2 WebAuthn Passkeys, resilient tmux persistence, and visual dual-pane SFTP management.
1. Dual-Boundary Trust Architecture
The fundamental architectural distinction between direct SSH access and a WebSSH bastion lies in Dual-boundary Network Isolation:
[ Client Browser ] (Laptop, iPhone, Android)
│
│ (1) HTTPS / WSS :5000 (Passkey FIDO2)
▼
[ WebSSH Bastion Container ] (Golang Backend + Xterm.js)
│
│ (2) SSH Port 22 (Internal Docker Network / WireGuard)
▼
[ Target Servers: VPS / Homelab / Database ]
- Outer Boundary (Client ➔ Container): All client interaction occurs through an offline-ready web application built with Vue and Xterm.js. Keystrokes, terminal rendering, and SFTP data transfer stream over secure WebSocket (WSS) tunnels without third-party CDN dependencies.
- Inner Boundary (Container ➔ Target Servers): The WebSSH container acts as the sole internal SSH client, connecting to target nodes over an isolated local Docker network or private WireGuard mesh (Tailscale).
- Security Advantage: Port 22 across all backend servers remains 100% closed to the public Internet, entirely eliminating SSH reconnaissance on Shodan and Censys scanners.
2. Production-Grade Docker Compose Deployment
Written in Go with an embedded SQLite database, bifrost0x/webssh requires no external database services and boots within seconds.
services:
webssh:
image: bifrost0x/webssh:latest
container_name: webssh-bastion
restart: unless-stopped
ports:
# BIND TO LOCALHOST ONLY: Never map 0.0.0.0:5000 to public interfaces!
- "127.0.0.1:5000:5000"
environment:
- TZ=Asia/Tokyo
- MAX_UPLOAD_SIZE=524288000 # 500MB max SFTP upload
volumes:
- ./data:/app/data # Persistent SQLite DB and host credentials
deploy:
resources:
limits:
cpus: "1.00"
memory: 512M
reservations:
cpus: "0.10"
memory: 128M
healthcheck:
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://127.0.0.1:5000/api/health || exit 1"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
3. Biometric Passkey Authentication (WebAuthn)
Traditional web terminals reliant on basic authentication or standard passwords remain susceptible to credential brute-forcing and keyloggers. bifrost0x/webssh mitigates this via native FIDO2 / WebAuthn (Passkey) support:
- Biometric Unlock: Authenticate instantly via TouchID, FaceID, or Windows Hello without typing passwords.
- Hardware Security Keys: Native compatibility with YubiKey and Google Titan security keys over USB and NFC.
- Secondary TOTP 2FA: Time-based 6-digit one-time passcodes as an auxiliary security factor.
- Emergency Recovery Keys: Pre-generated one-time recovery tokens stored safely in your password vault to protect against device loss.
4. Indestructible Sessions with Background tmux
Network drops on cellular connections or accidental browser tab closures commonly terminate active SSH commands via SIGHUP. WebSSH resolves this by integrating directly with background tmux sessions:
- Auto-attaches to persistent sessions upon opening (
tmux new-session -A -s webssh-main). - Long-running builds, database dumps, and monitoring commands (
htop,rsync) continue running uninterrupted even if the browser closes. - Horizontal and vertical split-pane views within a single browser viewport.
5. Dual-Pane SFTP Management and Color Diffs
- Dual-Pane File Explorer: Visual drag-and-drop file transfers between workstation and remote targets.
- Integrated Code Editor: Immediate editing of configuration files like
nginx.confwithout enteringnanoorvim. - Color Diff Inspection: Highlights additions in green and removals in red before committing file changes to disk.
- Automated
.bakRevisions: Generates timestamped backup files prior to overwriting target files, providing zero-friction rollbacks.
6. Defensive Principles: Shielding the Bastion
While Passkeys prevent credential-based intrusions, the underlying HTTP service can still face application-layer vulnerabilities. Maintain strict isolation:
- Bind strictly to loopback: Keep port 5000 bound exclusively to
127.0.0.1. - Shield with Tailscale Mesh VPN (Recommended): Restrict access to authenticated nodes inside your private WireGuard-based Tailnet.
- Cloudflare Zero Trust Access: When accessing from restricted corporate machines where VPN installation is forbidden, route traffic through a secure Cloudflare Tunnel gated behind identity provider validation.
7. Technical Trade-Offs and Limitations
- No X11 GUI Forwarding: Launching remote graphical Linux applications requires a native desktop SSH client.
- No System-wide SOCKS5 Proxy: Operates strictly inside browser sessions; cannot serve as a system-level dynamic proxy (
ssh -D). - Rendering Latency: DOM rendering through Xterm.js introduces marginal millisecond overhead compared to raw native terminal sockets.
8. Feature Comparison Matrix
| Criterion | Termius Pro (SaaS) | Direct Port 22 Exposure | Bifrost0x WebSSH (Docker) |
|---|---|---|---|
| Licensing Cost | ~0/mo (20/yr) | Free | 100% Free & Open Source |
| Key Storage | Third-Party Cloud | Scattered Locally | Self-Hosted on Isolated Volume |
| Port 22 Attack Surface | Exposed WAN Port | Critical Threat (Botnet Scans) | Zero Exposure (Closed to Internet) |
| Authentication | SaaS Password + 2FA | SSH Key / Password | WebAuthn Passkey (TouchID/FaceID) |
| Zero-Install Access | Requires Desktop/Mobile App | Requires SSH Terminal | Any Web Browser (Safari, Chrome) |
| Session Resilience | Client Connection Bound | Terminates on Drop | Persistent Background tmux Sessions |
| SFTP File Explorer | Built into Client | Manual CLI / FileZilla | Dual-Pane + Color Diff + Auto .bak |
9. 60-Second Video Summary
Review the animated architecture overview, biometric login workflow, and SFTP color diff management in this 60-second visual breakdown: