Commit Graph

1038 Commits

Author SHA1 Message Date
7dd5f7cb8e feat(luci): Add SecuBox Metrics view under Status menu
New LuCI view at Status > SecuBox Metrics showing:
- System health (load, CPU, uptime)
- Resources (memory, disk)
- Services (HAProxy, sites, apps, Tor)
- Network connections
- Security stats (CrowdSec bans, attacks, countries)

Auto-refreshes every 10 seconds with cyberpunk styling.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 10:27:55 +01:00
b1c22b7f10 feat(dashboard): Add system overview infographic to LuCI admin
- Add get_system_overview RPCD method
- Add renderSystemOverview to admin dashboard.js
- Display system health, resources, services, network, security stats
- Styled with cyberpunk theme

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 10:21:15 +01:00
0f5fc39778 feat(core): Add secubox-dashboard system infographic tool
New CLI tool for system overview:
- Console mode: ASCII formatted dashboard
- JSON mode: Structured data for LuCI integration

Displays:
- System health (load, CPU, memory, disk)
- Services (HAProxy, MetaBlogizer, Streamlit, Tor)
- Network connections (total, Tor, HTTPS)
- Security stats (CrowdSec bans, attack types, countries)

Usage: secubox-dashboard [console|json]

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 10:11:29 +01:00
54113d8454 feat(gitea): Create repositories as private by default
Changed default visibility from public to private for new Gitea
repositories created by metablogizerctl and streamlitctl.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 08:22:33 +01:00
90f555f38a fix(secubox-core): Remove metablogizer from LXC watchdog
MetaBlogizer uses per-site uhttpd instances, not LXC containers.
The watchdog was incorrectly treating it as an LXC service and
constantly trying to restart a non-existent container.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 07:43:20 +01:00
d01aa59726 fix(streamlit): Fix typo n# -> # in RPCD handler
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 07:27:36 +01:00
7c1c3993e0 feat(gitea): Auto-push to Gitea after file uploads
- Add automatic Gitea push after upload_finalize in Streamlit RPCD
- Add automatic Gitea push after upload_finalize in MetaBlogizer RPCD
- Fix MetaBlogizer to use site name instead of UCI section ID for push
- Fix metablogizerctl to read Gitea config from dedicated gitea section

Uploaded files via LuCI are now automatically synced to Gitea repos.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 07:13:47 +01:00
c1c91f1227 feat: Auto-Gitea integration for apps and sites
Streamlit:
- App create/deploy now auto-pushes to Gitea when enabled
- Add 'gitea init-all' command to initialize repos for all existing apps
- Scans all app directories and creates Gitea repos

MetaBlogizer:
- Site create now auto-pushes to Gitea when token configured
- Add 'gitea init-all' command to initialize repos for all existing sites
- Iterates over UCI site configs and syncs to Gitea

Usage:
  # Configure Gitea once
  uci set streamlit.gitea.enabled=1
  uci set streamlit.gitea.url='http://192.168.255.1:3000'
  uci set streamlit.gitea.user='admin'
  uci set streamlit.gitea.token='<token>'
  uci commit streamlit

  # Initialize all existing apps/sites
  streamlitctl gitea init-all
  metablogizerctl gitea init-all

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 06:47:09 +01:00
364f19d421 feat: Add Gitea auto-push and fix Tor Shield server mode
Streamlit/MetaBlogizer:
- Add 'gitea push <name>' command to both streamlitctl and metablogizerctl
- Auto-creates Gitea repo via API if it doesn't exist
- Initializes git, commits all files, and pushes to Gitea
- Stores repo reference in UCI for future syncs

Tor Shield:
- Add 'wan_input_allow' option for server preset
- Server mode now properly allows WAN inbound (ports 80, 443, 8443)
- Uses nftables rules to integrate with OpenWrt firewall4
- Outbound traffic still routed through Tor (kill_switch)
- Cleanup nftables rules on stop/disable

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 06:42:50 +01:00
a694241604 fix(crowdsec): Fix alerts extraction in overview collector
Replace failing awk-based JSON parsing with jsonfilter per-alert extraction.
Alerts now correctly populate in CrowdSec dashboard.

Changes:
- Use jsonfilter to extract created_at, scenario, source_ip per alert
- Loop through up to 8 alerts with index-based access
- Remove Python dependency (not available on OpenWrt)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 06:07:57 +01:00
8b1c82ab5c fix(luci-mitmproxy): Fix alerts field mapping in Recent Alerts
Backend uses timestamp/source_ip but JS was looking for time/ip.
Fixed field mappings:
- timestamp -> time display
- source_ip -> ip display
- request -> details fallback

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 05:04:48 +01:00
32e744a808 fix(luci-mitmproxy): Add Recent Alerts section to status page
Alerts data was loaded but not displayed. Added new section showing:
- Time, IP, country, type, severity, details
- Limited to 25 most recent alerts
- Clear alerts button
- Proper severity colors and icons

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 04:59:36 +01:00
8332572737 chore: Add __pycache__ to gitignore
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-09 16:49:30 +01:00
744123b615 docs: Update FAQ with HAProxy SNI/certs.list troubleshooting
- Add HAProxy multi-domain SSL certificate matching issue
- Document crt-list solution for SNI issues
- Minor updates to settings and streamlit readme

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-09 16:49:02 +01:00
d76e26ed52 feat(cloner): Add U-Boot power-on intercept mode
- Add uboot_poweron_intercept() for aggressive boot interception
- Sends continuous break chars while monitoring for Marvell>> prompt
- Supports modes: break (default), poweron, wait
- Uses Python serial for precise timing and pattern detection
- Updates secubox-cloner with improved serial handling

Usage: ./secubox-clone-station.sh uboot /dev/ttyUSB0 poweron

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-09 16:48:36 +01:00
ee9a54b0a5 fix(waf): Add LuCI whitelist and moderate sensitivity mode
- Add TRUSTED_PATH_PREFIXES for LuCI, ubus, and CGI paths
- Fix moderate mode to always require threshold (3 attempts in 5 min)
  instead of immediate ban on critical threats
- Add WireGuard endpoint whitelist support to prevent VPN peer bans
- New script: mitmproxy-sync-wg-endpoints extracts peer IPs from UCI
- Bump version to v2.4

Prevents accidental bans from legitimate external LuCI login attempts.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-09 16:47:17 +01:00
2c7b92219e feat(mitmproxy): Add Active Bans panel to dashboard
Shows all CrowdSec bans with:
- IP address, reason, source (WAF/CrowdSec), country, expiration
- Summary counts: total, WAF autobans, CrowdSec detections
- Unban button for each entry with confirmation dialog
- Empty state when no bans active

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-09 07:24:39 +01:00
e9ef4a0e7e feat(mitmproxy): Add bans list and unban RPCD methods
New methods for threats monitor dashboard:
- bans: Get CrowdSec decisions with counts by source
  Returns total, mitmproxy_autoban, crowdsec counts + full bans array
- unban: Remove ban by IP address

Updates ACL to include new methods for LuCI access.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-09 07:21:58 +01:00
d0d060add1 feat(haproxy): Add dynamic path ACL management commands
New haproxyctl path commands:
- path list: Show all path ACLs with patterns and backends
- path sync <prefix> <host>: Auto-generate ACLs from all backends
  Extracts short name from backend (metablog_X -> X, streamlit_Y -> Y)
  Skips existing ACLs, only adds new ones
- path add: Manually add single path ACL
- path remove: Remove specific path ACL
- path clear: Remove all ACLs matching prefix

