install-newt: optional internet access via a Pangolin tunnel, with OIDC sign-in on the dashboard

A plain install is unchanged: LAN-only, dashboard behind the API key. `llmhost install-newt`
is the upgrade path. It installs a pinned, sha256-checked newt as a third user service and
switches the dashboard to an OIDC authorization-code + PKCE sign-in limited to allowed groups
or users. The API still takes the key. Secrets live in 0600 files, never in config.json, a
service file or argv. `llmhost remove-newt` undoes it; setup/update keep it; `logs --newt`
shows the tunnel (and `logs -f` now follows the service it was asked for).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
neil 2026-11-05 21:44:09 -08:00
parent d07a92e5b5
commit e814a2359d
11 changed files with 1155 additions and 26 deletions

View file

@ -1,6 +1,7 @@
"""Background services: systemd --user on Linux, launchd agents on macOS.
Two services: "model" (the inference server) and "web" (dashboard). Both run `llmhost run-<name>`.
Two services: "model" (the inference server) and "web" (dashboard), plus "newt" (the
Pangolin tunnel) only after `llmhost install-newt`. Each runs `llmhost run-<name>`.
"""
import os
import re
@ -10,7 +11,8 @@ from pathlib import Path
from . import paths
NAMES = ("model", "web")
NAMES = ("model", "web") # what setup installs
OPTIONAL = ("newt",) # installed by their own command
def _run(cmd, timeout=60):
@ -32,7 +34,8 @@ def _unit_path(name):
def _systemd_install(name):
desc = {"model": "llm-host model server", "web": "llm-host dashboard"}[name]
desc = {"model": "llm-host model server", "web": "llm-host dashboard",
"newt": "llm-host tunnel (newt)"}[name]
extra = "TimeoutStartSec=1800\nTimeoutStopSec=60\n" if name == "model" else ""
p = _unit_path(name)
p.parent.mkdir(parents=True, exist_ok=True)
@ -104,6 +107,10 @@ def install(name):
_run(["systemctl", "--user", "enable", _unit(name)])
def installed(name):
return (_plist_path(name) if paths.IS_MAC else _unit_path(name)).exists()
def enable_linger():
"""Keep user services running without a login session (Linux). Often allowed without sudo."""
if paths.IS_MAC: