Commit Graph

118 Commits

Author SHA1 Message Date
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
fa92fe722c feat(ci): Unified sync-all workflow + eyemote visual banner
- Add .github/workflows/sync-all.yml: unified CI/CD on all pushes
  - Discovers changed packages and computes project metrics
  - Auto-updates README badges (packages, migration, endpoints)
  - Auto-updates WIP.md with CI sync entries
  - Creates releases on tags
  - Generates GitHub step summary with metrics table
- Add docs/assets/secubox-eyemote-banner.svg: 6-ring status SVG
  - Matches Round UI design (AUTH/WALL/BOOT/MIND/ROOT/MESH rings)
  - Displays live metrics: 131 packages, 2000+ endpoints, 94% migration
  - Cyberpunk/hermetic palette with glow effects
- Update README.md: add eyemote banner at top
- Update docs/wiki/Home.md: add eyemote banner at top

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-10 09:28:00 +02:00
68e7763fc3 docs: Add Eye Remote Multigadget skill and wiki
- Add /multigadget skill covering autorun, storage, round UI, tooling
- Add Eye-Remote-Multigadget.md unified wiki hub
- Add Build-System.md to wiki with build documentation
- Add AI-BUILD-PROMPT.md for GPT/Gemini assistance
- Update sidebar and home page with new links
- Update WIP.md with #70 and #71 done

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-10 09:12:42 +02:00
d8f28ff40f feat(auth): Track IP and User-Agent in sessions
Login endpoint now captures:
- Client IP (from X-Forwarded-For, X-Real-IP, or connection)
- User-Agent header

Session events include this info for session storage.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-09 11:19:45 +02:00
9ec377ab8f docs: Add remaining screenshots and thumbnails
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-09 11:07:56 +02:00
129b1291dd feat(ui): Add domain filtering, error pages, and user sessions
- Add wrong-domain.html landing page for non-admin domains
- Add unknown-module.html for 404 on admin domain
- Metablogizer: auto-publish on startup, republish-all button
- Metablogizer: empty-site.html for sites with no content
- Metablogizer: change default domain suffix to .gk2.secubox.in
- Users: add active sessions display and revocation
- Nginx: domain filtering (only admin.gk2.secubox.in allowed)
- Nginx: /login clean URL without .html extension

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-09 11:02:42 +02:00
950ff7ee09 feat(ui): Add mobile hamburger menu + portal login redirect
- sidebar.js v2.36.0: Mobile responsive hamburger menu toggle
  - Auto-show hamburger button on screens < 768px
  - Overlay to close sidebar on tap outside
  - Close sidebar on nav item click (mobile)
  - Added toggleMobile/closeMobile to public API

- portal/login.html: Transparent redirect to /login.html
  - Preserves query params and hash for external links
  - Fallback for JavaScript disabled browsers

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-09 10:18:40 +02:00
72802ad596 docs(screenshots): Add/update 48 module screenshots
Captured via capture-screenshots.py with 30s delay for cache refresh.
Includes thumbnails for wiki index.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-09 10:09:38 +02:00
eef430e123 feat(docs): Add screenshot capture system and multilingual wiki generator
- scripts/capture-screenshots.py: Auto-discovers 117 modules from packages/
  - Playwright-based capture with JWT authentication
  - 30-second delay per page for cache refresh
  - Thumbnail generation (400x225)
  - JSON manifest output

- scripts/generate-docs.py: Extended to 105 modules
  - Multilingual descriptions (EN, FR, DE, ZH)
  - --include-screenshots flag for wiki integration
  - Category index pages (CATEGORIES-XX.md)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-09 10:09:21 +02:00
00766234d2 feat(kernel): Add complete nftables support + busybox rescue docs
Kernel nftables fix (issue #64):
- Added CONFIG_NF_TABLES_INET, CONFIG_NF_TABLES_IPV4/IPV6
- Added NFT_CT, NFT_LOG, NFT_LIMIT, NFT_REJECT, NFT_COUNTER
- CrowdSec firewall bouncer now works correctly

Build script safety:
- Added deploy_to_device() with safe module extraction
- Prevents /lib symlink overwrite disaster

Documentation:
- FAQ-BUSYBOX-RESCUE.md: Emergency recovery when libc inaccessible
- PROMPT-BUSYBOX-TECHTIP.md: Gemini prompt for visual tech tip
- QUICKSHEET: Added emergency recovery section

Sidebar v2.32.0:
- Per-LED tooltips (Hardware/Services/Security)
- Fixed tooltip positioning for sidebar elements

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-08 18:27:30 +02:00
da8b7c5570 feat(led): HealthBump v2.1.0 with activity detection and K2000 party
- Activity-based brightness: ACTIVE (100) on change, SLEEP (20) when stable
- K2000 (Knight Rider) sweep effect for boot/alerts
- New commands: k2000, success, boot, alert, rainbow
- Aligned I2C timing with secubox-led-safe (300ms write delay)
- Simplified to POSIX /bin/sh for reliability
- Documented I2C bus recovery via platform driver rebind
- Removed unstable connect/activity flash

Ref #52

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-08 11:15:09 +02:00
dbf76b7f29 feat(led): Add 3-tier LED HealthBump system with kernel timer triggers
- LED1 (HW): Orange 4s cycle - hardware layer (CPU, memory, WAN)
- LED2 (SVC): Green 3s cycle - services layer (HAProxy, Nginx, certs)
- LED3 (SEC): Blue 2s cycle - security layer (CrowdSec bans)

Uses slow kernel timer triggers instead of userspace scripts to avoid
I2C bus errors on Debian 6.12 kernel (mv64xxx driver timing issues).

Scripts:
- secubox-led: Manual LED control with layer aliases
- secubox-led-trigger: Kernel timer trigger setup
- secubox-healthbump: Health status checker (30s timer)
- secubox-led-pulse: Userspace pulse daemon (deprecated)

Systemd services:
- secubox-led-trigger.service: Setup timers at boot
- secubox-healthbump.timer: Health check every 30s

Reference: docs/reference/secubox-led-pulse-openwrt.sh (original OpenWrt script)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-08 08:29:08 +02:00