Commit Graph

1144 Commits

Author SHA1 Message Date
ba2f459151 docs: Update WIP.md with WAF architecture configuration
- WAF enabled for Streamlit/MetaBlogizer
- WAF bypass for infrastructure services
- 38 path ACLs with waf_bypass

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 11:59:28 +01:00
98fb91a0ce docs: Document WAF architecture configuration
- WAF enabled for Streamlit/MetaBlogizer (security filtering)
- WAF bypass for infrastructure (Jellyfin, Mail, Glances, etc.)
- Path ACLs bypass WAF (mitmproxy routes by host only)
- 38 path ACLs configured with waf_bypass

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 11:58:19 +01:00
e30ca81288 docs: Update WIP.md with C3BOX service verification
- Added C3BOX SDLC full verification (70 services, 12 zones)
- 77 vhosts, 52 SSL certs, 5 LXC containers confirmed

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 11:43:28 +01:00
c1187e5815 docs: Update HISTORY.md with C3BOX full service verification
- Verified all 70 services across 12 zones
- 20 Streamlit apps, 15 MetaBlog sites operational
- 77 vhosts, 52 SSL certs, 5 LXC containers running

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 11:42:50 +01:00
ede1532d4b docs: Update WIP.md with 2026-02-14 completions
- Mitmproxy routes duplicate fix
- Service backend fixes (play.maegia.tv, client, social)
- Glances 4.5.0.4 installation
- GoToSocial service start

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 11:32:18 +01:00
81c19d2927 docs: Update HISTORY.md with vhost routing fixes and Glances install
- Fixed mitmproxy duplicate routes causing mixed content
- Fixed play.maegia.tv, client, social backends
- Installed Glances 4.5.0.4 via pip3
- Verified 70+ vhosts operational

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 11:31:09 +01:00
189c2a405e docs: Update HISTORY.md with Domoticz exposure and WAF fix
- Documented home.maegia.tv (Domoticz) exposure
- Documented WAF redirect loop fix for gk2.secubox.in
- Added mitmproxy-in configuration changes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 10:59:05 +01:00
cd53d508fa feat(jellyfin): Update to v3.0.0 with LXC-based deployment
- Rebuilt secubox-app-jellyfin package with LXC controller
- Updated package feed with new Jellyfin ipk
- Synced all SecuBox packages to local feed

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 09:48:51 +01:00
2b8fb1cd62 feat(apps): Convert Docker-based apps to LXC
Converted secubox-app-jellyfin, secubox-app-mailserver, and added
secubox-app-roundcube to use LXC containers instead of Docker.

Changes:
- jellyfinctl: Now uses LXC at 192.168.255.31
- mailserverctl: New controller for Alpine LXC with Postfix/Dovecot
- roundcubectl: New package for Roundcube webmail LXC

All controllers support:
- Bootstrap Alpine rootfs using static apk
- LXC configuration generation
- HAProxy integration with waf_bypass
- Start/stop/status commands

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 09:07:33 +01:00
3d78b22d85 docs: Document Docker to LXC migration for mail and media services
Migrated services from Docker to LXC:
- mailserver: Postfix/Dovecot on Alpine (192.168.255.30)
- roundcube: Webmail on Alpine with nginx/PHP (port 8027)
- jellyfin: Media server on Debian (192.168.255.31)

All Docker containers removed, auto-start via /etc/init.d/secubox-lxc

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 09:02:11 +01:00
2637fb516b fix(haproxy): Add waf_bypass option for WebSocket-heavy apps
Streamlit apps require WebSocket connections that mitmproxy WAF
doesn't handle properly. Added waf_bypass UCI option to allow
specific vhosts to route directly to backends while other
services still get WAF protection.

