Commit Graph

11 Commits

Author SHA1 Message Date
2ec7cef1b2 feat(profiles): Phase 2 — Requires=secubox-core → Wants= on all units (remove hard cascade)
secubox-core.service is a Type=oneshot (mkdir+chown) that RemainAfterExit=yes. A hard
Requires= on ~108 units cascade-stops them all if core is restarted/fails (e.g. a
secubox-core package upgrade) — a thundering-herd outage. After= keeps the ordering;
Wants= keeps the soft dependency without the cascade. Prereq for mass native apply
(Phase 3). Scaffolds (new-module.sh/new-package.sh) updated so future units use Wants=.

Co-Authored-By: Gerald KERMA <devel@cybermind.fr>
2026-07-19 09:06:54 +02:00
c2990f4d98 feat(peertube,avatar): privilege-separated cookie install via root path-unit (closes #407)
Replaces the sudo-from-dashboard approach (which required dropping
NoNewPrivileges) with a CSPN-clean design: unprivileged dashboards spool the
cookies, a root systemd .path watches + installs them.

- secubox-peertube: ship peertube-cookie-install.{path,service} (root oneshot
  runs `peertubectl set-youtube-cookies` + rm's the spool); postinst enables
  the .path; /import/cookies now just writes the spool (no sudo) → "queued";
  restore NoNewPrivileges=true; drop the sudoers file + sudo dep.
- secubox-avatar: _apply_youtube writes the spool (no sudo) → "queued"; keeps
  NoNewPrivileges. poke success keys on cookies; po_token stays experimental.
2026-05-28 12:36:56 +02:00
3fdb12b9b1 feat(peertube): cookie-intake endpoint for the WebExtension relay (ref #388, #401)
Lets the SecuBox Companion extension install YouTube cookies with one click.

- api/main.py: POST /import/cookies (require_jwt) — accepts the Netscape
  cookies body, spools to /run/secubox/peertube-yt-cookies.txt, then escalates
  via a single narrowly-scoped sudoers rule to `peertubectl set-youtube-cookies`
  (installs into the LXC, enables import cookies, restarts PeerTube).
- debian/secubox-peertube.sudoers: secubox → NOPASSWD exactly
  `peertubectl set-youtube-cookies /run/secubox/peertube-yt-cookies.txt`.
- service unit: drop NoNewPrivileges (would block sudo); documented why.
- rules: install sudoers 0440; control: Depends sudo.
Deployed + verified on gk2 (route 401s unauth, sudoers scoped, secubox can
spool, NoNewPrivileges=no).
2026-05-28 11:09:08 +02:00
5e52598cf6 feat(peertube): native-LXC deployment + dashboard correction + URL import (ref #388, supersedes #390)
Aligns the package with what's actually deployed on gk2 (validated live at
https://peertube.gk2.secubox.in/, upload confirmed) and adds yt-dlp URL import.

- lib/peertube/install-lxc.sh (NEW): idempotent native PeerTube install in a
  dedicated Debian LXC (10.100.0.120 on br-lxc), mirroring grafana/yacy. Bakes
  in every fix from the live bring-up: Node 22 via signed NodeSource repo (8.x
  needs >=22, no curl|bash); pnpm with MSGPACKR_NATIVE_ACCELERATION_DISABLED=1
  (arm64); debian.common.conf template (postgres-15 needs it); bind mounts
  /data/peertube/{storage,config,postgres,redis} chown'd to LXC root UID;
  production.yaml patch (listen 0.0.0.0:9000, https/hostname/443, secret, db,
  admin email, import.videos.http.enabled=true); captures first-boot root
  password to /etc/secubox/secrets/peertube-admin.
- sbin/peertubectl (NEW): install/status/start/stop/restart/logs/reload.
- conf/peertube.nginx.conf (folds #390, port corrected to LXC :9000 not the
  stale 127.0.0.1:9001 Docker-on-host plan): public vhost :9080 -> 10.100.0.120
  :9000, 8G uploads, 7d streaming timeouts, WS, ACME; WAF-bypass (gitea pattern).
- api/main.py: talk to the native instance over HTTP at <lxc_ip>:<http_port>
  with Host: <public_hostname> header (PeerTube 403s on raw-IP Host) instead of
  podman/docker exec; status reports real LXC state + reachability; /container/*
  drive the LXC via peertubectl; NEW POST /import + GET /imports.
- www/peertube/index.html: new "Import" tab (URL + channel + privacy + recent
  imports); status/labels/links corrected for native-LXC.
- debian/control + service: reframe Docker/Podman -> native-LXC; drop
  Wants=podman/docker. conf/peertube.toml.example (NEW). README + changelog 1.1.0.
2026-05-28 08:17:59 +02:00
754485140b feat(peertube): rework to align with SecuBox conventions, make installable (closes #388)
secubox-peertube 1.0.0 had been removed from gk2 and could not be
cleanly reinstalled: hardcoded /srv/peertube path (predates #319),
service unit blocked from starting by ConditionPathExists, broken
Requires=secubox-runtime.service, root user with ExecStartPost
chmod hacks, postinst didn't tolerate masked units, no /data
migration block.

Reworked to current SecuBox patterns (mirror gitea/wazuh):

  api/main.py — default data_path /srv/peertube → /data/peertube
  (5 hardcoded fallbacks updated in lockstep, Pydantic model
  default updated, top-level DEFAULT_CONFIG updated).

  debian/secubox-peertube.service — drop ConditionPathExists gate
  so the API daemon is always reachable to serve the dashboard
  (the heavy PeerTube container is still operator-deployed on
  demand via the dashboard); User=root → User=secubox + Group=
  secubox; replace ExecStartPost chmod/chown hacks with
  RuntimeDirectory=secubox + RuntimeDirectoryPreserve=yes +
  RuntimeDirectoryMode=0775 + UMask=0000 (mass-redeploy safety);
  drop the broken Requires=secubox-runtime.service (no such
  service); reorder Wants= to podman.service docker.service;
  add ReadWritePaths covering /run/secubox /var/lib/secubox
  /etc/secubox /var/log/secubox /data/peertube.

  debian/postinst — add #319 /data migration block (mirror gitea
  pattern from aba60ae3); wrap systemctl enable in is-enabled
  != masked check (per wazuh fix 63284497) so a deliberately
  masked unit no longer fails the postinst; drop the hardcoded
  /srv/peertube/{storage,config,data} mkdir (the API creates
  these on first container/install so PeerTube's UID/GID can own
  them); nginx reload guarded by `nginx -t`.

  debian/control — Description rewritten with cross-references
  to the other federated/streaming/media SecuBox packages
  (matrix, jitsi, jellyfin, gotosocial, simplex); Recommends
  reordered to podman first (smaller, distro-native), docker.io
  second; explicit note that the API daemon is lightweight and
  always reachable while the container is operator-deployed.

Verified on gk2 (root@192.168.1.200):
  - apt install podman secubox-peertube_1.0.1-1~bookworm1_all.deb
    succeeded.
  - systemctl is-active secubox-peertube → active
  - /run/secubox/peertube.sock created srw-rw-rw- secubox:secubox
    (no ExecStartPost chmod hacks needed)
  - curl --unix-socket /run/secubox/peertube.sock http://x/health
    → {"status":"ok","module":"deb"}
  - podman 4.3.1 installed and ready for container/install when
    operator triggers it via dashboard
  - /data/peertube preserved (existing symlink /srv/peertube →
    /data/peertube intact)

Not done in this rework (out of scope per issue):
  - Actually installing the PeerTube container on gk2 (1G RAM
    free, operator's call).
  - peertubectl LXC controller — package is Docker/Podman-based
    by design.
  - Frontend rewrite (1154-LOC dashboard stays as-is).
  - Adding to secubox-full/-lite metapackages.
2026-05-27 11:34:12 +02:00
abc1f82d2d fix(services): Use portable uvicorn invocation in systemd units
Changed /usr/local/bin/uvicorn to /usr/bin/python3 -m uvicorn
for compatibility across different Python installation methods.

Also fixed JWT auth import in eye-remote boot_media router.

Affected: 31 service files across 30 packages

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-30 17:02:08 +02:00
aa41893d4b feat: Complete Phase 8, 9, 10 - all modules done
Phase 8 (Applications): 21 modules complete
- jitsi, gotosocial, peertube, hexo, webradio, voip, simplex, torrent, newsbin

Phase 9 (System Tools): 22 modules complete
- Added READMEs for vault, cloner, vm, rtty, reporter, turn, smtp-relay

Phase 10 (Security Extensions): 10 modules complete
- Created secubox-netifyd package (DPI daemon)
- Added README for secubox-wazuh

Infrastructure fixes:
- Fixed uvicorn path in 29 service files (/usr/bin → /usr/local/bin)
- Fixed smtp-relay debian/control (Section: mail, added msmtp alternative)
- Added MODULE-COMPLIANCE.md with formal design rules
- Updated CLAUDE.md to reference compliance requirements

Total: 125 packages, all phases complete

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-08 14:46:58 +02:00
7ead1ff77f fix: Slipstream path + conditional service startup
1. Fix slipstream path: Look for packages in output/ not just output/debs/
   - build-image.sh and build-live-usb.sh now check both locations
   - 73 packages now properly detected and installed

2. Add ConditionPathExists to 22 optional services:
   - Services only start if /etc/secubox/<module>/enabled exists
   - Prevents boot failures when backend apps aren't installed
   - Affected: ollama, jellyfin, zigbee, lyrion, localai, hexo,
     peertube, newsbin, webradio, gotosocial, torrent, domoticz,
     simplex, photoprism, homeassistant, matrix, jitsi, voip,
     magicmirror, mmpm, jabber, redroid

3. Add explicit parted/fdisk install in live USB build
   - Ensures disk tools available for secubox-install

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-06 19:50:11 +02:00
ce28d53918 feat(phase8): Complete all 21 Application modules
New modules created (13):
- secubox-hexo: Static blog generator (Hexo)
- secubox-webradio: Internet radio streaming
- secubox-torrent: BitTorrent client (Transmission)
- secubox-newsbin: Usenet downloader (SABnzbd)
- secubox-domoticz: Home automation
- secubox-gotosocial: Fediverse/ActivityPub server
- secubox-simplex: SimpleX secure messaging
- secubox-photoprism: Photo management
- secubox-homeassistant: IoT/Home automation hub
- secubox-matrix: Matrix chat server (Synapse)
- secubox-jitsi: Video conferencing
- secubox-peertube: Video platform
- secubox-voip: VoIP/PBX (Asterisk/FreePBX)

All modules include:
- FastAPI backend with JWT authentication
- P31 Phosphor light theme frontend
- Docker/Podman container management
- Debian packaging (control, rules, postinst, prerm)
- nginx reverse proxy config
- systemd service unit
- Menu integration

Total packages: 85 (was 72)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-04 10:04:25 +02:00
2d2870d8a9 fix(systemd): Add RuntimeDirectory for /run/secubox socket support
- Add RuntimeDirectory=secubox to all services using ProtectSystem
- Change ProtectSystem=strict to ProtectSystem=full for compatibility
- Add systemd overrides in build script for cached packages
- Create tmpfiles.d entry for /run/secubox

This fixes the namespace issue where services couldn't create sockets
in /run/secubox due to ProtectSystem=strict mount namespacing.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-03 08:54:19 +02:00
491b2aaea1 feat(phase8): Add PeerTube federated video platform
- LXC-based PeerTube container with PostgreSQL, Redis, Node.js, ffmpeg
- FastAPI backend for install, user, video management
- Web UI with stats grid, videos/users/logs tabs
- Systemd service on Unix socket

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-28 10:21:03 +01:00