No description
  • Go 83.6%
  • HTML 13.4%
  • Dockerfile 3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Will 4e1dcf26fc Initial commit: web-based console terminal
Browser front-end for the lab-r1 (Cisco 2611XM) reverse-telnet console
ports, sibling to console-gw (SSH access):

- server-rendered index, per-console xterm.js page, /ws/<name>
  WebSocket-to-telnet bridge with IAC handling
- optional basic auth via CONSOLE_WEB_USER/CONSOLE_WEB_PASSWORD,
  raw session logging
- multi-stage Dockerfile (distroless nonroot)
2026-08-11 23:57:03 +01:00
cmd/console-web Initial commit: web-based console terminal 2026-08-11 23:57:03 +01:00
internal Initial commit: web-based console terminal 2026-08-11 23:57:03 +01:00
.dockerignore Initial commit: web-based console terminal 2026-08-11 23:57:03 +01:00
.gitignore Initial commit: web-based console terminal 2026-08-11 23:57:03 +01:00
console-web.example.yaml Initial commit: web-based console terminal 2026-08-11 23:57:03 +01:00
Dockerfile Initial commit: web-based console terminal 2026-08-11 23:57:03 +01:00
go.mod Initial commit: web-based console terminal 2026-08-11 23:57:03 +01:00
go.sum Initial commit: web-based console terminal 2026-08-11 23:57:03 +01:00
README.md Initial commit: web-based console terminal 2026-08-11 23:57:03 +01:00

console-web

Browser-based serial console access for the home lab. A Cisco 2611XM router (lab-r1, lab-r1.net.mcda.dev / 10.20.1.70) exposes device console ports as reverse-TELNET on TCP ports 2033+; console-web proxies those telnet consoles over WebSocket into an xterm.js terminal in the browser.

The UI is deliberately minimal: an index page listing the configured consoles (name + description), and per-console pages that are a single full-viewport xterm.js terminal — screenshot placeholder: dark page, one terminal, nothing else.

Sibling project: console-gw offers SSH access to the same backends; console-web is the standalone web alternative. The two are independent deployments.

Build & run

go build ./cmd/console-web
cp console-web.example.yaml console-web.yaml   # edit as needed
./console-web -config ./console-web.yaml

Open http://localhost:8080/ and click a console.

Docker

Multi-stage build: static binary on gcr.io/distroless/static-debian12:nonroot. The image expects the config at /etc/console-web/console-web.yaml and writes session logs under /data (writable by the nonroot user); set log_dir: "/data/sessions" in the config you mount.

docker build -t console-web .
docker run --rm -p 8080:8080 \
  -v "$PWD/console-web.yaml:/etc/console-web/console-web.yaml:ro" \
  -v console-web-sessions:/data \
  -e CONSOLE_WEB_USER=admin \
  -e CONSOLE_WEB_PASSWORD=secret \
  console-web

Config

listen: ":8080"
log_dir: "./sessions"
consoles:
  - name: srx320
    description: "Juniper SRX320 (core-1) console"
    address: "lab-r1.net.mcda.dev:2034"
  - name: c892fsp
    description: "Cisco C892FSP console"
    address: "lab-r1.net.mcda.dev:2033"

Raw backend bytes for each session are logged to <log_dir>/<console>-<yyyymmddThhmmss>-<user>.log.

Auth

console-web is meant to run behind Tailscale on the internal network. If the env vars CONSOLE_WEB_USER and CONSOLE_WEB_PASSWORD are both set, all routes are protected with HTTP basic auth (constant-time comparison). If they are unset, the server serves without auth and logs a startup warning that it should sit behind Tailscale or an authenticating reverse proxy.

Frontend assets

xterm.js and the fit addon are loaded from the jsDelivr CDN with pinned versions (@xterm/xterm@5.5.0, @xterm/addon-fit@0.10.0). For an air-gapped deployment, vendor those files into internal/server/static/ later and serve them locally; the HTML/asset plumbing is already embedded via embed.FS.