- Add waf_bypass option check in haproxyctl
- Vhosts with waf_bypass=1 skip mitmproxy_inspector
- Fixes blank page issue with Streamlit apps

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 08:03:27 +01:00
b62f82b77e feat(gotosocial): Migrate to LXC container with Alpine rootfs
- Create Alpine 3.21 LXC container with gcompat for glibc compatibility
- GoToSocial v0.17.0 runs inside container with host networking
- Data directory bind-mounted at /data inside container
- Add user management commands via chroot/lxc-attach
- Add `shell` command for container access
- Add `user password` command for password resets
- Fix architecture variable naming (aarch64/arm64 confusion)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 07:16:54 +01:00
85dd9a4bdc feat(pinafore): Add Mastodon client hub package
Creates a landing page with links to public Mastodon clients
(Pinafore, Elk, Semaphore) pre-configured for the local GoToSocial
instance.

- pinaforectl install [instance] - Create client hub
- pinaforectl start/stop - Manage uhttpd server
- pinaforectl emancipate <domain> - Expose via HAProxy

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 06:34:40 +01:00
82f167a8d5 fix(gotosocial): Fix config paths and CLI flags
- Change db-address from /data/ to /srv/gotosocial/ for direct host mode
- Change storage path from /data/ to /srv/gotosocial/
- Fix --config to --config-path to match GoToSocial v0.17 CLI

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 06:28:09 +01:00
d98bcdf7f4 fix(mitmproxy): Sync routes to all instance data paths
The sync-routes command was only writing to the default /srv/mitmproxy
path. Now copies haproxy-routes.json to all configured instances
(mitmproxy-in, mitmproxy-out) so the HAProxy router addon can
properly route traffic.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 06:13:45 +01:00
507263f6a7 fix(mitmproxy): Sync autoban config to all instances
The reload-autoban command was only writing to the default data path,
missing the mitmproxy-in and mitmproxy-out instances. Now iterates
over all configured instances to ensure autoban.json is updated
everywhere.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 06:03:46 +01:00
1fcddb6de3 fix(luci-mitmproxy): Preserve autoban enabled state on save
Add rmempty=false to autoban enabled flag to prevent LuCI from
removing the option when saving the form. This fixes the issue
where saving settings would reset autoban to disabled.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 05:56:01 +01:00
cac9fa3e4f fix(mitmproxy): Fix false positives for legitimate browsers
- Remove 'mozilla/5.0' from BOT_SIGNATURES - was flagging ALL modern
  browsers as bots since this is the standard UA prefix
- Fix suspicious UA detection - no longer flags normal browsers
- Increase CrowdSec bruteforce threshold from 5/30s to 10/60s to reduce
  false positives from normal login flows

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 05:51:53 +01:00
2bc8c29f94 feat(luci-mitmproxy): Add Auto-ban settings with sensitivity control
Add new Auto-ban section to mitmproxy settings page with:
- Sensitivity level switch (Strict/Moderate/Permissive)
- Minimum severity threshold
- Ban duration configuration
- Per-threat-type ban toggles (SQLi, CVE, scanners, etc.)
- Bot whitelist configuration

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 05:41:02 +01:00
418cb2c76e fix(mitmproxy): Fix SSRF false positives for internal traffic
SSRF detection was triggering on any request to internal IPs
(192.168.x.x, 10.x.x.x, etc.) because it was checking the target
URL itself. Now only checks query parameters and request body for
SSRF patterns, which is where actual SSRF attacks occur.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 05:38:26 +01:00
cafe8196ac feat(haproxy): Add global WAF routing option
Add `waf_enabled` and `waf_backend` options to haproxy.main config.
When waf_enabled=1, all vhost and path-based routing goes through
the WAF backend (default: mitmproxy_inspector) instead of directly
to service backends.

This enables global traffic inspection through mitmproxy WAF while
maintaining proper routing via haproxy_router addon.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 05:29:35 +01:00
5fa5924533 fix(mitmproxy): Add per-instance haproxy_router_enabled override
Allow disabling HAProxy router mode per-instance via UCI option
`mitmproxy.<instance>.haproxy_router_enabled`. This prevents port
conflicts when running multiple mitmproxy instances (e.g., mitmproxy-out
on 8888 and mitmproxy-in on 8889) where only the inbound instance
needs HAProxy router mode.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 05:21:07 +01:00
51b301d980 docs: Add GoToSocial deployment to tracking files
- HISTORY.md: Entry #60 documenting GoToSocial v0.17.0 deployment
- WIP.md: Added to Just Completed section
- Includes HAProxy exposure, admin user setup, key fixes

