Commit Graph

211 Commits

Author SHA1 Message Date
CyberMind
dee8bf8b81
feat(remote-ui): Phase 3 — Pillow+framebuffer kiosk for Pi 4B/400 (ref #127)
* feat(remote-ui/square): carry forward Phase 2 helper + debian + firstboot (ref #127)

Snapshot of Phase 2 PR #131's validated infrastructure, brought into Phase 3
unmodified. The Chromium+PySide6 dual-window kiosk path is dropped (replaced
by Pillow+framebuffer per the Phase 3 design spec). What carries forward:

packages/secubox-eye-square/
├── helper/                  21 pytest cases green
│   ├── eye_square_helper/   FastAPI app + SO_PEERCRED auth + 4 route modules
│   │   ├── app.py           middleware (JSONResponse fix preserved)
│   │   ├── auth.py          ALLOWED_UIDS frozenset
│   │   ├── __main__.py      uvicorn UDS bind
│   │   └── routes/          usb_gadget, service, lockdown, console
│   └── tests/               6 test files (test_e2e.py dropped — it depended
│                            on the right_panel package which is gone)
└── debian/                  arm64 package shell; control will be edited by
                             Phase 3 plan to drop Chromium/Qt/X deps

remote-ui/square/
├── files/etc/systemd/system/
│   ├── secubox-eye-square-helper.service    Helper FastAPI as secubox-eye-square user
│   ├── secubox-otg-gadget.service           configfs composite gadget (square variant)
│   └── secubox-firstboot.service            oneshot trigger for firstboot.sh
├── files/etc/udev/rules.d/
│   └── 90-secubox-otg-square.rules          host-side interface rename rule
├── files/etc/apparmor.d/
│   └── secubox-eye-square-helper            CAP_NET_ADMIN + CAP_SYS_ADMIN scope
├── files/etc/secubox/eye-square.toml.example
├── files/usr/local/sbin/firstboot.sh        GPIO 5V check + hostname + SSH + toml
├── build-eye-square-image.sh                will be heavily modified — drop Chromium/Qt/X
├── install_pi4.sh                           SD flash with safety guards
└── deploy.sh                                SSH hot-update — kiosk service list will change

Phase 1's remote-ui/common/ (PR #130) is NOT brought in — Phase 3 doesn't
consume it. round/fb_dashboard.py stays on master untouched.

What's DROPPED from Phase 2 (not brought in):
- right_panel/ entire PySide6 widget tree + ipc_bridge + WebSocket server
- square-bridge.js Chromium-side TM hook override
- secubox-kiosk-x.service, secubox-square-chromium.service,
  secubox-square-right-panel.service systemd units
- etc/openbox/{autostart,rc.xml}, etc/nginx/sites-available/secubox-square
- home/secubox/.xinitrc

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* docs(remote-ui): Phase 3 implementation plan — Pillow+framebuffer kiosk (ref #127)

25 tasks covering kiosk skeleton, theme + modules table, sim, framebuffer +
touch input, transport manager + helper client, 4 right-pane tabs (Alerts /
Module Detail / Console / Mode Controls), right_panel composer, ring_dashboard
(Pillow port of Phase 2's QPainter ring renderer — visually faithful to
round/'s dashboard but independently authored, since round/fb_dashboard.py
must remain unchanged), __main__ event loop, systemd unit, fb udev rule,
debian/control simplification (drop Qt/X/Chromium, add python3-pil/evdev),
build script + firstboot + deploy.sh edits, README + CLAUDE.md docs,
regression test, Pi 4B + Pi 400 hardware bench tests, open PR.

Plan supersedes Phase 2 PR #131 (closed). Phase 2 helper FastAPI carries
forward unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat(remote-ui/square): scaffold kiosk/ package skeleton (ref #127)

* feat(remote-ui/square/kiosk): theme.py + modules_table.py with TDD (ref #127)

* feat(remote-ui/square/kiosk): sim.py drift generator with TDD (ref #127)

* feat(remote-ui/square/kiosk): framebuffer.py mmap helper with TDD (ref #127)

* feat(remote-ui/square/kiosk): touch_input.py evdev reader + classify (ref #127)

* feat(remote-ui/square/kiosk): transport_manager.py with TDD (ref #127)

* feat(remote-ui/square/kiosk): helper_client.py sync httpx UDS with TDD (ref #127)

* feat(remote-ui/square/kiosk): tabs/alerts.py with TDD (ref #127)

* feat(remote-ui/square/kiosk): tabs/module_detail.py with TDD (ref #127)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat(remote-ui/square/kiosk): tabs/console.py with TDD (ref #127)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat(remote-ui/square/kiosk): tabs/mode_controls.py with TDD (ref #127)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat(remote-ui/square/kiosk): right_panel.py tab manager with TDD (ref #127)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat(remote-ui/square/kiosk): ring_dashboard.py with easing + alerts ribbon (ref #127)

The implementer adapted update_metrics() to store raw metric values in
_target/_current (e.g. cpu_percent=80.0) rather than the 0..1 extracted
ratio from the plan's code block — this matches the test's assertion
(_target["cpu_percent"] == 80.0). Module.extract() is now applied at
draw() time. Behaviour is identical from the renderer's perspective.

Also added 'if m.metric in metrics' guard so partial-metric updates
preserve existing targets for unspecified keys (kiosk-friendly).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat(remote-ui/square/kiosk): __main__.py event loop + smoke tests (ref #127)

Wires HelperClient + TransportManager + SimState + RingDashboard +
RightPanel + FrameBuffer into a 30 FPS event loop. Probes transport
every 30s, fetches metrics every 2s (falls back to SIM), composes
800x480 frame (dashboard + panel), blits to /dev/fb0.

Touch input integration deferred; modules from Task 6 are available
for the bench iteration to wire when the hardware ships.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat(remote-ui/square): secubox-square-kiosk.service unit + fb0 udev rule (ref #127)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(secubox-eye-square): debian/control drops Qt/X/Chromium deps for Phase 3 (ref #127)

Phase 3 replaces the Phase 2 Chromium+PySide6 stack with a single-process
Pillow+/dev/fb0 kiosk. Dependency cleanup:

 dropped: chromium, openbox, xserver-xorg, xinit, unclutter, nginx-light,
          python3-pip, python3-pyside6 (Recommends), python3-qasync
 added:   python3-pil, python3-evdev

Helper FastAPI deps unchanged (carried forward from Phase 2).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(remote-ui/square): build-eye-square-image.sh slimmed for Phase 3 (ref #127)

Apt install list trimmed: dropped chromium, openbox, xserver-xorg, xinit,
unclutter, 12 libxcb-* libraries, nginx-light, python3-pip; added
python3-pil + python3-evdev. The PySide6 pip install is gone.

Removed Phase 2 vestiges:
- nginx + round/ html copy + square-bridge.js injection
- openbox autostart, xinitrc chmod
- render group (no /dev/dri access needed without Chromium)

Systemd enable list updated:
- Dropped: nginx, secubox-kiosk-x, secubox-square-chromium,
           secubox-square-right-panel
- Added:   secubox-square-kiosk
- Default target now multi-user.target (was graphical.target)

Python install copies kiosk package (was right_panel package).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(remote-ui/square): firstboot.sh enables kiosk service (drops nginx + 3 Phase 2 units) (ref #127)

Phase 3 firstboot only enables secubox-otg-gadget, secubox-eye-square-helper,
and secubox-square-kiosk. The X / Chromium / right-panel / nginx units no
longer exist on the image.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(remote-ui/square): deploy.sh targets kiosk service (drops chromium+right-panel+nginx) (ref #127)

Hot-update flow simplified for Phase 3:
- Rsync helper + kiosk Python packages only (no /var/www/, no
  square-bridge.js, no nginx content).
- Restart secubox-eye-square-helper + secubox-square-kiosk
  (was chromium + right-panel + nginx reload).
- Health check via systemctl is-active (was curl http://localhost/).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* docs(remote-ui/square): README + CLAUDE.md for Phase 3 (ref #127)

README rewritten for the Phase 3 architecture (Pillow+/dev/fb0 kiosk, no
Chromium/Qt/X/nginx). CLAUDE.md added with file map, stack inventory, run +
debug recipes, and the round/ untouched constraint.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: CyberMind-FR <gandalf@Gk2.net>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 05:59:42 +02:00
CyberMind
7c37415f88
feat(remote-ui): Phase 1 — extract common/ shared core (ref #127)
* feat(remote-ui/common): scaffold shared-core directory (ref #127)

* feat(remote-ui/common): extract palette.css from round/ (ref #127)

* fix(remote-ui/common): trim palette.css to spec (6 module + 8 C3BOX tokens) (ref #127)

* feat(remote-ui/common): extract base.css verbatim from round/ (ref #127)

* feat(remote-ui/common): extract ICONS to icons.js (ref #127)

* docs(remote-ui/common): correct icons.js header comment — sizes are {22,48,96} not 128 (ref #127)

* feat(remote-ui/common): extract RINGS + CX/CY/SA to modules-table.js (ref #127)

* feat(remote-ui/common): extract CFG to config.js (replaces jwt-helper.js per #127 plan revision)

* feat(remote-ui/common): extract TransportManager with onModuleTap/onTransportChange hooks (ref #127)

* feat(remote-ui/common): extract SIM + simStep to sim.js (ref #127)

* feat(remote-ui/common): move 24 SecuBox module PNG icons to common/assets/icons/ (ref #127)

* feat(remote-ui/common): move secubox-otg-gadget.sh, add GADGET_NAME env override + arm64 serial fallback (ref #127)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(remote-ui/common): trim whitespace from device-tree serial-number read (ref #127)

* feat(remote-ui/common): move secubox-otg-host-up.sh + variant-aware comment (ref #127)

* refactor(remote-ui/round): consume common/ via <link>/<script> tags (ref #127)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(secubox-system): add form_factor to RemoteUIConnectedRequest with TDD (ref #127)

* feat(remote-ui/round): deploy.sh bundles common/ alongside round/ (ref #127)

* fix(remote-ui/round): deploy.sh COMMON_SRC path resolution + rsync --delete (ref #127)

* feat(remote-ui/round): build-eye-remote-image.sh embeds common/ + nginx /common/ alias (ref #127)

* docs(remote-ui): document common/ dependency in round/ docs (ref #127)

* docs(remote-ui/round): clarify palette.css is forward-looking (ref #127)

* docs(remote-ui): Task 18 regression-gate report — structural verification (ref #127)

Full diffoscope gate blocked by missing hyperpixel2r.dtbo prerequisite.
Structural equivalence verified instead: Phase 1 changes are purely
additive (common/ embed + nginx /common/ alias + extracted JS/CSS/icons),
no behavioural change to round/'s existing logic.

User must run the full image diffoscope manually after sourcing the
hyperpixel2r.dtbo blob, before final merge.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* ci(eye-remote): bump workflow VERSION env 2.2.0 → 2.2.1 (ref #127)

Pre-existing drift: build-eye-remote-image.sh writes
secubox-eye-remote-2.2.1.img but the workflow's Compress/Checksum/
Upload steps reference ${{ env.VERSION }} = 2.2.0, so the compress
step fails with "No such file or directory" after a successful build.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: CyberMind-FR <gandalf@Gk2.net>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 05:59:40 +02:00
1d27705d0d docs(remote-ui): Phase 3 design spec — Pillow+framebuffer Pi 4B/400 kiosk (ref #127)
Supersedes Phase 2 PR #131 (Chromium + PySide6 dual-window) after bench-test
revealed window-stacking fragility and ~400MB RAM footprint. Operator
requested an all-Python kiosk aligned with round/'s fb_dashboard.py.

Phase 3 architecture:
- Single Python process, Pillow renders 800×480 frame, mmap /dev/fb0
- Left 480×480: ring dashboard (rings/pods/clock) — independently authored
  but visually faithful to Phase 1 round/index.html
- Right 320×480: 4 tabs (Alerts/Module Detail/Console/Mode Controls),
  manually drawn with Pillow
- Touch via python-evdev
- Helper FastAPI on Unix socket — carried forward from Phase 2 unchanged
- Debian packaging + firstboot.sh — carried forward
- ~400MB compressed image (vs 1.5GB), ~30-50MB RAM (vs 400MB)

round/fb_dashboard.py UNTOUCHED — Pi Zero W deployment stays at v2.2.1.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 16:53:36 +02:00
fdfc829ec8 docs(remote-ui): Phase 2 implementation plan — square/ variant build (ref #127)
30 tasks covering: helper FastAPI (auth + 4 route modules) with SO_PEERCRED,
PySide6 right column (4 tabs + IPC bridge + helper client + theme parser),
Chromium-side square-bridge.js, systemd units, Openbox + nginx + AppArmor,
firstboot.sh with GPIO 5V check, image build (debootstrap Bookworm arm64),
SD flash + deploy scripts, Debian packaging, pytest regression, manual
Pi 4B + Pi 400 acceptance, PR. Depends on Phase 1 PR #130 (merged).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 12:18:54 +02:00
cddf9b125a docs(remote-ui): Phase 1 implementation plan — common/ extraction (ref #127)
20 bite-sized tasks covering: common/ skeleton, JS/CSS/icons/shell
extraction, TransportManager hooks (onModuleTap, onTransportChange),
form_factor Pydantic field with TDD, round/ rewire to consume common/
via <link>/<script>, deploy.sh + image build updates, three regression
gates (pytest green, diffoscope timestamp-only deltas, manual Zero W
bench), and PR opening. Phase 2 plan to be written after Phase 1 merges.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 11:02:27 +02:00
ba5ea4626b docs(remote-ui): add Pi 400 as a supported target for square/ (ref #127)
Pi 400 shares BCM2711 with Pi 4B, runs the same arm64 image. DTB
auto-selection picks bcm2711-rpi-400.dtb at boot. firstboot.sh records
the board flavour. USB peripheral mode requirement (GPIO 5V power) is
unchanged. Integrated keyboard is recognised via libinput.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 11:02:27 +02:00
7ae5e82345 docs(remote-ui): square/ variant v0.1 design spec (ref #127)
Two-phase design: extract remote-ui/common/ (Phase 1, refactor round/
with no behavioural change), then add remote-ui/square/ targeting Pi 4B
+ official 7" 800x480 touchscreen as a dual-pane kiosk — round UI in
Chromium at (0,0)+480x480 plus a PySide6 right column at (480,0)+320x480
with Alerts, Module detail, Console, and Mode controls tabs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 11:02:09 +02:00
bedc6fda45 fix(tests): drop tests/__init__.py to allow cross-dir pytest collection; exist_ok in auth_data_dir (ref #120) 2026-05-13 08:21:09 +02:00
78c8d3c4fa docs: implementation plan — auth rework (19 tasks, offline-mode hardening included) (ref #120)
19 bite-sized TDD tasks covering: schema v2, password policy, TOTP (pyotp +
argon2id backup codes), user_store with auth.toml fallback, single mutation
engine, v1→v2 migration, secubox_core.auth rewire (jti + scope), branching
/auth/login + TOTP enrollment/challenge + set-password, secubox-users API
handlers, usersctl Python rewrite, CLI↔API parity test, debian deps + postinst
seed (admin + hostname), live smoke, and offline-mode hardening (server-side
QR rendering + NTP-aware TOTP window + /auth/health endpoint).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 08:10:12 +02:00
14fba6ccec docs: auth rework design — secubox-users as identity source + TOTP 2FA (ref #120)
Brainstormed spec for replacing the plaintext auth.toml admin login with
secubox-users-backed argon2id auth, RFC 6238 TOTP 2FA (mandatory for
admins), kill-on-disable session revocation, CLI/API parity via a single
secubox_users.engine module, and feature-flagged 3-phase rollout.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 07:53:45 +02:00
5fbdb15c8e docs(metablog-webhook): Implementation plan for deploy webhook (ref #113)
8 tasks: HMAC + secret loader, git_pull + ring buffer, dispatcher +
lock, main.py wiring, install/uninstall scripts, bash smoke, README
+ Session 166, finish + PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 07:31:20 +02:00
42c75161df docs(metablog-webhook): Design spec for deploy webhook (ref #113)
Sub-project E of #49. POST /api/v1/metablogizer/webhook receives Gitea
push events for metablog-* repos, verifies HMAC-SHA256, git pulls the
site dir under a per-site asyncio.Lock, invalidates load_sites() cache
(#111), conditionally reloads nginx if site.json:domain changed.

Companion scripts/metablog-webhook-install.sh registers the webhook on
all 166 metablog-* repos via Gitea API (idempotent).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 07:31:20 +02:00
5867740c42 docs(metablog-ui): Implementation plan for version dashboard (ref #103)
5 tasks covering index.html extension (3 columns + filter + sort + 60s
polling), site.html drill-in page, smoke test, docs, and PR finish.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 18:48:10 +02:00
e8588f62e4 docs(metablog-ui): Design spec for version dashboard (ref #103)
Sub-project D of #49. Extends existing /metablogizer/ list view with
3 columns (version, streamlit_app, last_updated) + filter box + sort
+ 60s polling. New site.html drill-in page that surfaces every
site.json field plus 3 external links (live site, Gitea repo,
Streamlit app). Tag history defers to Gitea's UI (browser auth)
because the repos are private and browser-side proxying through
a stored token is heavier than the MVP warrants.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 18:43:34 +02:00
a4ada6c21f docs(metablog): Backfill run summary (ref #101)
165 total: 104 created + 61 skipped (including 2 fixed via --force
for missing 'published' field: money, evolution). 0 failed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 17:41:43 +02:00
81f9c639a4 docs(metablog): 8-task implementation plan for site.json schema (ref #101)
8 tasks:
1. JSON Schema draft-07 file
2. Python validator + enricher module + 7 pytest cases
3. Wire helper into load_sites() (warn-only validation)
4. Add python3-jsonschema to debian/control
5. Backfill script (SSH orchestrator + Gitea probe for streamlit_app)
6. 3-gate smoke test
7. Live backfill run + summary
8. .gitignore + README + tracking + finish worktree

Self-review: spec coverage complete, no placeholders, identifiers
consistent (_load_site_json, _schema_enrich, _schema_validate,
status keywords, paths).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 17:12:21 +02:00
542f236601 docs(metablog): Design spec for site.json schema + version metadata (ref #101)
Sub-project C of #49. JSON Schema draft-07 + Python validator/enricher +
backfill script + API extension. Permissive validation (log warnings,
don't reject). version + last_updated derived from git when site.json
lacks them. Backfill creates complete site.json for the 105 sites
without one (auto-detects streamlit_app via Gitea repo presence) and
preserves the 61 existing ones unless --force.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 17:06:00 +02:00
2f440c6194 Merge remote-tracking branch 'origin/master' into feature/95-streamlit-per-site-version-pinning-conta
# Conflicts:
#	.claude/HISTORY.md
#	.claude/WIP.md
#	.gitignore
2026-05-12 16:59:00 +02:00
744770750e Merge remote-tracking branch 'origin/master' into feature/94-metablogizer-gitea-ingest-import-166-sit
# Conflicts:
#	.claude/HISTORY.md
#	.claude/WIP.md
2026-05-12 16:57:43 +02:00
4a388994d3 Merge remote-tracking branch 'origin/master' into feature/49-feat-metablogizer-streamlit-version-mana
# Conflicts:
#	.claude/HISTORY.md
2026-05-12 16:56:06 +02:00
d110c00786 docs(streamlit): Full-run ingest summary (ref #95)
28 Streamlit apps ingested into gitea.gk2.secubox.in/gandalf/streamlit-*.
First pass had 20 failures from pre-existing broken Gitea repo stubs;
bulk-deleted via API and second pass cleaned to 0 fail.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 16:29:34 +02:00
37df7b9c9b docs(streamlit): 9-task implementation plan for Gitea version pinning (ref #95)
9 tasks:
1. Per-app ingest function (scripts/lib/streamlit-ingest-app.sh)
2. Orchestrator (scripts/streamlit-ingest.sh) — preflights + JSON report
3. 3-app smoke + idempotent re-run
4. Full 30-app run + summary commit
5. streamlitctl deploy --from-gitea --tag + rollback subcommand
6. FastAPI _get_apps() enrichment (current_tag, deployed_at)
7. Deploy/rollback cycle smoke (canary: yijing)
8. .gitignore + README + Session 163 tracking
9. Finish worktree + PR (Refs #49 sub-F, Closes #95)

Reuses patterns + helpers from sub-project B (#97):
- scripts/lib/gitea-ssh-preflight.sh (sourced)
- gitea@ SSH user (not git@)
- defensive | tail -1 | tr -d '\n' on status capture (FU4 from B)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 16:29:34 +02:00
c7613288f0 docs(streamlit): Design spec for Gitea version pinning (ref #95)
Sub-project F of #49. Audit shows 30 directory-form apps in
/srv/streamlit/apps/ (23 already have .git/, 7 don't), running
inside the existing streamlit LXC at 10.100.0.50.

Design:
- Mirror all 30 apps to gandalf/streamlit-<app> on Gitea
- Retarget existing .git + push history for the 23 (preserves
  any local commits); git init + push for the 7
- Tag v1.0.0 on initial state
- streamlitctl deploy <app> --from-gitea --tag <vX.Y.Z>:
  clone tag into /srv/streamlit/apps/<app>/ with backup of
  the current content; restart running instance if any
- streamlitctl rollback <app>: restore latest backup
- New API fields: current_tag, deployed_at (read from
  .deploy.json or git describe --tags --exact-match)

YAGNI: no multi-version side-by-side, no container per
version, no webhook trigger.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 16:29:34 +02:00
CyberMind
2744758b9e
Health banner: live panel (visitor-origin + live-hosts + cert-status) (#98)
* docs(spec): Health banner live panel design (ref #92)

Three public banner sections sharing one polling/CORS pipeline:
- VisitorOrigin: nft set seen_src + GeoLite2-ASN.mmdb, threshold-gated
  rollup, raw IPs discarded before persistence
- LiveHosts: HAProxy admin socket, 60 x 1-min ring buffer over req_tot
  deltas, hostname-heuristic frontend filter
- CertStatus: scan /etc/letsencrypt/live + cryptography parse, classify
  valid / expiring_soon / expiring_critical / expired

Each section fails independently; section hidden on enabled=false,
empty entries, or fetch error. All three endpoints are unauthenticated,
CORS-open, Cache-Control max-age=300.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* docs(plan): Health banner live panel implementation plan (ref #92)

14-task TDD plan: tests scaffold -> config helpers -> three aggregators
(visitor-origin / live-hosts / cert-status) -> FastAPI lifespan wiring ->
nftables ruleset -> geoipupdate timer -> debian packaging -> banner v1.3.0
-> README + tracking docs -> full-suite verification + PR.

Also reconciles spec with codebase conventions: service user is 'secubox'
(not 'secubox-metrics'); config lives in /etc/secubox/secubox.conf, not a
separate metrics.toml.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* test(metrics): Scaffold pytest layout for new aggregators (ref #92)

Adds tests/__init__.py and conftest.py that wire packages/secubox-metrics/api
and the repo-wide common/ onto sys.path so individual aggregator modules can
be imported in isolation.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat(core): Add visitor_origin / live_hosts / cert_status config helpers (ref #92)

Three new section helpers in secubox_core.config that merge defaults with
operator-supplied TOML overrides. Each section defaults to enabled=false so
the live-panel aggregators stay quiet on systems that haven't opted in.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* test(metrics): Use tmp_path fixture + drop unused import (ref #92)

Switches the config-helper tests from a hard-coded /tmp path to pytest's
tmp_path fixture, matching the pattern in packages/secubox-haproxy/tests/.
Removes the now-unused 'from unittest.mock import patch' line.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat(metrics): VisitorOrigin aggregator (ref #92)

Pure-Python aggregator that polls the nft seen_src set, resolves ASNs via
GeoLite2 mmdb, and emits a threshold-gated top-N rollup. Private/loopback IPs
are skipped at lookup time; raw IPs never leave the function scope; the
threshold gate runs before persistence so the cache file never contains
attributable counts.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(metrics): VisitorOrigin code-review followups (ref #92)

- mmdb auto-reopen on mtime change (Important): close + reopen when stat
  reports a different mtime; previously _mmdb_mtime was dead state.
- _read_nft_set defensive parse (Important): guard against {elem: str} shapes
  to prevent a latent TypeError.
- current() returns a defensive copy (Minor): no more by-reference leak of
  internal state.
- Drop unused ip_address import and unused monkeypatch parameter (Minor).
- Tighten tiebreak test to assert ASN order, not just count order (Minor).
- Add test for mtime-based reopen.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* test(metrics): Pin VisitorOrigin error-path behaviour (ref #92)

Regression tests for refresh_once: disabled config, missing mmdb, and nft
subprocess failure must all yield a non-throwing degraded payload.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat(metrics): LiveHosts aggregator with 60x1-min ring buffer (ref #92)

Reads HAProxy admin socket via raw AF_UNIX, parses 'show stat' CSV, filters
internal frontends (leading underscore or no dot), ring-buffers per-frontend
deltas over 60 minutes, and emits a top-N hostname rollup. Counter-reset
detection (cur < prev) yields a fresh-baseline bucket instead of a negative
delta. current() returns a defensive copy mirroring the VisitorOrigin fix.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* test(metrics): Pin LiveHosts CSV parser + missing-socket paths (ref #92)

Tests the show-stat CSV parser against the real HAProxy column order and
asserts that an absent admin socket returns a degraded payload rather than
raising.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat(metrics): CertStatus aggregator (ref #92)

Scans /etc/letsencrypt/live for cert.pem files, classifies each by days
remaining (valid / expiring_soon / expiring_critical / expired) using the
operator's warn_days/critical_days thresholds, and emits a summary + soonest
next-renewal host. A single corrupt PEM never kills the scan. Days remaining
computed with math.ceil so a cert expiring in 2.99d reports 3d, consistent
with certbot/renewal tooling expectations.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(metrics): correct expired boundary when using math.ceil (ref #92)

math.ceil maps any cert that expired within the last 24 h to days=0,
which the previous `days < 0` guard treated as expiring_critical instead
of expired. Changing the guard to `days <= 0` closes the gap: with ceil,
days=0 means actual remaining time is in (-86400, 0] — i.e. already
past or exactly at expiry — so classifying it as expired is correct.
All four existing tests continue to pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(metrics): Wire three live-panel aggregators into FastAPI lifespan (ref #92)

Adds the three asyncio background tasks under a single lifespan and exposes
their current() payloads on /api/v1/metrics/{visitor-origin,live-hosts,cert-status}
with a 5-min Cache-Control. Endpoints stay unauthenticated by design — the
aggregators only emit threshold-gated, hostname-only data.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(metrics): Await cancelled lifespan tasks + tidy import order (ref #92)

- Important: lifespan finally now awaits gather(*tasks, return_exceptions=True)
  after cancel(), so blocking subprocess/socket I/O in aggregator refreshes
  doesn't race uvicorn's shutdown timeout.
- Minor: move 'from contextlib import asynccontextmanager' into the stdlib
  import group at the top of the file.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat(metrics): Ship nftables ingress tap for visitor-origin (ref #92)

Private inet secubox_metrics table with a timeout'd src-IP set, hooked from
prerouting at priority -300 so additions happen before secubox-firewall's
filter chain decides whether to drop the packet.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat(metrics): Weekly GeoLite2 ASN refresh timer (ref #92)

Conditional on /etc/secubox/secrets/maxmind.conf existing, so the unit is a
silent no-op on installs that haven't supplied a license key. RandomizedDelay
spreads load when many boxes deploy together.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* build(metrics): Package live-panel deps, nft ruleset, and geoipupdate timer (ref #92)

- control: add python3-maxminddb, python3-cryptography, geoipupdate, nftables
- rules: install nftables/ and systemd/ assets
- postinst: secubox -> haproxy group, cache + secrets + GeoIP dirs,
            nftables reload, timer enable
- service: ReadWritePaths gains /var/cache/secubox

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(metrics): Run geoipupdate as secubox + restart svc on upgrade (ref #92)

- secubox-geoipupdate.service: User/Group=secubox so .mmdb files inherit the
  ownership the metrics service expects when reading them. Previously the
  unit ran as root and created root-owned files that secubox-metrics could
  not open.
- postinst: switch 'systemctl start' to 'systemctl restart' so the secubox
  user's new haproxy-group membership is picked up by an already-running
  service after an upgrade.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat(banner): v1.3.0 live panel — visitor origin, live hosts, cert status (ref #92)

Three independent fetch loops on a shared 30s cadence, three DOM sections,
per-section hide on enabled=false / empty / fetch error. Uses existing
design tokens (gold/cyan/matrix-green) so no new CSS variables are added.
A failing section never affects the others.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(banner): Correct banner element id lookup in live-panel (ref #92)

The new live-panel sectionContainer() helper looked up
getElementById('sbx-health-banner'), but the actual banner element is
created with id='health-banner'. The mismatch made banner null, so the
three live-panel sections were silently never appended to the DOM.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* docs: Session 160 — Health Banner Live Panel (ref #92)

README documents the three new endpoints + config blocks. HISTORY / WIP /
MIGRATION-MAP entries describe the feature, the spec/plan paths, and the
session's outcome.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(metrics): Address whole-branch review findings (ref #92)

- Wrap _read_nft_set / _read_haproxy_stats in asyncio.to_thread so blocking
  I/O (subprocess up to 5s, AF_UNIX recv up to 2s) no longer stalls the
  event loop on every refresh tick.
- Replace falsy current() guard with explicit _refreshed flag. Previously,
  a successful refresh that produced entries=[] would fall through to the
  on-disk cache, serving stale non-empty data during low-traffic periods.
- Move geoipupdate from Depends to Recommends. It lives in bookworm/contrib,
  so a hard dependency breaks 'apt install secubox-metrics' on systems
  without contrib enabled. The aggregator already degrades gracefully when
  the mmdb is absent, making Recommends the correct strength. README
  documents the contrib note.
- prerm stops + disables secubox-geoipupdate.timer/service so 'apt remove'
  doesn't leave an orphan timer firing weekly with a missing unit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: CyberMind-FR <gandalf@Gk2.net>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 16:27:56 +02:00
0cb6ad6434 docs(metablog): Record full-run ingest summary (ref #94)
166 sites ingested into gitea.gk2.secubox.in/gandalf/metablog-*.
First pass had 72 failures from pre-existing broken Gitea repo
stubs; bulk-deleted via API and second pass cleaned to 0 fail.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 15:10:06 +02:00
cf1e13ccc8 docs(metablog): Add 8-task implementation plan for Gitea ingest (ref #94)
8 tasks:
1. Gitea config patch (ENABLE_PUSH_CREATE_USER, DEFAULT_BRANCH=main)
2. SSH preflight + key enrolment helper
3. Per-site ingest function (idempotent, history-preserving)
4. Orchestrator with preflights + JSON report
5. Smoke test on 3 sites (incl. idempotent re-run + clone-vs-source diff)
6. Full 166-site run + verification + summary commit
7. .gitignore + README + WIP/HISTORY tracking
8. Finish worktree + PR (Refs #49 sub-B, Closes #94)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 15:10:05 +02:00
577dc31d20 docs(metablog): Design spec for Gitea ingest of 166 sites (ref #94)
Sub-project B of #49. Audit shows 166 sites in /srv/metablogizer/sites/:
83 have local .git pointing at unreachable old Gitea (192.168.255.1:3001
or git.gk2/droplet-sites), 83 are raw files.

Design:
- All 166 land at gandalf/metablog-<site> on gitea.gk2.secubox.in (single
  namespace, even for the 12 ex-droplet-sites)
- Existing .git: retarget remote + push history (preserves 1 commit)
- Missing .git: git init + initial commit
- ENABLE_PUSH_CREATE_USER=true in Gitea app.ini so push creates repos
- SSH auth via gandalf's enrolled key; no API token plumbing
- Idempotent: skip if remote HEAD matches local HEAD
- v1.0.0 tag on HEAD after first push (per issue text)
- output/ingest-report.json captures per-site status

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 15:10:05 +02:00
CyberMind
122cd6cebc
WebUI Obfuscation - admin.HOSTNAME.secubox.in Only (#96)
* docs(spec+plan): WebUI obfuscation design and implementation plan (ref #44)

Spec: docs/superpowers/specs/2026-05-12-webui-obfuscation-design.md
Plan: docs/superpowers/plans/2026-05-12-webui-obfuscation.md

The design locks the SecuBox WebUI to admin.<HOSTNAME>.<DOMAIN_SUFFIX>
via strict-regex ACLs in HAProxy AND nginx, both driven by
/etc/default/secubox as the single source of truth. New package
secubox-defaults ships the env file; secubox-haproxy API exposes
/webui/admin-domain (info), /webui/nginx-config (JWT, rendered vhost),
/webui/refresh (JWT, cache invalidate). A safe renderer script writes
the nginx vhost atomically; haproxyctl + Python /generate both inject
the strict ACL at the top of http-in and https-in frontends.

Plan has 15 tasks with TDD steps, exact file paths, and complete code
in every step (no TBD/TODO). Acceptance criteria + integration test
script included.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat(secubox-defaults): scaffold package skeleton (ref #44)

* feat(secubox-defaults): ship /etc/default/secubox env file (ref #44)

* feat(secubox-defaults): postinst autodetect + dpkg-trigger (ref #44)

* feat(secubox-haproxy): webui_identity helper + tests (ref #44)

Implement webui_identity module that parses /etc/default/secubox
and exposes canonical admin URL + regex pattern for HAProxy acl.

New module:
- api/webui_identity.py: Parses SECUBOX_HOSTNAME and SECUBOX_DOMAIN_SUFFIX
  with LRU cache and invalidation support.

Tests (TDD):
- tests/test_webui_identity.py: 5 test cases covering basic parsing,
  missing hostname validation, custom suffix handling, comment handling,
  and cache invalidation.
- tests/conftest.py: sys.path bootstrap for api/ imports.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(webui_identity): catch OSError on defaults read + test (ref #44)

* feat(secubox-haproxy): GET /webui/admin-domain endpoint (ref #44)

* feat(secubox-haproxy): GET /webui/nginx-config rendered vhost (ref #44)

* feat(secubox-haproxy): POST /webui/refresh cache invalidation (ref #44)

* feat(secubox-haproxy): secubox-render-nginx-webui safe renderer (ref #44)

* feat(haproxyctl): inject strict-regex WebUI ACL at frontend top (ref #44)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(secubox-haproxy): /generate symmetry with strict WebUI ACL (ref #44)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(secubox-haproxy): dpkg-trigger refresh on secubox-defaults-changed (ref #44)

* build(secubox-haproxy): depend on secubox-defaults (ref #44)

* test(infra): integration test for WebUI obfuscation (ref #44)

* docs: HISTORY Session 159 — WebUI obfuscation (ref #44)

Records the complete WebUI obfuscation work: new secubox-defaults
package, three /webui/* endpoints, nginx renderer script, haproxyctl
+ Python generator symmetry, dpkg trigger plumbing, integration test.
Includes notes on the brainstorming → spec → plan → subagent-driven
execution flow and the 6 fix iterations caught by reviewers.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: CyberMind-FR <gandalf@Gk2.net>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 14:07:11 +02:00
7b1b356aaf docs(gitea): Add 10-task implementation plan for Gitea repair (ref #49)
10 tasks: 2 repo-side conf files, pre-change HAProxy backup, manual
haproxy.cfg edit (3 injection points), nginx vhost install,
idempotent postinst, smoke test for 5 validation gates, tracking
docs, rollback procedure, finish-worktree.

Bug #91 (haproxyctl regenerates broken config) is honored throughout:
all HAProxy edits are manual with timestamped backups.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 12:38:23 +02:00
7839199746 docs(gitea): Add design spec for Gitea repair (ref #49, refs #91)
Sub-project A of #49: expose existing Gitea LXC (10.100.0.40) at
https://gitea.gk2.secubox.in/ and ssh://git@gitea.gk2.secubox.in:2222/.
Uses existing wildcard cert; backend nginx_vhosts (direct, no
mitmproxy WAF for git smart-HTTP traffic).

Records haproxyctl regression #91 as a hard constraint: edit
haproxy.cfg manually with backup, never run haproxyctl vhost add
until the generator is fixed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 12:35:34 +02:00
3594642129 docs(apt): Tick plan checkboxes per code audit (ref #89)
48 steps audited against actual code in cmd/secubox/. Marked
48 steps as completed; 0 remain genuinely incomplete.

All code verified present and passing:
- internal/apt: Client, Server, packages — all functions exist
- cmd: apt.go, apt_server.go, clone.go — all commands registered
- tests: client_test.go, packages_test.go, apt_test.go, clone_test.go — all PASS
- go build succeeds; promptui in go.mod; binary serves correct --help output

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 12:23:02 +02:00
a99773418b docs(plan): SSL certificate health in Health Banner implementation
5 tasks, 25 steps, TDD approach
Reference: CM-SSL-BANNER-2026-05-12

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-12 10:51:43 +02:00
de03af12c2 docs(spec): SSL certificate health in Health Banner
- Display cert expiry days for current domain
- Thresholds: >7j ok, 3-7j warn, <3j error
- Backend: get_ssl_status() in health API
- Frontend: SSL line in banner after score

Reference: CM-SSL-BANNER-2026-05-12

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-12 10:24:17 +02:00
b8fd0ff190 docs(plan): multi-agent worktree workflow design (ref TBD)
Brainstorming-validated spec for `scripts/agent-worktree.sh` plus a new
CLAUDE.md doctrine section. Enables parallel multi-agent work by binding
each task to one GitHub issue, one branch, and one external worktree
under `~/CyberMindStudio/secubox-deb-worktrees/`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 09:45:26 +02:00
8de7ad76d8 docs(plan): multi-agent worktree workflow implementation plan (ref #83)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 09:41:00 +02:00
7f793b98e8 docs(plan): CMSD-1.0 license headers Phase A implementation plan
17 TDD tasks covering: scaffolding, render_header for 4 comment styles,
detect_existing tri-state, apply() per language with placement rules
(Python shebang+encoding, Bash shebang, HTML doctype, Markdown
frontmatter), walk() with skip-list and enrollment allowlist, CLI
dispatch, self-hosting, GitHub Actions workflow, README and CLAUDE.md
updates, smoke tests, and PR opening. Phase B/C left as operational
follow-up.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 09:16:08 +02:00
4529b5c11a docs(spec): CMSD-1.0 license headers across the codebase
Brainstormed design for adding the SPDX-CMSD-1.0 header to every
first-party source file (~2,170 across 6 languages), backed by a
reusable Python tool (scripts/license-headers.py), a CI check, and
a phased per-package rollout. Spec covers scope, header rendering
per language, placement rules, tool architecture, CI integration
with an enrollment allowlist, and verification steps.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 09:10:37 +02:00
33b55d22f7 docs(apt): Add implementation plan for public repo staging (ref #80)
10 tasks: --filter flag, tier-manifest helper, GPG bootstrap,
orchestrator, deploy artifacts, validation gate, .gitignore,
full pipeline run, tracking-file updates.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 09:05:45 +02:00
06ac00e64c docs(apt): Add public repo staging design (ref #80)
Brainstormed design for staging a signed APT repo at output/repo/
with amd64 + arm64 (mochabin) packages for bookworm, using existing
Go CLI and shell tooling. No network operations - user pushes
artifacts to apt.secubox.in out-of-band.

Layered build: base -> tier-lite -> tier-standard -> tier-pro
GPG: persistent ~/.gnupg/secubox/
License: CMSD-1.0 embedded in staged tree

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 09:02:51 +02:00
e6189bbaa5 docs(opad): add implementation plan for doctrine documents
7-task plan to create 5 OPAD doctrinal documents:
1. Directory structure
2. JSON Schema (opad-profile.schema.json)
3. Pydantic models (models.py + tests)
4. OPAD.md core doctrine
5. CSPN.matrix.md threat matrix
6. OPAD-OPERATIONS.md operational guide
7. Final validation

Reference: CM-WALL-OPAD-2026-05

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-12 08:54:53 +02:00
5ccf862f05 docs(opad): Add OPAD doctrine design specification
Design spec for 5 OPAD doctrinal documents:
- OPAD.md: Core doctrine, invariants, injection primitives
- CSPN.matrix.md: Threat × capability matrix for ANSSI
- opad-profile.schema.json: 3-prong profile JSON Schema
- models.py: Pydantic equivalents for FastAPI
- OPAD-OPERATIONS.md: Operational guide

Reference: CM-WALL-OPAD-2026-05
Version: 2.4.0

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-12 08:39:42 +02:00
cf328e5a42 docs: add implementation plan for APT and Clone commands 2026-05-11 06:10:20 +02:00
fcca5a7dce docs: add design spec for secubox apt and clone commands
Hybrid approach:
- Client operations (apt setup, clone) in pure Go
- Server operations (apt init/publish/sync) wrap existing shell scripts

Features:
- secubox apt: full repo management + client setup
- secubox clone: interactive bootstrap wizard for new systems

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-11 05:44:35 +02:00
ddd87e55c7 feat(secubox): add manifest generator
- Define Manifest struct with kernel, partitions, boot, output
- Implement Generate() from Profile and Board
- Add ToYAML() for serialization with header comments

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-10 21:08:32 +02:00
3335a5053f docs: Add Meta-Script Generator implementation plan
17 tasks with TDD approach:
- Go CLI with cobra/viper (gen, build, fetch, ota, info)
- Profile loader with inheritance merger
- Board configuration and tweaks
- Package scanner for debian/secubox.yaml
- Manifest and Makefile generation
- Interactive wizard with promptui
- Hardware detection
- APT repository with lintian compliance

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-10 20:00:56 +02:00
da706eeb28 docs: Add Meta-Script Generator v2.0.0 design spec
Design specification for secubox CLI tool:
- Go-based unified CLI (gen, build, fetch, ota)
- Profile hierarchy with hardware detection
- Package self-description (debian/secubox.yaml)
- A/B partition OTA with auto-rollback
- Dual APT repo (apt.secubox.in + apt.gk2.secubox.in)
- Multi-arch with lintian compliance

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-10 19:56:50 +02:00
d90afdc22d docs(migration): Add implementation plan for OpenWrt to Debian migration
26 tasks, 135 steps covering:
- Phase 1: LXC/storage/network preparation
- Phase 2: Container creation (mail, nextcloud, matrix, gitea)
- Phase 3: Data sync (certs, configs, databases, mailboxes)
- Phase 4: Cutover procedure with verification

Includes rollback procedure and summary checklist.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-05 12:35:41 +02:00
a9199d1f40 docs(migration): Add OpenWrt to Debian migration design spec
Big Bang migration plan from C3BOX (OpenWrt) to SecuBox-DEB (Debian):
- 4 phases: Prepare, Build, Sync, Cutover
- LXC containers for Mail, NextCloud, Matrix, Gitea
- Host-native gateway services (HAProxy, CrowdSec, nftables)
- Data migration strategy for 94 SSL certs + service data
- Cutover procedure with rollback plan

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-05 12:31:36 +02:00
0b705981e9 docs(plan): Add mitmproxy WAF migration implementation plan
15 tasks covering complete module migration:
- Package scaffold and debian files
- Configuration (TOML + WAF rules JSON)
- mitmproxyctl CLI for LXC management
- secubox_waf.py threat detection addon
- FastAPI routers (status, settings, alerts, haproxy, waf)
- WebUI pages (status, settings, filters)
- Nginx configuration
- README documentation

Session 90

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-03 07:48:38 +02:00
9e1bbfb173 docs(spec): Add mitmproxy WAF migration design specification
Design spec for migrating mitmproxy WAF module from OpenWrt to Debian:
- WAF-in mode only (HAProxy backend inspection)
- Single unified secubox-mitmproxy package
- LXC container with secubox_waf.py threat detection addon
- 18 FastAPI endpoints for status, alerts, HAProxy integration, WAF rules
- CrowdSec integration for automatic IP banning
- Full WebUI with status, settings, and filters pages
- TOML configuration format

Session 90

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-03 07:42:43 +02:00
814325dc83 docs(plan): HAProxy WebUI CRUD implementation plan
11 tasks with 37 steps covering:
- Modal system and toast notifications
- Form validation and API error handling
- VHost CRUD (add/edit/delete)
- Backend CRUD (add/edit/delete)
- Server CRUD (nested under backends)
- Certificate CRUD (request/delete)
- Table enhancements with action buttons

Single file modification pattern maintained.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-02 17:51:09 +02:00
6210fd3591 docs(spec): HAProxy WebUI enhancement design
Design spec for adding CRUD operations to HAProxy dashboard:
- VHost management (add/edit/delete)
- Backend management with nested servers
- Certificate request and deletion
- Modal system with P31 Phosphor theme
- Toast notifications for feedback
- Client-side validation

Approach A: Minimal Enhancement (~450 lines in single file)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-02 17:48:05 +02:00
133837f017 docs: Add Eye Remote Swiss Army implementation plan
21 tasks across 6 phases:
- Phase 1: Core Infrastructure (Mode manager, failover, renderer)
- Phase 2: Display Modes (Dashboard, Local, Flash, Gateway)
- Phase 3: Web Remote Server (FastAPI, routes, control.html)
- Phase 4: System Controls (WiFi, Bluetooth, display)
- Phase 5: Advanced Features (device manager, remote control, fleet)
- Phase 6: Integration & Polish (main.py, WebSocket, testing)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-26 17:07:08 +02:00
582a2d5702 docs: Add Eye Remote Swiss Army Dashboard design spec
- 4 operating modes: Dashboard, Local, Flash, Gateway
- Web Remote control at :8080 (touchless)
- Auto-detect + flag file override for mode switching
- Staged failover with visual feedback
- Unified Python Agent architecture

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-26 17:01:20 +02:00
7838ffa1f1 docs: Add Eye Remote touchscreen controller implementation plan
13-task TDD implementation plan covering:
- MenuItem and MenuState data models
- Static menu definitions for 6-slice radial menus
- MenuNavigator state machine
- Slice detection from touch coordinates
- RadialRenderer for framebuffer display
- ActionExecutor with LocalAPI integration
- TouchHandler menu mode integration
- Component wiring in main.py
- Menu icon generation
- Comprehensive test coverage

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-24 10:06:35 +02:00
ba8edad728 docs: Add Eye Remote touchscreen controller design spec
Comprehensive design for radial menu touch interface:
- 6-slice pie navigation optimized for circular display
- Dual-scope control (local Pi Zero + remote SecuBox)
- Gesture-based interaction (tap, swipe, long press)
- Hierarchical menu structure with dynamic data loading
- Error handling and visual feedback patterns

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-24 09:36:26 +02:00
67afb50034 docs(eye-remote): add bootstrap v2.1.0 implementation plan
14-task plan for mass_storage LUN + TFTP shadow channel:
- T1-T2: gadget-setup.sh and systemd service
- T3-T5: Pydantic models, core logic, FastAPI router
- T6: dnsmasq TFTP configuration
- T7: U-Boot documentation
- T8-T9: Debian packaging and build script
- T10: Integration tests
- T11-T14: Wiki and documentation updates

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-23 10:30:05 +02:00
ff9dd27d65 docs(eye-remote): Add bootstrap v2.1.0 design specification
Design spec for adding mass_storage LUN + TFTP shadow channel:
- USB composite gadget: ECM + ACM + mass_storage concurrent
- 4R double-buffer: active/shadow slots with atomic swap
- FastAPI /boot-media/ endpoints for upload/swap/rollback
- dnsmasq TFTP serving shadow slot for testing
- Shell (gadget-setup.sh) + Python (core/boot_media.py) split

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-23 10:23:19 +02:00
cca602da56 docs: Add integration test guide for Eye Remote v2.0.0
Complete testing guide covering:
- Gateway emulator installation and usage
- Unit test execution (13 tests)
- Agent-gateway integration testing
- API module verification
- Troubleshooting section

Part of Eye Remote v2.0.0 implementation (Task 14).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-21 11:11:26 +02:00
e1d496641e docs: Add Eye Remote v2.0.0 implementation plan
14 tasks across 4 phases:
- Phase 1: Eye Remote Agent (config, HTTP client, metrics bridge, device manager)
- Phase 2: SecuBox Module (models, registry, token manager, API routers)
- Phase 3: Gateway Tool (CLI, emulator, server)
- Phase 4: Packaging & Integration (Debian, build script, e2e test)

Each task includes TDD approach with failing tests first,
complete code, exact file paths, and commit instructions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-21 08:41:31 +02:00
7d46e9a0ad docs: Add Eye Remote integration design specification
Comprehensive spec for Eye Remote ↔ SecuBox integration:
- secubox-eye-agent: Multi-SecuBox connection manager
- secubox-eye-remote: SecuBox management module + WebUI
- secubox-eye-gateway: Dev emulator + fleet gateway
- Device token auto-authentication
- Touchless pairing via QR code
- Bidirectional control (Eye can control SecuBox)
- SSH auto-provisioning
- Screenshot, OTA, serial console features

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-21 08:32:35 +02:00