web: allow direct IP dashboard and worker access
agent-review agent review: pass

Remove fixed-host and HTTPS-only deployment requirements so the dashboard
works at the container IP on HTTP port 5187. Validate browser mutations
against the actual request host and retain access keys and CSRF protection.
Ignore legacy public-origin settings and make Proxmox setup hostname-free.
Update D14 and regression coverage for version 1.2.3.

Refs #25
This commit is contained in:
Florian Schmidt
2026-11-15 16:38:19 +01:00
parent f45e065994
commit 480b73d899
19 changed files with 218 additions and 69 deletions
+14 -3
View File
@@ -1,6 +1,7 @@
"""Private guest provisioner, invoked by host.py inside the selected LXC. Not a host entry point."""
import argparse
import hashlib
import ipaddress
import json
import os
from pathlib import Path, PurePosixPath
@@ -178,7 +179,7 @@ def configure(meta, enrollment_key=None):
"profiles": [{"id": p, "accountId": p} for p in providers]}]
json_file(ETC / "server.json", {"accounts": accounts, "machines": machines}, once=True)
atomic(ETC / "server.env", f"FINALTOKEN_SERVER_CONFIG={ETC}/server.json\nFINALTOKEN_SERVER_DATA={SERVER_HOME}/data\n"
f"FINALTOKEN_DASHBOARD_KEY={keys['dashboard']}\nFINALTOKEN_PUBLIC_ORIGIN=https://{meta['domain']}\n"
f"FINALTOKEN_DASHBOARD_KEY={keys['dashboard']}\n"
f"ASPNETCORE_URLS=http://0.0.0.0:5187\nFINALTOKEN_MACHINE_{meta['machineId']}={keys['worker']}\n", once=True)
atomic(ETC / "dashboard-key", keys["dashboard"] + "\n", once=True)
atomic(ETC / "worker-key", keys["worker"] + "\n", once=True)
@@ -315,12 +316,22 @@ def migrate_external_proxy(meta):
return updated
def dashboard_urls():
try:
result = run(["hostname", "-I"], capture=True, check=False)
addresses = [ipaddress.ip_address(value) for value in result.stdout.split()] if result.returncode == 0 else []
return [f"http://{'[' + str(ip) + ']' if ip.version == 6 else ip}:5187"
for ip in addresses if not ip.is_loopback and not ip.is_link_local] or ["http://<container-ip>:5187"]
except (OSError, ValueError):
return ["http://<container-ip>:5187"]
def healthy(services, meta):
for _ in range(20):
live = all(run(["systemctl", "is-active", "--quiet", s], check=False, capture=True).returncode == 0 for s in services)
if live and "finaltoken-server.service" in services:
try:
request = urllib.request.Request("http://127.0.0.1:5187/", headers={"Host": meta["domain"]})
request = urllib.request.Request("http://127.0.0.1:5187/")
with urllib.request.urlopen(request, timeout=2) as response:
live = response.status == 200
except OSError:
@@ -399,7 +410,7 @@ def provision(manifest, archive):
json_file(marker, meta)
install_updater()
if meta["role"] != "worker":
print("Dashboard: https://" + meta["domain"])
print("Dashboard: " + ", ".join(dashboard_urls()))
print("Dashboard key is root-readable at /etc/finaltoken/dashboard-key (not printed).")
print("Official CLI login still requires your browser authorization. No provider credentials were copied.")