Live at https://social.gk2.secubox.in

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 16:37:59 +01:00
b8d34e7e3a fix(haproxy): Use LAN IP for backends (HAProxy runs in LXC container)
- metablogizer: Use network.lan.ipaddr instead of 127.0.0.1 for server address
- service-registry: Same fix for emancipate function
- hexojs: Same fix for HAProxy backend creation
- gotosocial: Switch from LXC to direct execution mode
  - v0.18.0 has cgroup bugs, using v0.17.0 instead
  - Remove LXC container dependency
  - Use /srv/gotosocial for binary and data
  - Add proper PID file management

The HAProxy container cannot reach 127.0.0.1 on the host, so all HAProxy
backend servers must use the LAN IP (typically 192.168.255.1).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 14:49:50 +01:00
f20bb1df6b feat(gotosocial): Add GoToSocial Fediverse server packages
Add secubox-app-gotosocial and luci-app-gotosocial for running a lightweight
ActivityPub social network server in LXC container.

Features:
- gotosocialctl CLI with install, start, stop, user management
- LXC container deployment (ARM64)
- HAProxy integration via emancipate command
- UCI configuration for instance, container, proxy, federation settings
- LuCI web interface with overview, users, and settings tabs
- Mesh integration support for auto-federation between SecuBox nodes
- Backup/restore functionality

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 13:52:58 +01:00
92b422e900 fix(gitea): Remove cgroup mount to fix LXC startup on some kernels
- Remove cgroup:mixed from lxc.mount.auto (causes "Failed to create
  cgroup at_mnt" error on certain kernel configurations)
- Disable cgroup memory limit since cgroup is not mounted
- Fixes Gitea container failing to start with cgroup mount errors

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 13:41:58 +01:00
747d1ffbaa perf(secubox-p2p): Optimize shared services for faster LuCI response
- Skip IPv6 addresses and use active_address when available
- Filter out local node from shared services query
- Increase curl max-time to 10s for slow CGI responses
- Skip null/empty peer addresses
- Reduces response time from 48s to ~5s

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 12:20:44 +01:00
2248785ff6 fix(secubox-p2p): Fix shared services endpoint and add peer attribution
- Change service endpoint from port 8080 to /cgi-bin/p2p-services
- Exclude local node from shared services query
- Extract .services array from response JSON
- Add peer address to each shared service for attribution
- Handle empty/null responses gracefully

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 11:03:36 +01:00
e1a8413fa7 feat(led): Add safe LED script for MochaBin
- 1 second delay between I2C writes to prevent bus lockup
- Error detection with backoff
- Max 3 consecutive errors then stops
- 10 second update interval
- Commands: start, stop, status, test

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 09:28:39 +01:00
36e61cead8 fix(streamlit): Fix emancipate to use app name not instance name
The emancipate function was checking for app folder existence using
instance name (e.g., "pix") instead of the actual app name
(e.g., "bazi_calculator"). Now properly resolves app from UCI config.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 08:59:18 +01:00
004fc32725 feat(secubox-p2p): Add mesh-sync-packages for simple IPK deployment
Simple tool to sync LuCI resources, views, RPCD handlers, ACLs and
menus from master node to all mesh peers. No IPK rebuild required.

Usage: mesh-sync-packages

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 08:49:19 +01:00
06f93297a5 feat(streamlit): Add ACL rules and mesh distribution to emancipate
- Added _emancipate_acl() to create HAProxy ACL routing rules
- Added _emancipate_mesh() to distribute emancipated services to P2P peers
- Added cmd_emancipate_all() for bulk emancipation of all instances
- Emancipate now: DNS + Vortex + HAProxy + ACL + SSL + Mesh + Reload

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 08:48:30 +01:00
c1fa622eee fix(secubox-p2p): Remove invalid 'local' in case statement
BusyBox ash doesn't support 'local' keyword outside functions.
This was causing health_check RPC to hang with no response.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 08:40:14 +01:00
e52fdfc299 fix(secubox-p2p): Fix discoverPeers API method name
Changed P2PAPI.discoverPeers() to P2PAPI.discover() to match the
actual method exposed by the API module.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 08:32:16 +01:00
aa13009f54 fix(luci-app-secubox-p2p): Move menu to admin/services/secubox-p2p
Rename from admin/secubox/mirrorbox to admin/services/secubox-p2p
for consistent URL structure with other service apps.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 08:29:21 +01:00
b4fcccfbf9 feat(luci-app-cloner): Add partition tools to ASU builds
- Add fdisk, resize2fs, partx-utils to ASU package list
- Enables partition expansion on first boot for fresh installs
- Addresses kernel limitation with online ext4 resize

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 08:13:53 +01:00
4ee7fe2143 fix(luci-app-cloner): Fix SSH host key mismatch and button disabled issues
- Fix build button being unclickable by properly handling disabled attribute
  (only set when isBuilding is true, not undefined/false)
- Fix SSH host key mismatch errors in do_scp by cleaning stale known_hosts
  entries from all possible locations (/root/.ssh, /.ssh, /overlay/upper/.ssh)
  before transfers - prevents failures after device reflash
- Add cursor:pointer style to build button for better UX

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 07:45:28 +01:00
b5b2b98b68 feat(luci-app-cloner): Add remote device management and ASU clone builder
- Add remote device management: scan_network, list_remotes, add_remote,
  remove_remote, remote_status, remote_upload, remote_flash RPCD methods
- Add secubox-asu-clone script for on-the-fly firmware generation via
  OpenWrt ASU (Attended Sysupgrade) API
- Include full LuCI packages in ASU builds (luci-base, luci-mod-admin-full,
  luci-mod-network, luci-mod-status, luci-mod-system, etc.)
- Add partition expansion script (10-expand-rootfs) to use full SD card/eMMC
  with proper UUID and boot config handling for both MBR and GPT
- Add robust provisioning script (99-secubox-provision) with network retry,
  firewall handling, and SecuBox package installation from local feed
- Use dropbear's dbclient for SSH operations (OpenWrt native)
- Support mochabin, espressobin-v7, espressobin-ultra, x86-64 devices
- Default to OpenWrt version 24.10.5

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 07:30:36 +01:00
6fee51aed1 feat(streamlit): Add BaZi complete app with dark theme
- Four Pillars of Destiny (八字) calculator with French translations
- Dark theme styling: rgba backgrounds, light text colors
- Maître du Jour section with high contrast green accents
- Five Elements balance visualization
- Ten Gods relationships and yearly analysis

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 06:01:42 +01:00
3b453c495b fix(streamlit): Add poppler-utils for PDF support
Required by pdf2image to convert PDFs to images in apps like pdf_slideshow.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 03:36:07 +01:00
029e0112fb feat(streamlit): Add Tong Shu Chinese Almanac app (wuyun_liuqi)
- Add 通書 Tong Shu almanac with Wu Yun Liu Qi calculations
- Dark theme compatible styling with transparent backgrounds
- French translations for zodiac animals and Chinese terms
- Uses st.html() for proper HTML rendering in Streamlit 1.33+
- Includes: Four Pillars, Day Quality, Clash/Directions, Activities

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-12 16:00:01 +01:00
a472e755ea feat(gk2hub): Add GK2 Hub landing page generator package
New package secubox-app-gk2hub provides:
- /usr/bin/gk2hub-generate: Dynamic landing page generator
- /www/gk2-hub/index.html: Served via uhttpd

Aggregates services from:
- Streamlit instances (from UCI config)
- MetaBlogizer sites (from /srv/metablogizer/sites/)
- Infrastructure services (hardcoded)

Auto-regenerates on install via postinst script.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-12 14:41:53 +01:00
9ad45d6b1d feat(haproxy,metablogizer,streamlit): Add GK2 Hub landing page regeneration hooks
Add hooks to auto-regenerate the GK2 Hub landing page when services change:
- haproxyctl: vhost add/remove, reload
- metablogizerctl: publish, delete, emancipate
- streamlitctl: instance add/remove, app delete, emancipate

The gk2hub-generate script dynamically builds the landing page from
HAProxy vhosts, Streamlit instances, and MetaBlogizer sites.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-12 14:35:51 +01:00
9048f6b53b style(ndpid): Migrate dashboard and flows views to KISS theme
- Remove old secubox-theme and secubox-portal/header dependencies
- Remove external dashboard.css stylesheet
- Replace ndpid/api with direct RPC declarations
- Use KISS classes (kiss-card, kiss-stat, kiss-table, kiss-badge, kiss-btn)
- Add consistent navigation tabs
- Add poll toggle for auto-refresh control
- Use CSS variables (--kiss-blue, --kiss-green, --kiss-muted, etc.)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-12 13:51:36 +01:00
4ef8fdbe07 style(network-tweaks): Migrate overview.js to KISS theme
- Remove external CSS loading (dashboard.css)
- Convert impact cards to KISS grid with CSS variables
- Update proxy settings cards (AdGuard, CDN Cache, WPAD) to KISS styling
- Convert components grid and cards to KISS theme
- Update sync section and component details modal
- Use KissTheme.E() throughout with consistent styling

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-12 12:14:04 +01:00
7a9de56ba1 style(device-intel): Migrate dashboard views to KISS theme
- dashboard.js: KISS stats grid, source chips, type cards, recent devices table
- devices.js: KISS filter bar, device table with inline actions, edit/detail modals
- emulators.js: KISS emulator cards with status badges, mini tables
- mesh.js: KISS peer cards grid, remote devices table

Removes external CSS loading (cssLink pattern) and di-* class prefixes.
Uses KissTheme.E(), kiss-* classes, and CSS variables throughout.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-12 12:11:42 +01:00
04325c789f style(haproxy): Migrate acls.js and settings.js to KISS theme
ACLs & Routing (acls.js):
- Removed CSS import, replaced cbi- classes with kiss- classes
- Add ACL form with name, type, pattern, backend selector
- Add Redirect form with match host, target, code options
- KISS-styled tables for ACL and redirect rules
- Delete confirmation modals and toast notifications

Settings (settings.js):
- Removed CSS import, replaced cbi- classes with kiss- classes
- Service settings: enable, ports, max connections, memory, log level
- Statistics dashboard: enable, port, username, password
- Timeouts: connect, client, server, HTTP request, keep-alive, retries
- ACME/Let's Encrypt: enable, email, staging, key type, renew days
- KISS-styled form inputs with grid layout

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-12 12:06:23 +01:00
1ff116e93d style(haproxy): Migrate overview.js to KISS theme
Rewrote HAProxy Overview dashboard to use KissTheme:
- Removed external dashboard.css loading
- Replaced all hp- classes with kiss- classes
- Emergency banner with service status and controls
- Stats grid with vhosts, backends, certs counts
- System health grid with container/haproxy/config status
- Virtual hosts table preview
- Backends and certificates cards
- Quick actions grid (start/stop/reload/validate/regenerate/stats)
- Connection details with endpoints
- KISS toast notifications

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-12 12:03:55 +01:00
c5e4d5a903 style(haproxy): Migrate stats.js to KISS theme
Rewrote HAProxy Statistics dashboard to use KissTheme:
- Removed CSS import via style element
- Replaced all hp- classes with kiss- classes
- Stats iframe with KISS-styled border
- Logs viewer with line count selector and refresh button
- Empty state for disabled stats or stopped service
- Consistent styling with vhosts.js and backends.js

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-12 11:58:22 +01:00
053c49217c style(haproxy): Migrate backends.js to KISS theme
Rewrote HAProxy Backends dashboard to use KissTheme:
- Removed external dashboard.css dependency
- Replaced all hp- classes with kiss- classes and inline styles
- Self-contained inline CSS using KISS variables
- Backend cards with server lists, health check info
- Add backend form with mode, balance, health check options
- Add/edit server modals with quick service selector
- Delete confirmations and toast notifications
- Consistent styling with vhosts.js

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-12 11:56:22 +01:00