Oz

Handmade Coding

Security & Power Engineering • November 29, 2026

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) off LAN_IP:3000 and bound it exclusively to 127.0.0.1:8080 with zero Linux capabilities. Nginx now terminates TLS 1.2/1.3 on LAN_IP:443 with an HTTP-to-HTTPS 301 redirect on port 80, backed by a root-locked (0600) self-signed SAN certificate trusted across LAN client root stores, strict CORS_ALLOW_ORIGIN rules, and Secure session 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 systemd timer (lan-ai-idle-suspend.timer) paired with Ollama’s 30-minute OLLAMA_KEEP_ALIVE window 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 desktop loginctl IdleHint state before sleeping.
  • Startup & Memory Stability Tuning: Tuned Open WebUI’s cgroup memory envelope (MemoryHigh=4G, MemoryMax=6G), shortened TimeoutStopSec=15, and added OMP_NUM_THREADS=2 alongside HF_HUB_OFFLINE=1 to 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/nssdb on Linux: Modern Chrome builds manage user root authorities inside Chrome’s own Root Store rather than legacy NSS databases; importing webui.crt directly under chrome://certificate-manager (Local certificates → Trusted certificates) establishes immediate trust without browser warnings.
  • Scale CPU Load Watchdogs to Core Count: A fixed 0.60 load-average threshold represents just 15% utilization on a 4-core desktop and constantly resets idle timers during routine apt or snapd housekeeping—scaling to nproc * 0.40 (1.60) and logging reset triggers to journald eliminates phantom wakefulness.
  • Coordinate logind IdleHint with Screen Blanking: Disabling GNOME’s built-in suspend prevents premature sleep during long inference runs, while keeping a 5-minute idle-delay ensures systemd-logind flips IdleHint=yes once 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.


Local AI Infrastructure • November 2026

Multi-User LAN AI Agent Stack: Privilege-Isolated Ollama, Hermes & Open WebUI

Scaling from a single-user workstation to a hardened, multi-user LAN AI platform—orchestrated idempotently across three non-sudo Linux service accounts on a 16GB RTX 5060 Ti.

Status: Multi-User LAN Ready 🚀

The local AI node has evolved into a full multi-user LAN agent stack. A single idempotent Bash orchestrator now provisions isolated nologin system accounts for Ollama, per-user Hermes Agent profiles, and Open WebUI—dynamically budgeting 16GB VRAM concurrency and enforcing strict user-level isolation across the home network.

What We’ve Achieved

  • Three-Tier Non-Sudo Privilege Isolation: Split the stack across dedicated, unprivileged /usr/sbin/nologin system users (ollama, hermes-svc, and openwebui-svc) hardened with systemd sandboxing (ProtectSystem=strict, ProtectHome=true, PrivateTmp=true, and NoNewPrivileges=true).
  • Per-User Hermes Agent Profiles: Deployed a parameterized hermes-profile@.service unit where each LAN user gets an isolated profile directory, standalone gateway, localhost-bound port (127.0.0.1:8642+), unique 64-character API key, and configurable tool sandboxing (chat/RAG-only or air-gapped --network=none Docker containers).
  • Dynamic 16GB VRAM Concurrency Budgeting: Configured the orchestrator to automatically compute OLLAMA_NUM_PARALLEL and OLLAMA_CONTEXT_LENGTH from the chosen Gemma 4 model and registered user count, pairing Flash Attention with q8_0 KV cache quantization to prevent VRAM overflow.
  • Private Model Routing & Clean Sleep Hooks: Locked Open WebUI strictly to the LAN interface behind UFW subnet rules with Private per-user model visibility, and added a systemd sleep.target hook that evicts loaded models from VRAM (keep_alive: 0) prior to host suspend.

The Multi-User Architecture

# Privilege-separated LAN request flow (enforced by systemd + UFW)

LAN Client ──▶ Open WebUI (LAN_IP:3000, user: openwebui-svc, Private per-user models) │ ├──▶ Hermes Profile: alice (127.0.0.1:8642, user: hermes-svc) ──┐ └──▶ Hermes Profile: bob (127.0.0.1:8643, user: hermes-svc) ──┼──▶ Ollama (127.0.0.1:11434, user: ollama) └─▶ Gemma 4 12B / 26B on RTX 5060 Ti (16GB)

The Final Technical Stack