This enables dynamic route updates when backends change.
Example: haproxyctl path sync /gk2 secubox.in

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-09 06:56:54 +01:00
b6235df631 docs(wip): Update HAProxy path ACL with sorting fix
- Pattern length sorting ensures longest paths match first
- Apex domain routing: secubox.in/gk2/** replaces *.gk2.secubox.in
- Verified /gk2, /gk2/evolution, /gk2/control all routing correctly

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-09 06:38:03 +01:00
5ccba836fa fix(haproxy): Sort path ACLs by length for correct matching order
Path-based ACLs are now sorted by pattern length (longest first) before
being emitted to haproxy.cfg. This ensures specific paths like /gk2/evolution
match before general paths like /gk2.

Two-phase approach:
- _collect_path_acl() stores ACL data with pattern length prefix
- _emit_sorted_path_acls() sorts by length descending and emits rules

Enables apex domain path routing: secubox.in/gk2/** instead of *.gk2.secubox.in

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-09 06:37:25 +01:00
e91c6519eb docs: Update WIP.md with Gandi DNS secondary setup
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 20:11:36 +01:00
b05c800a7d docs: Update WIP.md with path-based ACL routing
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 11:56:03 +01:00
c28200fdd5 feat(haproxy): Add path-based ACL routing support
- Add _add_path_acl() function to process UCI 'acl' sections
- Support path_beg, path_end, path, path_reg, path_dir match types
- Path ACLs are processed before vhost ACLs (higher priority)
- Fix http_request list handling to avoid duplicate output
- Enables gk2.secubox.in/evolution routing to streamlit_evolution

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 11:55:38 +01:00
88d1f3377c docs: Update WIP.md with 2026-02-08 session work
- Vortex Hub wildcard routing
- Mitmproxy WAF subdomain metrics
- RPCD luci.secubox modular refactor
- HAProxy backend IP fixes
- GK2 node service mapping

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 11:41:16 +01:00
c0cab9ae36 fix(jitsi): Use LAN IP instead of localhost for backends
- jitsi_web: 127.0.0.1:8443 → 192.168.255.1:8443
- jitsi_xmpp: 127.0.0.1:5280 → 192.168.255.1:5280

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 11:36:58 +01:00
dde2e12568 feat(haproxy): Add wildcard domain support and Vortex hub
- Support suffix matching for wildcard domains (*.domain.tld)
- Add match_type option: exact, suffix, regex
- Enable subdomain-to-path mapping for mesh publishing
- Prepare infrastructure for distributed Vortex DNS nodes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 11:27:14 +01:00
a661c9bea8 feat(luci-mitmproxy): Replace alerts with subdomain metrics view
- Display per-subdomain request/threat counts
- Show protocol distribution (HTTP/HTTPS)
- Show top URIs and countries per domain
- Sort by request count, limit to top 25

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 11:18:43 +01:00
46af1ccdd1 feat(mitmproxy): Add subdomain-based WAF metrics tracking
- Track requests, threats, protocols per subdomain
- Record HTTP methods, status codes, top URIs, countries
- New RPCD method: subdomain_metrics
- Metrics auto-saved to /tmp/secubox-subdomain-metrics.json
- Add wan_setup/wan_clear to ACL write permissions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 11:15:04 +01:00
e6b65679a4 feat(haproxy): Add presse.cybermood.eu vhost
- Add vhost for presse.cybermood.eu
- Add backend cybermood_presse on port 4001
- Add ACME certificate entry
- Add ACL routing rules
- Fix backends to use LAN IP (192.168.255.1) instead of localhost

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 10:52:09 +01:00
a7521d6274 feat(haproxy): Add cybermood.eu vhost configuration
- Add vhost entries for cybermood.eu and www.cybermood.eu
- Add backend configuration (cybermood_web on port 4000)
- Add ACME certificate entries for SSL
- Add ACL routing rules in template
- Switch to crt-list for multi-certificate SNI support

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 10:35:11 +01:00
e28f7b952f refactor(secubox-core): Modularize luci.secubox RPCD handler
Split 2544-line monolithic handler into thin dispatcher + 14 modules:
- _common.sh: Shared utilities (json_success, check_service_running, etc.)
- core.sh: getStatus, getVersion, reload
- modules.sh: Module management (install, remove, update)
- profiles.sh: Profile management
- snapshots.sh: Snapshot/recovery
- health.sh: Health & diagnostics
- dashboard.sh: Dashboard data & quick actions
- appstore.sh: AppStore & catalog operations
- state.sh: Component state management
- network.sh: WAN access, services, proxy mode
- feeds.sh: Feed management
- skills.sh: Skill management
- feedback.sh: Issue/resolution tracking
- p2p.sh: P2P hub operations

Benefits:
- Each module is focused on a single domain
- Easier to maintain, test, and debug
- New features can be added as new modules

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 09:45:13 +01:00
872038341a feat(evolution): Real-time sync for all tabs (60s cache)
- Changed fetch_file() TTL from 300s to 60s
- All tabs now refresh every minute like Devel tab
- Updated footer to reflect unified refresh interval

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 07:53:29 +01:00
7aab04d012 feat(evolution): Add real-time GitHub commits display
- New "🚀 Devel" tab with live GitHub commit activity (1-min cache)
- Metrics: Commits Today, This Week, Contributors, Stars
- Commit type distribution (feat/fix/docs/refactor/chore)
- Recent commits list with hash, message, author, relative time
- Repository stats: forks, watchers, open issues
- Cyberpunk-themed commit cards with color-coding
- Pulsing live indicator animation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 07:15:05 +01:00
8015d790e0 feat(cloner): Add SecuBox Station Cloner/Deployer
Host-side orchestrator (secubox-clone-station.sh):
- Dual USB serial control with MOKATOOL integration
- ASU API firmware building for clone images
- TFTP serving with auto-generated U-Boot commands
- Full workflow: detect → pull → flash → verify

On-device CLI (secubox-cloner):
- Build ext4 images for same device type
- TFTP server management via dnsmasq
- Clone token generation with auto-approve
- Integration with master-link mesh onboarding

First-boot provisioning (50-secubox-clone-provision):
- Partition resize to full disk (parted + resize2fs)
- Master discovery via mDNS/network scan
- Automatic mesh join with pre-approved tokens

Master-link enhancements:
- ml_clone_token_generate() for 24h auto-approve tokens
- ml_token_is_auto_approve() for token type detection
- Auto-approve logic in join request handler

SecuBox CLI additions:
- secubox clone (build, serve, token, status, list, export)
- secubox master-link (status, peers, token, join, approve)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 06:52:59 +01:00
320277b87f fix(haproxy): Add proc/sys mount to LXC config for lxc-attach
The HAProxy LXC container was missing lxc.mount.auto = proc:mixed sys:ro
which caused lxc-attach to fail with "mount -t proc proc /proc" error.

This prevented the LED watchdog from checking HAProxy status via
lxc-attach -n haproxy -- pgrep haproxy, triggering false SPUNK alerts.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 06:24:09 +01:00
ab34719f9f feat(secubox-core): Add secubox-landing page generator
- Add secubox-landing script to generate landing pages from HAProxy vhosts
- Integrate landing command into secubox CLI
- Add boot hook to regenerate landing pages on startup
- Fix HAProxy multi-cert SNI using crt-list instead of directory mode
- Fix backend IPs from 127.0.0.1 to 192.168.255.1 for LXC compatibility
- Auto-convert localhost IPs in RPCD handler and CLI tools

Landing page features:
- Groups all services by zone with stats header
- Shows SSL certificate status per domain
- Categorizes by type: Streamlit, Blog, Admin, Media, Dev, etc.
- Regenerates at boot (30s after startup)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 06:15:37 +01:00
95f5022082 docs: Track yijing360 deployment and emancipation
- Fixed port conflict (console 8515, yijing360 8521)
- Deployed yijing-360.zip with generator.py
- Emancipated at yijing360.gk2.secubox.in

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-07 15:47:36 +01:00
73b10c1518 docs: Stats Evolution plan complete
All 4 phases implemented:
- Stats collectors with 17 JSON cache files
- Landing page JSON symlinks for gk2.secubox.in
- Widget Fabricator with live data
- Full integration verified

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-07 15:36:15 +01:00
15010571cb docs: Track lldh.ganimed.fr multi-domain SSL setup
- Secondary domain for La Livrée d'Hermès gallery
- OVH DNS + Let's Encrypt SSL
- Same backend as lldh.gk2.secubox.in

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-07 11:49:49 +01:00
f0abe576de docs: Track Fabricator live data update, lldh gallery
- Fabricator pages now use actual UCI/JSON data (bfd2ed7c)
- La Livrée d'Hermès gallery deployed with YouTube music

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-07 11:36:03 +01:00
bfd2ed7c1f feat(fabricator): Add Widget Fabricator Streamlit app with live data
SecuBox Fabricator - Universal Constructor for SecuBox Components:
- Main dashboard with live stats from UCI and JSON cache
- Collectors page: manage stats scripts, view/run collectors, JSON cache
- Apps page: Streamlit instance management with test/restart/deploy
- Blogs page: MetaBlogizer site management from UCI config
- Services page: HAProxy vhosts/backends, Peek/Poke/Emancipate
- Widgets page: dashboard widget designer with live stats preview

All pages now use actual live data from UCI configs and /tmp/secubox/*.json

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-07 11:05:09 +01:00
9884965e2b feat(heartbeat): Add DNS, BIND, CrowdSec health monitoring
- Add DNS resolution test to heartbeat status
- Include BIND, CrowdSec, HAProxy, mitmproxy service checks
- Add security metrics (crowdsec_bans, dns_response)
- Improve health score calculation with all services

Router changes (not in repo):
- Enabled BIND recursion with forwarders (9.9.9.9, 1.1.1.1)
- Added BIND query/security logging
- Added CrowdSec acquisition for BIND logs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-07 10:12:52 +01:00
adec1144d6 feat: Streamlit ZIP flatten, mitmproxy bot whitelist, Fabricator app
- Add extract_zip_flatten() to Streamlit RPCD for nested ZIP handling
- Add bot whitelist to mitmproxy WAF (Facebook, Google, Bing crawlers)
- Skip threat detection for whitelisted legitimate crawlers
- Track Fabricator app and stats evolution in HISTORY.md

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-07 09:59:20 +01:00
a00f4b6b84 feat(secubox-core): Add detail collector for LuCI flash views
- Creates double-buffered JSON caches with last N entries
- Caches: threats, kernel, syslog, crowdsec details
- Writes to /tmp/secubox and /www for LuCI access
- Cron runs every minute for real-time updates
- Usage: secubox-detail-collector [count] [type]

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-07 09:03:36 +01:00
e31e43b8d7 feat(mitmproxy): Add modular WAF rules with CVE patterns and autoban fixes
- Add waf-rules.json with 46 patterns across 8 categories:
  - sqli, xss, lfi, rce (OWASP Top 10)
  - cve_2024 (recent CVE exploits)
  - scanners, webmail, api_abuse
- Add waf_loader.py dynamic rules loader module
- Add mitmproxy-waf-sync UCI to JSON config sync script
- Fix GeoIP: install geoip2 package in container
- Fix autoban: add cron job, lower min_severity to "high"
- Enable WAF for webmail (mail.secubox.in)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-07 07:46:26 +01:00
736ac9332b docs: Update tracking files with HAProxy and CrowdSec fixes
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-07 06:41:56 +01:00
58b6dc1d2a fix(crowdsec-dashboard): Fix Threat Origins displaying [object Object]
parseCountries() now correctly handles countries as array of objects
[{country: "US", count: 67}, ...] instead of only plain {US: 67} format.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-07 06:34:27 +01:00
82fb9c7d42 feat(haproxy): Add End of Internet fallback page and http-request support
- Create cyberpunk-style End of Internet page for unknown domains
- Add http-request UCI option support in haproxyctl generator
- Support path rewriting backends with http-request set-path
- Configure end_of_internet as default backend for both frontends
- Update docs with HAProxy enhancements (entry #59)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-07 05:37:39 +01:00
e25509cb90 fix(haproxy): Validate backend names, reject IP:port misconfiguration
Add validation in _add_vhost_acl() to detect when vhost backend
is set to IP:port format instead of a proper backend name.

This prevents haproxy config generation errors like:
  [ALERT] unable to find required use_backend: '127.0.0.1:8081'

When detected, logs a warning and skips the vhost instead of
generating invalid config that crashes HAProxy.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 22:30:38 +01:00