You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(#89): drop HAPROXY_AGENT_CONSOLE_ENABLED — per-box toggle is the sole gate (#137)
The two-layer "agent env var AND dashboard per-box flag" gate was
friction without proportionate security benefit for the single-operator
homelab case this is built for. The agent's API key already grants full
administrative control of the box (logs, systemd, restarts, package
management); the marginal exposure of also exposing the console
endpoints by default is small.
Simplifies the enable path to one click: flip the "Remote console"
checkbox on the box edit page. No agent-side restart, no env-var
plumbing, no per-host configuration management work.
Agent changes:
- internal/framework/config/config.go: drop ConsoleEnabled field +
HAPROXY_AGENT_CONSOLE_ENABLED env-var read
- internal/api/server.go: drop ConsoleEnabled from ServerConfig;
always construct the console handler and mount its routes
- cmd/gearbox-agent/main.go: drop the conditional startup log;
replace with a single Info line noting the surface is mounted
and that the per-box opt-in is dashboard-side
- internal/api/server_test.go: replace
TestNewServer_ConsoleDisabled_RoutesReturn404 (premise gone) with
TestNewServer_ConsoleRoutesAlwaysMounted, which pins that all
three console routes exist and that each is behind its
appropriate auth (API key for token + capabilities, single-use
token for WS — verified by 401 on token-less call)
- internal/api/console/capabilities.go: drop stale env-var
reference in the Enabled-field comment
Dashboard changes:
- internal/framework/templates/pages/haproxy_settings.templ:
trim the "Requires HAPROXY_AGENT_CONSOLE_ENABLED=true on the
agent" clause from the toggle's help text; keep the
box_console:connect mention with "non-admin users" framing
(admins get the permission for free via the IsAdmin shortcut)
- internal/framework/database/servers.go: rewrite ConsoleEnabled
field doc to drop the now-misleading "belt and suspenders" framing
- internal/framework/handler/api_console.go: rewrite comment on
the per-box check for the same reason
Docs:
- docs/console-setup.md: replace the per-mode "set env var, restart"
instruction with a single "Enable for a box" section pointing at
the dashboard toggle. Adds an IMPORTANT note that the API key
alone is sufficient to use the console — matching the existing
trust model, surfaced explicitly. Removes
HAPROXY_AGENT_CONSOLE_ENABLED from the Mode A/B.1/B.2 examples.
Troubleshooting table updates: "/api/v1/console/* returns 404"
now means the agent build predates this feature, not a flipped
flag. Adds a new row for "capabilities returns 404 from the
dashboard" → "flip the per-box toggle."
- docs/security-review/console-threat-model.md: rewrite the
"Stolen agent API key" section to be honest about the new
posture — API key alone is enough to open a session directly
against the agent; the dashboard's per-box toggle only gates
the dashboard path. Adds a residual-risk entry making this
explicit. Drops two stale residuals (InsecureSkipVerify on
the WS dialer + fixed idle timeout — both resolved in #127).
Tests: full agent suite + dashboard handler/database/agent suites
race-clean; markdownlint clean on both docs.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
| `/api/v1/console/*` returns 404 | Agent has console disabled | Set `HAPROXY_AGENT_CONSOLE_ENABLED=true` and restart |
228
+
| `/api/v1/console/*` returns 404 | Agent build predates this feature | Update agent to a build that includes #127 / post-#89 |
229
+
| `/api/v1/console/capabilities` returns 404 from the dashboard | Per-box `console_enabled` toggle is off | Flip on at *Settings → Boxes → \<box\> → Edit* |
216
230
| `console icon missing on Bx tile` | User lacks `box_console:connect` | Grant via Settings → Users → Permissions |
217
231
| `"Failed to open console session"` in browser | Agent unreachable, or token exchange failed | Check agent logs, network from dashboard host to agent |
218
232
| `nsenter: namespaces unreachable` | Container missing `pid:host` or `privileged` | Add both to compose / k8s manifest |
0 commit comments