Commit Graph

508 Commits

Author SHA1 Message Date
d3b7b8ba9b fix(mitmproxy): Fix alerts display by reading from correct log path
The RPCD was looking for alerts in /tmp/secubox-mitm-alerts.json but
the analytics addon writes to /var/log/crowdsec/secubox-mitm.log in
JSONL format (one JSON object per line).

Changes:
- RPCD: Read from container's /var/log/crowdsec/secubox-mitm.log
- RPCD: Convert JSONL to JSON array using awk
- JS: Handle new field names (source_ip, timestamp, request)

Alerts now display correctly in LuCI dashboard.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 18:37:21 +01:00
0dd6b28d1a fix(mitmproxy): Fix HAProxy backend route sync for new-style UCI configs
The sync-routes command was failing to generate routes for most vhosts due to:
- Subshell bug: pipe in while loop caused variable changes to be lost
- Only supported old-style backends (inline .server field)
- Did not support new-style backends with separate =server sections

Changes:
- Rewrite sync-routes to avoid subshell by using temp file
- Add support for both backend styles (inline and separate server sections)
- Use original_backend field when vhosts are in inspection mode
- Skip luci/fallback/mitmproxy_inspector backends in route generation

Now properly generates 13+ routes for HAProxy backend inspection.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 16:17:29 +01:00
2b8d786a72 docs(mitmproxy): Update README and fix Makefile for HAProxy router addon
- Add haproxy_router.py to package install targets
- Document HAProxy backend inspection feature
- Document threat detection patterns
- Document Web UI token authentication
- Update RPCD API documentation
- Bump secubox-app-mitmproxy to r18

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 15:58:11 +01:00
92f73fc3d2 feat(mitmproxy): Add HAProxy backend inspection and token auth
- Add HAProxy → mitmproxy → Backend inspection chain for filtering
  all vhost traffic through mitmproxy with threat detection
- Add haproxy_router.py addon for Host-based request routing
- Add mitmproxyctl commands: sync-routes, haproxy-enable, haproxy-disable
- Add auth token to status response for Web UI auto-authentication
- Add HAProxy Backend Inspection section to LuCI status page with
  enable/disable/sync controls
- Add HAProxy Router settings section to LuCI settings page
- LXC container now supports dual-port mode (8888 + 8889 for HAProxy)
- Token displayed with copy button in dashboard

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 15:49:05 +01:00
a6d2b75db8 feat(mitmproxy): Enhanced threat detection analytics v2.0
Analytics addon enhancements:
- SQL injection detection (25+ patterns)
- XSS detection (30+ patterns)
- Command injection detection (20+ patterns)
- Path traversal detection (12+ patterns)
- SSRF detection (10+ patterns)
- XXE/LDAP injection detection
- Log4Shell (CVE-2021-44228) detection
- Known CVE patterns (Spring4Shell, MOVEit, etc.)
- Rate limiting and bot detection
- CrowdSec integration with severity levels

LuCI interface rewrite (KISS):
- Simplified status view with threat monitor
- Security alerts table with severity badges
- Service controls (start/stop/restart)
- RPCD backend with alerts/threat_stats endpoints
- Clean settings form

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 15:39:36 +01:00
15e04b58a5 feat(core): Add secubox-swiss unified CLI tool
Swiss Army knife for SecuBox with interactive menu and direct commands:
- status: System overview with services, docker, mesh
- mesh: P2P mesh operations (peers, discover, sync)
- security: CrowdSec status, threats, block/unblock
- docker: Container management
- haproxy: Vhosts and reload
- network: Diagnostics, ports, connections
- recover: Snapshot/restore operations
- feed: Package management

Also updates feed with Jitsi packages and core v0.10.0-r11.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 13:52:32 +01:00
00082fe066 feat(jitsi): Add Jitsi Meet video conferencing integration
- secubox-app-jitsi: Docker-based Jitsi stack with jitsctl control CLI
- luci-app-jitsi: LuCI web configuration interface
- Catalog entry for SecuBox AppStore

Features:
- End-to-end encrypted video conferencing
- HAProxy integration with WebSocket/SSL support
- Mesh federation for SecuBox P2P network
- User authentication management
- Backup/restore functionality

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 13:29:06 +01:00
760408c36f feat(p2p): Release v0.6.0 - MirrorBox NetMesh Catalog
- Distributed service registry with HAProxy vhost discovery
- Multi-endpoint URLs (haproxy/mesh/local) per service
- DNS federation for mesh peers (*.sb.local via dnsmasq)
- Catalog tab with service filtering and QR codes
- Linked peers navigation panel
- Tools panel with DNS management

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 11:56:18 +01:00
163c74e25f fix(p2p): Use /api/factory/ path for CGI endpoints
Separate static files from CGI scripts in uhttpd configuration:
- Static files (index.html) served from /www
- CGI scripts executed from /www/api/*
- API base changed from /factory/ to /api/factory/

This fixes HAProxy routing where /factory/ serves the UI and
/api/factory/* routes to the P2P API backend.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 10:00:59 +01:00
eec83efa13 feat(p2p): Add MirrorBox NetMesh Catalog with DNS federation
Implement distributed service catalog that discovers HAProxy vhosts
and provides multi-endpoint access URLs (haproxy/mesh/local). Add
dynamic DNS federation that auto-populates dnsmasq with mesh peer
hostnames (hostname.mesh.local).

New features:
- /factory/catalog API endpoint with service registry
- Catalog tab (📚) in Factory UI with endpoint filtering
- QR codes with URL type switching (haproxy/mesh/local)
- Linked mesh peers navigation panel
- DNS federation via /tmp/hosts/secubox-mesh
- CLI commands: dns-enable/disable/update, catalog sync/list/generate

Bumps secubox-p2p to v0.6.0.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 09:19:36 +01:00
cf115b346a feat(p2p): Add distributed mesh services panel
- Add mesh-services CGI endpoint for aggregated service discovery
  across all mesh peers
- Update Factory UI with tabbed interface: Dashboard and Mesh Services
- Mesh Services panel features:
  - Real-time service discovery from all nodes
  - Filter by search, status, or node
  - Direct access links for services with ports
  - Status indicators (running/stopped/disabled)
  - Summary stats (nodes online, running/total services)
- Bump version to 0.5.0

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 08:56:22 +01:00
f9a26f1351 fix(factory): Use same-origin API calls for HAProxy compatibility
Change API base URL to use relative /factory/ path instead of
absolute URL with port 7331. HAProxy routes /factory/* API paths
to the factory backend while serving UI from luci backend.

This fixes mixed content blocking when accessing via HTTPS.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 08:46:25 +01:00
9d46ff51f3 fix(factory): Use HMAC-style signing for OpenWrt compatibility
- Replace signify-openbsd calls with HMAC-based signatures
  (OpenWrt's signify lacks -n flag for no-passphrase)
- Fix API paths in UI: use /factory/ not /api/factory/
- Support cross-port API calls (UI on 8081, API on 7331)
- Update LuCI view to use relative /factory/ path
- Update feed with secubox-p2p 0.4.0 packages

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 08:15:24 +01:00
a9130715e9 feat(p2p): Add SecuBox Factory unified dashboard with signed Merkle snapshots
Implement mesh-distributed, cryptographically-validated control center:

- Add factory.sh library with Ed25519 signing via signify-openbsd
- Add Merkle tree calculation for /etc/config validation
- Add CGI endpoints: dashboard, tools, run, snapshot, pubkey
- Add KISS Web UI (~280 lines vanilla JS, inline CSS, zero deps)
- Add gossip-based 3-peer fanout for snapshot synchronization
- Add offline operations queue with replay on reconnect
- Add LuCI iframe integration under MirrorBox > Factory tab
- Configure uhttpd alias for /factory/ on port 7331
- Bump secubox-p2p version to 0.4.0

Factory UI accessible at http://<device>:7331/factory/

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 08:03:54 +01:00
bdda4df59c feat(secubox-app-bonus): Update feed with P2P v0.3.0 and portal KISS redesign
- secubox-p2p upgraded to v0.3.0 with multi-address mesh support
  - WAN IP detection via ipify/ifconfig.me for NAT traversal
  - WireGuard tunnel IP enumeration for secure redundancy
  - Failover priority: WireGuard → WAN → LAN
- luci-app-secubox-portal KISS redesign (~1000 → ~500 lines)
  - Service categorization: Web/Proxy, Security, AI/ML, Containers, Media, Apps
  - Dynamic init.d service scanning with 60s caching
- Rebuilt all packages in feed

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 07:39:15 +01:00
52d21d89c6 chore(p2p): Bump version to 0.3.0
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 07:35:03 +01:00
bb1c2555ef feat(p2p): Add WAN IP and WireGuard tunnel redundancy support
- Add get_wan_ip() to detect real WAN/public IP address
- Add get_wg_ips() to enumerate WireGuard tunnel addresses
- Add get_node_addresses() returning JSON array of all addresses
- Update register_self() to include WAN and WireGuard addresses
- Update get_node_status() API to expose all addresses
- Update add_peer() to support multi-address peers
- Update daemon connectivity check to try:
  1. WireGuard tunnel (secure redundancy)
  2. WAN address (external reach)
  3. LAN address (local fallback)
- Add UCI options: advertise_wan, advertise_wireguard, prefer_wireguard
- Version bump to 0.3.0

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 07:22:38 +01:00
5a2655f0ef refactor(portal): KISS redesign with service categorization
- Simplify portal to ~500 lines (from ~1000)
- Add service categories: Web/Proxy, Security, AI/ML, Containers, Media, Apps
- Dynamic init.d service scanning with status detection
- Clean dark theme with inline CSS (no external dependencies)
- Quick stats: Services, Memory, Uptime, Network
- Active ports section for external services
- Responsive grid layouts for all screen sizes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 07:20:02 +01:00
8df75f6c06 feat(console): Add Services tab with peer service discovery
- Add Services tab to TUI displaying services from all mesh peers
- Implement get_peer_services() fetching via P2P API (port 7331/services)
- Add 60-second caching to avoid slow repeated API calls
- Group services into categories: Web/Proxy, Security, AI/ML, Containers, Apps
- Fix service endpoint URL: /services not /api/services
- Increase API timeout to 15s for comprehensive service scans
- Version bump to 1.2.0

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 07:15:46 +01:00
31f4db881e refactor(crowdsec-dashboard): KISS rewrite and move to Services menu
- Rewrite all views with KISS CSS (1200+ lines removed)
- Use unified cs-* CSS prefix with SecuBox theme variables
- Move CrowdSec from Security to Services menu
- Update navigation paths in all views and nav.js
- Add CSS loading in each view's load() function
- Fix Services menu as proper firstchild submenu
- Simplify dashboard.css from 950+ to 112 lines

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 06:51:13 +01:00
357f16bf93 feat(secubox-console): Add mesh peer self-registration and TUI improvements
- Console v1.1.0 with mesh participation as first-class peer
- Add announce command to register console on mesh devices
- Add mesh command to query P2P network status and peers
- Improve discovery with 3-phase approach (mesh peers, network scan, probe)
- Implement working update mechanism with SSH-based downloads
- Add proper Add Device modal dialog in Textual TUI
- Add Discover dialog with async progress display
- Show console identity in Mesh tab (node ID, name, IP, port)
- Auto-announce during discover and sync operations
- Add announce button and keybinding (m) in TUI

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 06:46:31 +01:00
3a8555b207 fix(secubox-p2p): Fix RPC expect array handling in peers view
The RPC `expect: { peers: [] }` extracts the array directly, so result
IS the peers array, not result.peers. Added Array.isArray() defensive
check for consistent handling.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 06:04:54 +01:00
3a64be9c38 fix(secubox-p2p): Ensure local node always appears in peers list
- Fix register_self() to handle JSON whitespace with awk
- Update get_peers() to auto-register local node if peers list is empty
- Ensure node identity is initialized before querying peers

This ensures C3BOX always shows itself in the P2P Hub peers view.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 05:51:57 +01:00
931c4b1dfc fix(crowdsec-dashboard): Add ACL permissions for settings methods
Add get_settings to read permissions and save_settings to write permissions
to fix RPC access denied error (-32002) on the settings page.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 05:44:59 +01:00
45f222e72c feat(secubox-core): Add P2P mesh API endpoints for console discovery
- Add /chain/tip endpoint for blockchain tip query
- Add /catalog/console endpoint for version info
- Add symlinks for /api/ prefix compatibility
- Fix chain.json malformed JSON structure

Enables console to discover C3BOX device via mesh API

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 05:40:03 +01:00
8f6eeede06 feat(crowdsec): Add console enrollment & integrate SecuBox theme
- Add Console Enrollment section to settings with persistent key storage
- Integrate CrowdSec CSS with SecuBox global theme variables (--cyber-*)
- Fix modules.js install button and add installModule function
- Map cs-*, soc-*, sh-* CSS variables to SecuBox theme for consistency

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 05:34:31 +01:00
54d16a5655 fix(crowdsec-dashboard): Show CAPI as connected when credentials exist
CAPI status now shows "Connected" when either enrolled or LAPI is available,
fixing misleading "Disconnected" display when CAPI is actually working.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 05:13:26 +01:00
dc73b45722 refactor(crowdsec-dashboard): Remove theming system
- Remove theme.js and themes/ directory (classic, cards, cyberpunk)
- Remove theme selector from settings page
- Use fixed 'cs-theme-classic' class in overview and settings views
- Simplify load() functions by removing theme.init() calls

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 05:04:16 +01:00
19b96e50d0 fix(crowdsec-dashboard): Dynamic port and path detection for LAPI/GeoIP
- Replace hardcoded port 8180 with dynamic detection from credentials file
- Extract LAPI port from local_api_credentials.yaml URL
- Convert port to hex for /proc/net/tcp lookup
- Fix GeoIP database path detection (check /srv/crowdsec/data and /var/lib)
- Update default API URL fallback to 8090 (actual CrowdSec default)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 04:55:19 +01:00
97790f0dcb fix(metablogizer): Skip frontend HTTP checks for DNS mismatch sites
When a site's DNS doesn't point to our public IP, skip the external
HTTP check to avoid 5-second timeouts. This significantly speeds up
the get_hosting_status API call which was causing XHR timeouts in
the LuCI frontend.

Sites with DNS mismatch now show frontend_status: "dns_mismatch"
instead of timing out.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 20:43:56 +01:00
374803715f fix(vhost-manager): Remove invalid local declarations in case handlers
BusyBox ash does not support 'local' keyword outside of functions.
Removed 'local' from update_vhost case handler to fix "not in a function"
error that caused ubus calls to fail with no response.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:46:28 +01:00
ce512bbda0 feat(p2p): Add mDNS service publishing and REST API for mesh visibility
- Add mDNS service announcement via avahi-publish for _secubox._tcp
- Add REST API endpoints on port 7331 (/api/peers, /api/status, /api/services)
- Add node self-registration to ensure local node visible in mesh view
- Add UCI defaults for uhttpd P2P API instance and firewall rules
- Bump secubox-p2p version to 0.2.0

fix(vhost-manager): Fix uninitialized variable syntax errors

- Add 'local' keyword to variable declarations on lines 606, 621, 693

fix(metablogizer,service-registry): Add HAProxy availability fallback

- Add haproxy_available() helper to check if HAProxy is running
- Gracefully skip HAProxy operations when service unavailable
- Store pending HAProxy config for later when service becomes available
- Prevent crashes when HAProxy container is stopped

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:46:28 +01:00
4166f4574e fix(metablogizer): Ensure file permissions on every upload
- Set umask 022 before file operations
- chmod 644 immediately after base64 decode
- chmod 755 on site_path after each upload
- Prevents 403 Forbidden from restrictive permissions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:46:28 +01:00
0562730b5f feat(metablogizer): Add Tor hidden service integration
Dynamic .onion address generation for hosted sites:
- enable_tor: Create Tor hidden service for a site
- disable_tor: Remove Tor hidden service
- get_tor_status: Get Tor status for all sites
- Sites now include onion_address and onion_url in listings

When enabled, sites are accessible via both:
- Public domain (https://domain.com)
- Tor hidden service (http://xxx.onion)

Also includes DNS resolution fix using Google DNS API.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:46:28 +01:00
95ff73f6e7 fix(metablogizer): Fix DNS resolution parsing (127.0.0.1:53 bug)
KISS approach to DNS resolution:
1. Primary: Use Google DNS API (https://dns.google/resolve)
   - Most reliable, bypasses local resolver issues
2. Fallback: nslookup with tail -1 to skip DNS server line
3. Fallback: host command

The bug was parsing nslookup output which includes DNS server
address (127.0.0.1) before the actual resolved IP.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:46:28 +01:00
e318ca2ba1 fix(metablogizer): Fix 403 Forbidden with improved permissions
- Enhanced fix_permissions() with umask 022 and parent dir traversal
- Added chmod 644 immediately after file write in upload_file
- Added repair_site RPC method for troubleshooting:
  - Fixes file/dir permissions
  - Creates missing index.html
  - Reloads uhttpd and HAProxy

Usage: ubus call luci.metablogizer repair_site '{"id":"site_sliders"}'

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:46:28 +01:00
d2805c35bd feat(streamlit): Add ZIP upload with selective tree extraction
- apps.js: ZIP file upload with tree view file selection
  - Client-side ZIP parsing for file list preview
  - Interactive tree with checkboxes for file selection
  - Select All / Deselect All / Python Only buttons
  - Supports both .py and .zip file uploads

- api.js: Added previewZip() and uploadZip() RPC methods

- luci.streamlit RPCD:
  - preview_zip: List ZIP contents with file sizes
  - upload_zip: Extract selected files to app directory
  - Automatic main .py file detection and registration

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:46:28 +01:00
a8ca00b04d docs(console): Complete CLI Tools Lexical Reference
Comprehensive documentation for all 29 secubox-* CLI tools:
- Core System: secubox-core, secubox-swiss, secubox-state, secubox-component
- Recovery: secubox-recover, secubox-recovery, secubox-restore
- Mesh/P2P: secubox-mesh, secubox-p2p, secubox-sync-registry, secubox-catalog-sync
- Registry: secubox-registry, secubox-landing-gen, secubox-exposure, secubox-wan-access
- Apps: secubox-app, secubox-appstore, secubox-skill, secubox-profile
- Feed: secubox-feed, secubox-feed-health, secubox-feed-manager
- Diagnostics: secubox-diagnostics, secubox-log, secubox-stats, secubox-verify
- Specialized: secubox-webapp-setup, secubox-netifyd-configure, secubox-mitm-logs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:46:28 +01:00
d1e713e282 feat(console): Add Linux host frontend with modern TUI
- secubox_frontend.py: Full-featured Textual TUI application
  - Multi-device dashboard with real-time status monitoring
  - Device discovery (network scan, mDNS, mesh API)
  - SSH-based remote command execution and backup orchestration
  - Tabbed interface: Dashboard, Alerts, Mesh, Settings
  - Graceful degradation: Textual → Rich → Simple CLI

- Support files:
  - install.sh: One-line installer with dependency handling
  - requirements.txt: Python dependencies (textual, paramiko, httpx, rich)
  - secubox-frontend: Launcher script with path detection

- Updated README.md: Documents both CLI console and TUI frontend

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:46:28 +01:00
005d1fd5d4 docs: Add README for secubox-console and secubox-swiss
- secubox-console: Python remote management CLI/TUI
  - Device discovery, multi-device management
  - Plugin system, self-updating
  - Live dashboard with rich TUI

- secubox-swiss: Unified Swiss Army Knife tool
  - Quick actions (status, backup, reborn, sync, health)
  - Tool dispatch to mesh/recover/console/mitm
  - Interactive menu and self-enhancement

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:46:28 +01:00
9acab29c34 feat(v0.17): P2P Mesh Recovery, MITM Analytics, Swiss Army Knife
Major features:
- P2P Mesh distributed recovery infrastructure with blockchain catalog
- MITM analytics proxy for external access monitoring (IP, country, scans)
- SecuBox Swiss unified CLI tool for management & recovery
- Python remote management console (secubox-console)
- Multi-theme landing page generator (mirrorbox, cyberpunk, minimal, terminal, light)
- Service Registry enhancements with health check and network diagnostics
- Services page modernization with Service Registry API integration

New components:
- secubox-swiss: Swiss Army Knife unified management tool
- secubox-mesh: P2P mesh networking and sync
- secubox-recover: Snapshot, profiles, rollback, reborn scripts
- secubox-console: Python remote management app
- secubox_analytics.py: MITM traffic analysis addon

Fixes:
- Service Registry ACL permissions for secubox services page
- Port status display (firewall_open detection)
- RPC response handling for list_services

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:46:28 +01:00
e548d210b7 fix: CDN cache ACL permissions and Tor Shield IP detection
CDN Cache:
- Add file read permissions for cache, logs, and SSL dirs
- Add new RPCD methods to ACL (get_ca_cert, set_ssl_bump)

Tor Shield:
- Create tor-ip-update.sh for caching exit/real IPs
- Use --socks5-hostname for DNS through Tor
- Add cron job for periodic IP updates

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:46:28 +01:00
1b6e9881c9 feat(cdn-cache): Add MITM SSL bump support for HTTPS caching
- Generate CA certificate for SSL bumping
- Initialize SSL certificate database with security_file_certgen
- Selective SSL bump: only cache-worthy domains (Windows Update, Steam, etc.)
- Exclude security-sensitive sites (banking, Google accounts, etc.)
- Proper firewall integration for both HTTP and HTTPS redirect
- RPCD methods for CA cert download and SSL bump control

Ports:
- 3128: Forward proxy
- 3129: HTTP transparent intercept
- 3130: HTTPS SSL bump intercept

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:46:28 +01:00
78f4fe4962 feat: Major updates - CDN cache with Squid, network modes UI rework, bugfixes
CDN Cache:
- Migrate from nginx to Squid proxy for better caching
- Add aggressive caching rules for Windows Update, Linux repos, Steam, Apple
- Proper firewall integration via UCI (transparent proxy)
- Real-time stats from Squid access logs

Network Modes:
- Complete UI rework with MirrorBox dark theme
- 9 network modes with emojis and descriptions
- Dynamic CSS animations and modern styling

Fixes:
- Fix jshn boolean handling in secubox-recovery (1/0 vs true/false)
- Fix nDPId RPCD to use netifyd as fallback DPI provider
- Update media-flow and security-threats dashboards

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:46:28 +01:00
b2fc1b27d8 feat(p2p): Add MirrorBox overview and profiles pages
Overview Page (SOC Admin Landing):
- Architecture diagram with layer visualization
- Modular component cards with status indicators
- Network topology with animated orbital nodes
- System status grid with health indicators
- Development roadmap timeline

Profiles Page (Dynamic Cloning):
- Component readiness tracking with progress bars
- Quick presets for common configurations
- Package feeds management with toggles
- Saved profiles list with load/delete
- Clone & deploy actions (export, import, sync, push)

Menu Structure:
- Renamed P2P Hub to MirrorBox
- Added Overview as landing page
- Added Profiles for cloning management

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:46:28 +01:00
4b2241c86e feat(p2p): Add MirrorBox auto-init, self-recovery, and ACL fixes
MirrorBox Auto-Init:
- Add blockchain-like gigogne P2P structure with peer zero (P0) genesis
- Auto-create self-mesh on page load with configurable depth
- Preserve MirrorBox peers during refresh cycles

Self-Recovery System:
- Add secubox-restore script for bootstrapping new OpenWrt boxes
- Generate customized bootstrap.sh in Gitea backups
- Support interactive and command-line restore modes

ACL Fixes:
- Add missing deploy/pull methods to luci-app-secubox-p2p ACL
- Add luci.gitea and luci.secubox-p2p access to luci-app-secubox ACL
- Fix null display issue in hub.js (changed to empty string)

Backup Enhancements:
- Fix syntax error in RPCD heredoc (openwrt_version line)
- Add branch reference to Gitea API calls (main branch)
- Include bootstrap.sh and secubox-restore in backup push

Documentation:
- Add comprehensive README.md for SecuBox P2P module

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:46:28 +01:00
8c0bed5af0 feat(gitea): Add RPCD methods for user, token, and repo creation
Add new RPCD methods to luci.gitea for P2P mesh auto-setup:

- create_user: Create regular Gitea user via CLI
- generate_token: Generate access token with configurable scopes
- create_repo: Create repository for a user via admin API

These methods enable automated P2P mesh repository setup without
requiring manual token generation in Gitea web UI.

Requires lxc-attach package for container access.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:46:28 +01:00
b7acc04a20 fix(p2p): Add ACL permissions for Gitea and backup RPCD methods
Add missing ACL permissions for new RPCD methods:

Read permissions:
- get_gitea_config
- list_gitea_repos
- get_gitea_commits
- list_local_backups

Write permissions:
- set_gitea_config
- create_gitea_repo
- push_gitea_backup
- pull_gitea_backup
- create_local_backup
- restore_local_backup

Fixes: RPC call failed with error -32002: Access denied

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:46:28 +01:00
d57e954d21 feat(p2p): Auto-create mesh repository without modal parameters
Add autoCreateMeshRepo() function that automatically:
- Generates repo name from hostname: secubox-mesh-{hostname}
- Detects local Gitea server (gitea.local, git.local, etc.)
- Only prompts for access token on first use (one-time setup)
- Creates private repository with README
- Pushes initial mesh state immediately

Replace manual " Create" button with "🚀 Auto Setup" for seamless
mesh repository initialization.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:46:28 +01:00
7c1bcbe585 feat(p2p): Add backend Gitea and backup support via secubox-core RPCD
Add complete backend implementation for Gitea integration and local backups
with admin permissions:

RPCD Methods (luci.secubox-p2p):
- get_gitea_config / set_gitea_config - Gitea server configuration
- create_gitea_repo - Create new Gitea repository via API
- list_gitea_repos - List user's Gitea repositories
- get_gitea_commits - Fetch commit history
- push_gitea_backup - Push config/packages/scripts to Gitea
- pull_gitea_backup - Restore from Gitea commit
- create_local_backup - Create local backup snapshot
- list_local_backups - List available local backups
- restore_local_backup - Restore from local backup

UCI Config (secubox-p2p):
- gitea section: server_url, repo_name, access_token, auto_backup options
- backup section: backup_dir, max_backups, auto_cleanup

Frontend (hub.js):
- Updated createGiteaRepo() to use backend API
- Updated backup functions to use backend storage
- Added refreshGiteaCommits() for real API calls
- Load function now fetches Gitea config and backup list

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:46:28 +01:00