Layer Specification
Inference Backend Ollama (127.0.0.1:11434/v1, user: ollama) with Flash Attention & q8_0 KV Cache
Models Gemma 4 12B (100% VRAM, up to 3 parallel slots) & Gemma 4 26B MoE
Agent Layer Hermes Agent (hermes-profile@.service, 127.0.0.1:8642+, user: hermes-svc)
LAN Frontend Open WebUI (LAN:3000, user: openwebui-svc) with Private per-user model ACLs
Orchestration Idempotent Bash + systemd + uv (UV_NO_CONFIG=1) + UFW LAN firewall
Hardware Node Asus B85M-E + 32GB DDR3 + NVIDIA RTX 5060 Ti (16GB VRAM)

Lessons from Multi-User Hardening

  • Cold-Start Latency Beats Peak Batch Throughput on 4 Cores: While vLLM excels in datacenter clusters, CPU-bound torch.compile and FlashInfer JIT builds on a 4-core host added multi-minute startup delays—whereas Ollama's precompiled CUDA binaries start in seconds and expose the exact same /v1 API Hermes expects.
  • Watch Working Directory Traversal Under sudo -u: Switching to a nologin service user with sudo -u <user> -H preserves the caller's PWD; setting UV_NO_CONFIG=1 across PAM, sudoers, and systemd alongside env -C prevents uv from hitting EACCES while probing restricted admin directories.
  • Evict VRAM Before Suspend: Unloading active weights via keep_alive: 0 in a Before=sleep.target unit frees all 16GB VRAM before sleep so the GPU wakes cleanly without broken CUDA contexts.

Moving Forward: Shared Home Lab Intelligence

With privilege-isolated agents, per-user memory, and automated VRAM budgeting running reproducibly from a single script, every user on the LAN now gets a private AI workspace backed by local hardware—with zero cloud dependencies and clean power management.


AI Inference • June 2026

Diffusion Gemma 4 26B on 16GB GPU: OpenClaw Agent Breakthrough

Major breakthrough: Running a diffusion-optimized Gemma 4 26B model on a single 16GB Nvidia GPU as the primary reasoning agent for OpenClaw personal AI assistant.

Status: Production Ready 🚀

We have achieved a significant breakthrough in local AI deployment. The diffusion-tuned Gemma 4 26B model is now fully operational on consumer 16GB Nvidia GPU hardware, serving as the core agent backend for OpenClaw. This enables sophisticated autonomous workflows without relying on massive cloud infrastructure.

What We’ve Achieved

  • Diffusion-Powered Inference: Applied cutting-edge diffusion optimization techniques to efficiently run the 26B parameter model within the tight 16GB VRAM constraints, delivering high-quality, iterative reasoning with excellent token throughput.
  • OpenClaw Agent Integration: Seamlessly wired the model into OpenClaw as the primary agent. The system now leverages advanced 26B-scale reasoning for complex multi-step tasks, tool orchestration, GUI interactions, and persistent autonomous operations across messaging platforms.
  • Memory & Compute Efficiency: Implemented hybrid GPU/CPU offloading and diffusion-step scheduling that prevents OOM while maximizing utilization of the 16GB Blackwell-class GPU and existing 32GB system RAM.
  • Validated End-to-End: Full agent loops tested successfully — from natural language commands via OpenClaw to model inference, tool execution, and response delivery — proving production viability for personal AI agents.

The Final Technical Stack

Layer Specification
Model Diffusion Gemma 4 26B (Optimized for Agentic Workflows)
Agent Logic OpenClaw — Primary Autonomous Agent
GPU / VRAM 16GB Nvidia (Blackwell Architecture, e.g. RTX 5060 Ti)
Inference Backend Ollama + Custom Diffusion Pipeline
System Memory 32GB DDR3 (Hybrid Offload & KV Cache)
Key Enablers Previous PCIe realloc & BIOS optimizations from 31B setup

Lessons from the Diffusion Breakthrough

  • Diffusion Unlocks Quality on Constrained Hardware: The iterative diffusion process allows the model to refine outputs step-by-step, achieving reasoning depth previously requiring much larger models or more VRAM.
  • Agent-Specific Tuning Matters: By optimizing the diffusion schedule and context handling for OpenClaw's tool-use patterns, we gained reliability in long-horizon autonomous tasks.
  • Builds on Prior Work: The same legacy Asus B85M-E + RTX 5060 Ti node that powered the 31B experiment now flexibly hosts multiple model profiles thanks to robust kernel and memory tweaks.

Moving Forward: Agentic Future

