Hardening the LAN AI Stack: Nginx HTTPS, Air-Gapped Docker Sandboxes & Activity-Aware Suspend
Locking down Open WebUI behind TLS with zero elevated capabilities, enabling offline Python execution for Hermes agents, and engineering multi-signal idle auto-suspend.
Status: Hardened & Power-Managed 🔒⚡
Following the initial multi-user rollout, the local AI node has been hardened end-to-end. Open WebUI (v0.13.5) now runs strictly on loopback behind an Nginx TLS reverse proxy, Hermes agents execute Python verification scripts inside air-gapped --network=none Docker containers, and a custom systemd idle watchdog coordinates VRAM eviction with automatic host suspend.
What We’ve Achieved
- Nginx HTTPS Reverse Proxy & Loopback Isolation: Moved Open WebUI (upgraded to
v0.13.5) offLAN_IP:3000and bound it exclusively to127.0.0.1:8080with zero Linux capabilities. Nginx now terminates TLS 1.2/1.3 onLAN_IP:443with an HTTP-to-HTTPS301redirect on port80, backed by a root-locked (0600) self-signed SAN certificate trusted across LAN client root stores, strictCORS_ALLOW_ORIGINrules, andSecuresession cookies. - Air-Gapped Docker Code Sandboxes: Switched Hermes Agent profiles (
hermes-profile@.service) from chat/RAG-only to isolated Docker execution (python:3.12-slim,docker_network: none, 2 CPUs, 4 GB RAM cap, 300s persistent shell lifetime), enabling agents to write and verify Python calculations offline without risking the host filesystem or network. - Activity-Aware Idle Auto-Suspend: Built a 2-minute
systemdtimer (lan-ai-idle-suspend.timer) paired with Ollama’s 30-minuteOLLAMA_KEEP_ALIVEwindow to suspend the workstation after 60 minutes of true inactivity—checking loaded VRAM models (/api/ps), GPU utilization (>5%), core-scaled CPU load (nproc * 0.40), active SSH sessions, and desktoploginctlIdleHintstate before sleeping. - Startup & Memory Stability Tuning: Tuned Open WebUI’s cgroup memory envelope (
MemoryHigh=4G,MemoryMax=6G), shortenedTimeoutStopSec=15, and addedOMP_NUM_THREADS=2alongsideHF_HUB_OFFLINE=1to eliminate cold-start stalls and cgroup memory reclaim hangs during RAG embedding initialization.
Hardened HTTPS & Sandbox Request Flow
# Zero-capability loopback frontend + air-gapped container execution
LAN Browser (Trusted SAN Cert)
│ HTTP :80 (301) ──▶ HTTPS :443 (Nginx TLS 1.2/1.3, LAN_IP only)
▼
Open WebUI v0.13.5 (127.0.0.1:8080, user: openwebui-svc, zero capabilities)
├──▶ Hermes Profile: alice (127.0.0.1:8642) ──┬──▶ Ollama (127.0.0.1:11434, Gemma 4)
└──▶ Hermes Profile: bob (127.0.0.1:8643) ──┴──▶ Docker Sandbox (python:3.12-slim, --network=none)
Updated Technical Stack
| Layer | Specification |
|---|---|
| TLS Edge Proxy | Nginx (LAN_IP:443 HTTPS + LAN_IP:80 301 redirect, self-signed SAN cert) |
| LAN Frontend | Open WebUI v0.13.5 (127.0.0.1:8080, MemoryMax=6G, strict CORS) |
| Agent Execution | Hermes Agent + Air-Gapped Docker Sandbox (python:3.12-slim, network=none) |
| Inference Backend | Ollama (127.0.0.1:11434/v1, OLLAMA_KEEP_ALIVE=30m, Flash Attention) |
| Power Management | lan-ai-idle-suspend.timer (60m total idle) + sleep.target VRAM eviction |
Lessons from Production Hardening
- Chrome’s Root Store Ignores
~/.pki/nssdbon Linux: Modern Chrome builds manage user root authorities inside Chrome’s own Root Store rather than legacy NSS databases; importingwebui.crtdirectly underchrome://certificate-manager(Local certificates → Trusted certificates) establishes immediate trust without browser warnings. - Scale CPU Load Watchdogs to Core Count: A fixed
0.60load-average threshold represents just 15% utilization on a 4-core desktop and constantly resets idle timers during routineaptorsnapdhousekeeping—scaling tonproc * 0.40(1.60) and logging reset triggers tojournaldeliminates phantom wakefulness. - Coordinate
logindIdleHintwith Screen Blanking: Disabling GNOME’s built-in suspend prevents premature sleep during long inference runs, while keeping a 5-minuteidle-delayensuressystemd-logindflipsIdleHint=yesonce you step away—even without locking the screen.
Moving Forward: Self-Contained & Energy-Efficient
With TLS termination, offline container sandboxing, and activity-aware suspend codified into the idempotent deployment script, the workstation delivers full multi-user agentic capability on demand while drawing near-zero power whenever the household is idle.