secubox-deb/scripts
CyberMind-FR 561007fe74 fix(build): scripts/build-packages.sh — auto-discover packages instead of hardcoded list
The PACKAGES array was hardcoded to 30 entries, last updated months
ago. As of master at a28984c1 there are 140 secubox-* package
directories with debian/control; the script silently skipped the 110
that weren't in the list (operators got 0 build output for those).

Surfaced today during the consolidation-deploy: the 9 PRs merged into
master touched 31 packages, but the build script only built 13
because the other 18 weren't in the hardcoded list. The 18 had to be
built manually with direct dpkg-buildpackage calls.

Replace the static array with a glob over packages/secubox-*/ that
keeps only directories with debian/control. Build order: secubox-core
first (universal Depends:), metapackages secubox-full / secubox-lite
last, everything else alphabetical between them. The exact order
doesn't matter for dpkg-buildpackage (each builds independently); the
sort keeps the build log readable and surfaces core/meta failures
early/late respectively.

Verified: bash scripts/build-packages.sh bookworm all --dry-run now
plans 140 builds (vs 30 before) with the expected first/last order.
2026-05-27 10:24:16 +02:00
..
bench feat(bench): Add performance benchmark suite for ARM64 optimization 2026-04-30 09:12:00 +02:00
lib Merge remote-tracking branch 'origin/master' into feature/95-streamlit-per-site-version-pinning-conta 2026-05-12 16:59:00 +02:00
tests feat(scripts): add check-dashboard-cache.py lint + CI (closes #147) (#148) 2026-05-18 08:21:20 +02:00
add-health-endpoints.py feat(api): Add /health endpoint to 53 modules 2026-05-09 10:40:05 +02:00
agent-worktree.sh fix(scripts): use issue title for PR, surface push errors as exit 4 (ref #83) 2026-05-12 10:22:14 +02:00
apply-crt-theme.py Apply CRT P31 Phosphor theme to all 38 module UIs 2026-03-23 18:56:11 +01:00
apply-light-theme.py Add CRT light theme across all UI modules 2026-03-25 08:55:45 +01:00
apt-publish.sh feat(secubox): complete meta-script generator Tasks 14-17 2026-05-11 05:32:29 +02:00
apt-sync.sh feat(secubox): complete meta-script generator Tasks 14-17 2026-05-11 05:32:29 +02:00
audit-packages.py docs(audit): Phase 1 consolidation audit — script + findings (ref #378) 2026-05-27 07:14:48 +02:00
build-add-local.sh
build-all-local.sh feat(build): Slipstream ALL packages, AZERTY, no-compress option 2026-03-30 06:37:35 +02:00
build-all.sh fix(build): Add timeouts to prevent build script hangs 2026-04-26 19:04:20 +02:00
build-kernel-local.sh fix(image): replace emojis in /etc/issue with VT102-safe ASCII tags (#339) 2026-05-22 10:07:15 +02:00
build-packages.sh fix(build): scripts/build-packages.sh — auto-discover packages instead of hardcoded list 2026-05-27 10:24:16 +02:00
capture-module-screenshots.sh feat(kiosk): Add VirtualBox debug logging for X11 troubleshooting 2026-04-13 08:26:06 +02:00
capture-screenshots.py feat(docs): Add screenshot capture system and multilingual wiki generator 2026-05-09 10:09:21 +02:00
check-dashboard-cache.py feat(scripts): add check-dashboard-cache.py lint + CI (closes #147) (#148) 2026-05-18 08:21:20 +02:00
create-secubox-vm.sh docs: Add VirtualBox quick start guide and VM creation script 2026-04-04 10:31:21 +02:00
deploy.sh fix(deploy): Remove --delete from www rsync to prevent module conflicts 2026-05-02 18:13:16 +02:00
diag-leds.sh feat(led-heartbeat): Add bash heartbeat script and diagnostic tool (ref #39) 2026-05-07 07:13:59 +02:00
export-preseed.sh Add preseed system for configuration persistence 2026-03-24 19:41:08 +01:00
fix-emoji-fonts.sh feat(kiosk): Add VirtualBox debug logging for X11 troubleshooting 2026-04-13 08:26:06 +02:00
fix-namespace-errors.sh fix(kiosk): Skip X11 config on bare metal, disable service sandboxing 2026-04-15 09:52:20 +02:00
fix-navbar.sh Fix p2p/zkp/mesh navbar and add fix-navbar.sh script 2026-03-26 07:19:29 +01:00
flash-multiboot.sh feat(scripts): Add flash-multiboot.sh download/flash tool 2026-04-27 19:12:23 +02:00
generate-docs.py feat(docs): Add screenshot capture system and multilingual wiki generator 2026-05-09 10:09:21 +02:00
generate-secubox-yaml.py feat(secubox): complete meta-script generator Tasks 14-17 2026-05-11 05:32:29 +02:00
haproxy-workflow.sh fix(health): VHost health prober placeholder categorization + Eye Remote metrics 2026-05-06 16:44:49 +02:00
install-apparmor.sh Add secubox-repo and secubox-hardening modules, CI/CD workflows 2026-03-22 22:15:01 +01:00
install-audit.sh Add secubox-repo and secubox-hardening modules, CI/CD workflows 2026-03-22 22:15:01 +01:00
license-headers-enrolled.txt ci(license): add License Headers workflow (ref #81) 2026-05-12 10:00:54 +02:00
license-headers.py fix(license): tighten detect_existing + missing-file = repo-wide (ref #81) 2026-05-12 11:39:57 +02:00
local-repo-add.sh
metablog-ingest-gitea-config.sh fix(metablog): awk INI patcher no longer duplicates [repository] section (ref #94) 2026-05-12 15:10:06 +02:00
metablog-ingest.sh feat(metablog): Orchestrator for Gitea ingest (preflights + report) (ref #94) 2026-05-12 15:10:06 +02:00
metablog-site-backfill.sh feat(metablog): site.json backfill orchestrator (ref #101) 2026-05-12 17:25:59 +02:00
metablog-webhook-install.sh feat(metablog-webhook): install/uninstall scripts via Gitea API (ref #113) 2026-05-13 07:31:20 +02:00
metablog-webhook-uninstall.sh feat(metablog-webhook): install/uninstall scripts via Gitea API (ref #113) 2026-05-13 07:31:20 +02:00
migration-export.sh feat(migration): Add --exclude-services option to export script 2026-04-29 15:34:35 +02:00
migration-import.sh feat(migration): Extend migration tools v2.1.0 with 19 modules 2026-04-29 14:17:30 +02:00
migration-transform.py feat(migration): Add OpenWrt → SecuBox-DEB migration tools 2026-04-29 12:45:47 +02:00
new-module.sh feat: modular nginx config + hub roadmap + new modules 2026-03-21 20:34:01 +01:00
new-package.sh feat: modular nginx config + hub roadmap + new modules 2026-03-21 20:34:01 +01:00
patch-multiboot-efi.sh feat(live-boot): Complete live RAM boot implementation v2.2.4-live 2026-04-27 13:30:50 +02:00
port-frontend.sh
probe-mpcie-gpios.sh docs(mochabin): EP06 mPCIe GPIO investigation runbook + hardened probe script (closes #345) (#359) 2026-05-22 17:50:33 +02:00
qemu-screenshot.sh feat(kiosk): Add VirtualBox debug logging for X11 troubleshooting 2026-04-13 08:26:06 +02:00
README.md Merge pull request #84 from CyberMind-FR/feature/license-headers-phase-a 2026-05-12 11:41:43 +02:00
render-deploy-artifacts.sh feat(scripts): Render nginx vhost + DEPLOY.md + license artifacts (ref #80) 2026-05-12 09:32:01 +02:00
requirements-screenshot.txt Add screenshot tool and wiki documentation 2026-03-24 12:36:19 +01:00
retrofit-nginx-modular.sh feat: modular nginx config + hub roadmap + new modules 2026-03-21 20:34:01 +01:00
rewrite-xhr.py
run-qemu.sh feat: Add QEMU/VBox launcher scripts + fix kiosk log bug 2026-04-10 12:02:25 +02:00
run-vbox.sh feat: Add QEMU/VBox launcher scripts + fix kiosk log bug 2026-04-10 12:02:25 +02:00
screenshot-tool.py Fix screenshot tool login with aiohttp 2026-03-24 13:24:30 +01:00
secubox-haproxy-regen-safe fix(scripts): re-apply secubox-haproxy-regen-safe sub-command fix 2026-05-12 11:17:34 +02:00
secubox-healthbump fix(led-heartbeat): v2.1.1 — cap brightness at 10 to keep IS31FL319X i2c bus responsive 2026-05-24 08:35:22 +02:00
secubox-nginx-sync.sh feat(ui): Sidebar v2.30.0 with hardware LED health bumper integration 2026-05-08 17:56:18 +02:00
secubox-screenshots.sh feat(network): Smart auto-IP with ARP collision detection (v1.7.0.2) 2026-04-14 16:28:02 +02:00
setup-local-cache.sh
stage-apt-repo.sh feat(scripts): Add stage-apt-repo.sh orchestrator (ref #80) 2026-05-12 09:31:16 +02:00
stage-gpg-bootstrap.sh feat(scripts): Add GPG bootstrap wrapper for staged repo (ref #80) 2026-05-12 09:27:22 +02:00
streamlit-ingest.sh fix(streamlit): Also fix _saved_source_args empty-array expansion (ref #95) 2026-05-12 16:29:34 +02:00
sync-all-routes.sh fix(infra): mitmproxy route sync stability — restore metablogizer sites 2026-05-12 09:54:52 +02:00
sync-mitmproxy-routes.sh fix(sync): drop 10.100.0.10 from DEAD_CONTAINER_IPS — mail LXC lives there 2026-05-17 10:42:07 +02:00
sync-wiki.sh feat(live-boot): Complete live RAM boot implementation v2.2.4-live 2026-04-27 13:30:50 +02:00
ui-fix-checker.sh fix(ui): Add sidebar navigation to 11 modules 2026-04-10 13:20:24 +02:00
ui-screenshot-capture.py fix(ui): Add sidebar navigation to 11 modules 2026-04-10 13:20:24 +02:00
update-css-design-tokens.py feat: Implement 6-Module Design System across all UI components 2026-04-08 18:29:36 +02:00
update-debian-nginx.sh feat: modular nginx config + hub roadmap + new modules 2026-03-21 20:34:01 +01:00
update-nginx-modular.sh feat: modular nginx config + hub roadmap + new modules 2026-03-21 20:34:01 +01:00
validate-staged-repo.sh fix(scripts): Decouple chroot apt-update grep from pipefail (ref #80) 2026-05-12 09:39:14 +02:00
vbox-setup.sh feat(build): Add kiosk mode + VirtualBox setup + Profile Generator architecture 2026-04-29 09:16:36 +02:00
vhost-matrix-sync.sh fix(infra): Fix vhost-matrix-sync stderr logging for clean JSON output 2026-05-06 17:32:27 +02:00

SecuBox-DEB — Scripts

Outils de build, déploiement et maintenance pour SecuBox-DEB.


Build Scripts

Script Description
build-packages.sh Build tous les packages .deb
build-all.sh Build complet + deploy
build-all-local.sh Build avec cache local
build-add-local.sh Ajouter package au repo local

Usage

# Build tous les packages
bash build-packages.sh

# Build un package spécifique
bash build-packages.sh --package secubox-hub

# Build avec cache local (plus rapide)
bash build-all-local.sh

Deploy Scripts

Script Description
deploy.sh Déployer sur cible via SSH

Usage

# Déployer un package
bash deploy.sh secubox-hub root@192.168.1.1

# Déployer tous les packages
bash deploy.sh all root@192.168.1.1

Package Scaffolding

Script Description
new-package.sh Créer structure package Debian
new-module.sh Créer module avec API FastAPI
port-frontend.sh Porter frontend depuis OpenWrt

Usage

# Nouveau package
bash new-package.sh secubox-mymodule

# Nouveau module avec API
bash new-module.sh mymodule

# Porter frontend LuCI
bash port-frontend.sh crowdsec-dashboard

Multi-Agent Worktrees

Script Description
agent-worktree.sh Lifecycle helper for one-branch-per-issue work in isolated git worktrees

Usage

# Create a worktree bound to GitHub issue #83
bash scripts/agent-worktree.sh start --issue 83
cd ~/CyberMindStudio/secubox-deb-worktrees/83-multi-agent-worktree-workflow

# List active worktrees + ahead/behind/dirty status
bash scripts/agent-worktree.sh list

# Rebase the current worktree on origin/master
bash scripts/agent-worktree.sh sync

# Push and open the PR (`Closes #83` in body)
bash scripts/agent-worktree.sh finish

# After merge, remove the worktree and local branch
bash scripts/agent-worktree.sh clean 83

See scripts/agent-worktree.sh --help for the full reference and docs/superpowers/specs/2026-05-12-multi-agent-worktree-workflow-design.md for the design rationale.


Local Cache Setup

Script Description
setup-local-cache.sh Configurer apt-cacher-ng
local-repo-add.sh Ajouter .deb au repo local

Usage

# Setup initial
sudo bash setup-local-cache.sh

# Ajouter un package
bash local-repo-add.sh ../output/debs/secubox-core_1.0.0.deb

Flash & Download

Script Description
flash-multiboot.sh Download & flash multiboot USB

Usage

# List available releases
bash flash-multiboot.sh --list

# Flash latest multiboot to USB
sudo bash flash-multiboot.sh /dev/sdb

# Download specific release without flashing
bash flash-multiboot.sh --release multiboot-v2.2.4-live --download

# Flash with force (no confirmation)
sudo bash flash-multiboot.sh --force /dev/sdb

VM & Testing

Script Description
run-qemu.sh Lancer image dans QEMU
run-vbox.sh Lancer VM VirtualBox
create-secubox-vm.sh Créer VM SecuBox
qemu-screenshot.sh Screenshot VM QEMU

Usage

# Test dans QEMU
bash run-qemu.sh ../output/secubox-vm-x64.img

# Screenshot automatique
bash qemu-screenshot.sh

Fix & Maintenance

Script Description
fix-navbar.sh Corriger navbar modules
fix-emoji-fonts.sh Installer fonts emoji
fix-namespace-errors.sh Fix namespace Python
ui-fix-checker.sh Vérifier UI modules
update-nginx-modular.sh Update config nginx
retrofit-nginx-modular.sh Migrer config nginx
update-debian-nginx.sh Update nginx Debian

Security Scripts

Script Description
install-apparmor.sh Installer profils AppArmor
install-audit.sh Configurer auditd

Usage

sudo bash install-apparmor.sh
sudo bash install-audit.sh

Screenshot & Documentation

Script Description
capture-module-screenshots.sh Screenshots tous modules
secubox-screenshots.sh Screenshots automatiques

Export Scripts

Script Description
export-preseed.sh Exporter config preseed

Performance Benchmarks

Script Description
bench/api-latency.py API endpoint latency testing (P50/P95/P99)
bench/memory-baseline.sh Per-service memory tracking (RSS/PSS/USS)
bench/startup-time.sh Service cold-start measurement
bench/cpu-profile.sh Flame graph generation with py-spy
bench/locustfile.py Locust load test scenarios

See bench/README.md for detailed usage.

Quick Usage

# API latency
./bench/api-latency.py --host 192.168.255.250 --requests 50

# Memory baseline
./bench/memory-baseline.sh

# Load test
locust -f bench/locustfile.py --host https://192.168.255.250

Migration Scripts

Script Description
migration-export.sh Export SecuBox-OpenWrt configs via SSH
migration-import.sh Import migration archive to SecuBox-DEB
migration-transform.py UCI → TOML/netplan/nftables converter

Overview

Migration Data Saver exports services and content from SecuBox-OpenWrt and restores them to SecuBox-DEB targets (VirtualBox/amd64, ESPRESSObin/ARM64).

┌─────────────────────────────────┐
│  SecuBox-OpenWrt (source)       │
│  ├─ /etc/config/* (UCI)         │
│  ├─ /etc/wireguard/*.conf       │
│  ├─ /etc/crowdsec/*             │
│  └─ /srv/www/* (content)        │
└──────────────┬──────────────────┘
               │ SSH + tar
               ▼
┌─────────────────────────────────┐
│  Migration Archive (.tar.gz)    │
│  ├─ manifest.json               │
│  ├─ configs/ (UCI → TOML)       │
│  ├─ secrets/ (encrypted)        │
│  └─ content/ (web/media)        │
└──────────────┬──────────────────┘
               │ transform + import
               ▼
┌─────────────────────────────────┐
│  SecuBox-DEB (target)           │
│  ├─ /etc/secubox/*.toml         │
│  ├─ /etc/netplan/*.yaml         │
│  ├─ /etc/nftables.conf          │
│  └─ /srv/www/*                  │
└─────────────────────────────────┘

Usage

# 1. Setup SSH key access to OpenWrt source
ssh-copy-id -i ~/.ssh/secubox-openwrt root@192.168.255.1

# 2. Export from OpenWrt
bash scripts/migration-export.sh -h 192.168.255.1 -i ~/.ssh/secubox-openwrt -o /tmp/migration.tar.gz

# 3. Preview import on target (dry-run)
bash scripts/migration-import.sh -f /tmp/migration.tar.gz --dry-run

# 4. Apply migration
bash scripts/migration-import.sh -f /tmp/migration.tar.gz

# Export with encryption
bash scripts/migration-export.sh -h 192.168.255.1 -e -o /tmp/migration.tar.gz.enc

# Import encrypted archive
bash scripts/migration-import.sh -f /tmp/migration.tar.gz.enc --passphrase "secret"

# Export/import specific modules only
bash scripts/migration-export.sh -h 192.168.255.1 -m wireguard,crowdsec,certs -o /tmp/partial.tar.gz
bash scripts/migration-import.sh -f /tmp/partial.tar.gz -m wireguard,crowdsec

Exported Modules

Module OpenWrt Source Debian Destination
network /etc/config/network (UCI) /etc/netplan/00-secubox.yaml
firewall /etc/config/firewall (UCI) /etc/nftables.conf
wireguard /etc/wireguard/*.conf /etc/wireguard/*.conf
crowdsec /etc/crowdsec/* /etc/crowdsec/*
dhcp /etc/config/dhcp (UCI) /etc/dnsmasq.d/secubox.conf
haproxy /etc/haproxy/* /etc/haproxy/*
nginx /etc/nginx/* /etc/nginx/*
certs /etc/letsencrypt/* /etc/letsencrypt/*
content /srv/www/* /srv/www/*
vhosts /etc/config/vhost (UCI) /etc/secubox/vhosts/*.toml
users /etc/secubox/auth.toml /etc/secubox/auth.toml
state /var/lib/secubox/* /var/lib/secubox/*

Rollback

Pre-import snapshots are created automatically at /var/lib/secubox/rollback/pre-migration-TIMESTAMP/. To rollback:

# Restore from snapshot
cp -a /var/lib/secubox/rollback/pre-migration-20260429-143022/* /etc/

license-headers.py

CMSD-1.0 SPDX header tool. Adds, verifies, or previews license headers on all first-party source files. Pure stdlib; no dependencies.

Usage:

python3 scripts/license-headers.py --check        # CI mode; exit 1 if missing
python3 scripts/license-headers.py --fix          # add headers in place
python3 scripts/license-headers.py --list         # list files that would be touched
python3 scripts/license-headers.py --diff         # unified diff per file (no writes)
python3 scripts/license-headers.py --fix common/  # scope to a path

Enrollment allowlist: scripts/license-headers-enrolled.txt. One glob per line; #-prefixed lines are comments. Empty means no enforcement. Phase A leaves it nearly empty; Phase B adds lines per package; Phase C deletes it to enforce repo-wide.

Optional pre-commit hook (off by default):

- repo: local
  hooks:
    - id: license-headers
      name: License Headers (CMSD-1.0)
      entry: python3 scripts/license-headers.py --fix
      language: system
      pass_filenames: true

Spec: docs/superpowers/specs/2026-05-12-license-headers-design.md.


Environment Variables

Variable Description
SECUBOX_TARGET Cible SSH (user@host)
SECUBOX_PORT Port SSH (défaut: 22)

See Also


Author

Gerald KERMA devel@cybermind.fr