Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.
TypeScript browser-shellcontrol-planefile-managerhomelabmobile-firstnextjsptyreactself-hostedserver-managementshadcn-uisysadmintailwindcssterminaltypescriptvpsweb-desktopweb-terminal
fix(gateway): reject active named tunnel switches
Rahmanb0eb0cc2e2f7
diff --git a/README.md b/README.mdindex 45eecc12..562ae5a6 100644--- a/README.md+++ b/README.md@@ -224,6 +224,8 @@ For a stable domain, keep MSO on loopback and make the public origin explicit:mso gateway domain set https://mso.example.com# create/configure the named Cloudflare Tunnel using the example printed above, then:mso gateway start --config ~/.cloudflared/config.yml --tunnel mso++If another gateway is already active, stop it first with `mso gateway stop`. MSO refuses to silently ignore explicit named-tunnel arguments or switch tunnel modes underneath an active endpoint.mso web```diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.mdindex d6fdcb82..da460bc5 100644--- a/docs/CHANGELOG.md+++ b/docs/CHANGELOG.md@@ -13,6 +13,7 @@ this is the *what*, and it is what Settings → About shows as “What's new”.**Fixed**+- `gateway` reject active named tunnel switches- `gateway` serialize runtime recovery and updates- `gateway` close final lifecycle boundaries- `gateway` close tunnel fork signal racediff --git a/docs/INSTALL.md b/docs/INSTALL.mdindex fd356b7e..23319a8b 100644--- a/docs/INSTALL.md+++ b/docs/INSTALL.md@@ -199,6 +199,8 @@ token on the command line:```bashmso gateway start --config ~/.cloudflared/config.yml --tunnel mso++If another gateway is already active, stop it first with `mso gateway stop`. MSO refuses to silently ignore explicit named-tunnel arguments or switch tunnel modes underneath an active endpoint.mso web```diff --git a/scripts/lib/gateway-tunnel.sh b/scripts/lib/gateway-tunnel.shindex 765410a1..72e05c4d 100644--- a/scripts/lib/gateway-tunnel.sh+++ b/scripts/lib/gateway-tunnel.sh@@ -156,10 +156,18 @@ gateway_cleanup_failed_start() {}gateway_cmd_start_locked() {- local state active rc- if active="$(gateway_active_state)"; then gateway_reconcile_active_tunnel "$active"; return 0; else rc=$?; fi+ local state active rc requested_named=false+ if [ -n "${GATEWAY_CONFIG:-}${GATEWAY_TUNNEL:-}" ]; then+ gateway_validate_named_tunnel+ requested_named=true+ fi+ if active="$(gateway_active_state)"; then+ [ "$requested_named" != true ] \+ || gateway_fail "gateway is already active; run: mso gateway stop — then retry the named tunnel start"+ gateway_reconcile_active_tunnel "$active"+ return 0+ else rc=$?; fi[ "$rc" = 1 ] || return "$rc"- [ -z "$GATEWAY_CONFIG$GATEWAY_TUNNEL" ] || gateway_validate_named_tunnelgateway_resolve_cloudflaredstate="$(gateway_state_read)"diff --git a/scripts/mso-gateway-boundaries.test.ts b/scripts/mso-gateway-boundaries.test.tsindex 6f75f744..ad37a5e0 100644--- a/scripts/mso-gateway-boundaries.test.ts+++ b/scripts/mso-gateway-boundaries.test.ts@@ -75,6 +75,26 @@ esac}});+ it("does not silently ignore named-tunnel arguments while another gateway is active", () => {+ const f = fixture();+ run(["start"], f.baseEnv);+ const credentials = path.join(f.dir, "switch-tunnel.json");+ fs.writeFileSync(credentials, "{}\n", { mode: 0o600 });+ const config = path.join(f.dir, "switch-tunnel.yml");+ fs.writeFileSync(config, `tunnel: fixture\ncredentials-file: ${credentials}\ningress:\n - hostname: mso.example.test\n service: http://127.0.0.1:4005\n - service: http_status:404\n`, { mode: 0o600 });+ const before = JSON.parse(fs.readFileSync(path.join(f.state, "state.json"), "utf8")) as { mode: string; tunnelIdentity: { pid: number } };+ const out = spawnSync(GATEWAY, ["start", "--config", config, "--tunnel", "fixture"], {+ encoding: "utf8", env: { ...f.baseEnv, OS_PUBLIC_ORIGIN: "https://mso.example.test" },+ });+ expect(out.status).not.toBe(0);+ expect(out.stderr).toContain("gateway is already active");+ expect(out.stderr).toContain("mso gateway stop");+ const after = JSON.parse(fs.readFileSync(path.join(f.state, "state.json"), "utf8")) as { mode: string; tunnelIdentity: { pid: number } };+ expect(after.mode).toBe("temporary");+ expect(after.tunnelIdentity.pid).toBe(before.tunnelIdentity.pid);+ run(["stop"], f.baseEnv);+ });+it("uses kernel flock locks instead of stale-directory reclamation", () => {for (const name of ["gateway-lock.sh", "update-state.sh"]) {const source = fs.readFileSync(path.join(ROOT, "scripts/lib", name), "utf8");