This breakthrough marks a pivotal moment: capable 26B-class agents running locally on modest GPUs, fully integrated with OpenClaw. It paves the way for accessible, private, high-performance personal AI that can truly act on your behalf across digital and physical interfaces. Next: multi-GPU scaling and expanded skill libraries for the agent farm.


Hardware Hacking • May 2026

The 31B Breakthrough

Bridging the "Implementation Gap" to run Gemma 4:31B via OpenClaw on a legacy motherboard.

Status: Operational 🚀

We have successfully bridged the "Implementation Gap." By combining a decade-old Asus B85M-E with a modern RTX 5060 Ti (16GB) and a freshly optimized 32GB RAM pool, the node is now running Gemma 4:31B via OpenClaw.

What We’ve Achieved

  • Hardware Harmonization: Resolved the "PCI-e region invalid" error using pci=realloc,nocrs kernel flags, allowing the 16GB VRAM window to be mapped on a legacy BIOS.
  • Bus Optimization: Maximized data throughput by locking the GPU to Gen3 speed and enabling 128-bit Dual Channel memory mode (hitting 17 GB/s bandwidth).
  • Hybrid Inference: Configured Ollama to intelligently split the 31B model—placing the majority of layers in VRAM and utilizing the new 32GB Ballistix RAM pool for the "spillover."
  • Agent Integration: Verified a full end-to-end loop with OpenClaw, allowing the agent to utilize a high-reasoning 31B model for complex coding tasks.

The Final Technical Stack

Layer Specification
Model Gemma 4:31B (Quantized)
Logic OpenClaw Agentic Workflow
VRAM 16GB (Blackwell Architecture)
System RAM 32GB DDR3-1600 CL9 (Dual Channel)
Interface Ollama API over 128-bit Memory Bus

Lessons for the Home Lab

  • Don't Trust dmidecode blindly: While software might report 64-bit widths, bandwidth benchmarks (mbw) are the true proof of Dual Channel success.
  • SATA Cables are Traitors: Always double-check your drive connections after wrestling with RAM clips.
  • Restart the Service: Ollama only scans for CUDA hardware at launch. If you tweak BIOS or Kernel settings, a systemctl restart ollama is mandatory.

Moving Forward: The "Agentic" Phase

Now that the hardware bottleneck is solved, the focus shifts to software performance. With a 31B model, the "Reasoning" is top-tier, but the "Latency" is the new variable.


Hardware Hacking • April 2026

Resurrecting a 2013 Desktop for 2026 AI Inference

How to bypass PCIe address limits to run a 16GB Blackwell GPU on an Asus B85M-E motherboard.

The "Frankenstein" Node Specs

GPU NVIDIA RTX 5060 Ti (16GB VRAM)
Motherboard Asus B85M-E (LGA 1150)
Primary Goal Dedicated Headless AI Inference (Ollama/OpenClaw)

The Challenge: PCIe Region Invalid

Modern 16GB GPUs require a memory "window" larger than what old B85 chipsets were designed to handle. Without intervention, the driver fails with a PCI-e region invalid error in dmesg.

1. BIOS Configuration

Crucial tweaks to isolate the GPU for compute-only tasks:

  • Primary Display: Set to iGPU (Force display to onboard VGA/HDMI).
  • iGPU Multi-Monitor: Enabled (Keeps the NVIDIA card visible).
  • PCIEX16_1 Speed: Gen3 (Max throughput for model loading).
  • Launch CSM: Disabled (Pure UEFI required for CUDA 12.8).

2. The Kernel Workaround

Since the BIOS can't map the memory window, we force the Linux kernel to reallocate resources:

# Edit /etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash pci=realloc,nocrs"

3. Results

With these flags, nvidia-smi communicates successfully. By offloading the UI to the integrated graphics, we reclaim the full 16GB VRAM for high-precision models like Gemma 4 E2B.

Update: Agent Testing Success

Following the initial hardware setup, we moved to the software stack with phenomenal results:

  • Successfully ran Gemma 4 E2B on Ollama with 100% GPU utilization.
  • Connected it as the agent model for OpenClaw and successfully interacted via chat.
  • Pulled the larger Gemma 4 E4B model and reran the exact same flow successfully!

About

Producing high-end quality, fully-tested software units based on constant collaboration with our customers to deduce exact specifications.

Striving to understand the business workflows to design custom-tailored software to fit the needs from management/owner level to end-users of our clients.