Box-Konsole hinter MC2-Reverse-Proxy (kein Firewall-Port noetig)
Problem: ttyd auf :7682 war von aussen per ufw geblockt (nur 7681/9001 offen), also im Browser Timeout — und ufw oeffnen braucht sudo, das MC2 hier nicht passwortlos hat. Fix: ttyd bindet jetzt NUR an Loopback (--interface lo, --base-path /console) und wird von MC2 ueber den ohnehin offenen Port 9001 same-origin durchgereicht: - routers/console.py: HTTP-Passthrough (index/token) + WebSocket-Bridge (tty-Subprotokoll auf beiden Seiten) → /console/ + /console/ws. - app.py: console.router VOR dem SPA-Catch-all eingehaengt. - config: BOX_CONSOLE_UPSTREAM (127.0.0.1:7682) + BOX_CONSOLE_PATH (/console/); agent_status liefert box_console_url=/console/ + reachable=Upstream-Check. - deploy/box-console.service: --interface lo --base-path /console. - vite: /console (ws:true) fuer die Dev-Vorschau geproxyt. Kein Firewall-/sudo-Eingriff noetig; Konsole laeuft same-origin zum Dashboard. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -8,13 +8,14 @@ After=network.target
|
||||
# direkte, SSH-artige Zugriff, den das UI als „Konsole" einbettet (iframe). Schwester-Dienst
|
||||
# zum hermes-terminal (das die Agent-CLI zeigt); dieser hier zeigt die nackte Shell.
|
||||
#
|
||||
# SICHERHEIT: --writable + LAN-Bind ohne Auth = dasselbe Trust-Modell wie das Hermes-Terminal
|
||||
# und das MC2-Dashboard (vertrautes Heim-LAN, kein Internet-Exposure). Kein Passwort — bewusst,
|
||||
# analog zum Hermes-Terminal. Für Basic-Auth am ExecStart `--credential <user>:<pass>` ergänzen.
|
||||
# SICHERHEIT: Bindet NUR an Loopback (lo/127.0.0.1) und läuft hinter dem MC2-Reverse-Proxy
|
||||
# (routers/console.py → same-origin /console/ auf dem offenen Port 9001). Port 7682 ist von
|
||||
# außen dicht → keine eigene Firewall-Regel nötig. Kein Passwort — bewusst, gleiches LAN-Trust-
|
||||
# Modell wie das Dashboard/Hermes-Terminal (kein Internet-Exposure).
|
||||
Type=simple
|
||||
# --interface eno1 = LAN-Bind (box-spezifisch; eno1 trägt 192.168.178.151).
|
||||
# --interface lo = nur Loopback. --base-path /console = ttyd bedient /console/* (Reverse-Proxy).
|
||||
# -t = Terminal-Optionen (dunkles Theme passend zum UI).
|
||||
ExecStart=/usr/bin/ttyd --writable --interface eno1 --port 7682 --max-clients 2 --cwd %h -t 'theme={"background":"#0b0f1a"}' /bin/bash -l
|
||||
ExecStart=/usr/bin/ttyd --writable --interface lo --port 7682 --base-path /console --max-clients 2 --cwd %h -t 'theme={"background":"#0b0f1a"}' /bin/bash -l
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
|
||||
|
||||
Reference in New Issue
Block a user