Commit Graph

1118 Commits

Author SHA1 Message Date
39fe2aced4 feat(secubox-master-link): Add CLI tools and secubox-deb API prompt
Add sbx-mesh-invite and sbx-mesh-join CLI tools to secubox-master-link:
- sbx-mesh-invite: Generate invite tokens with URL output (for masters)
- sbx-mesh-join: Join mesh with token (for peers), uses HTTPS

Add .claude/prompts/secubox-deb-masterlink.md:
- API specification for implementing master-link on secubox-deb (VM)
- Endpoints: status, invite, join, peers, approve, cleanup
- Data structures for tokens.json and peers.json
- Integration notes for existing LuCI UI

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-26 15:30:30 +01:00
6f9dd3aa17 feat(luci-app-masterlink): Add sbx-mesh-invite and improve join script
New sbx-mesh-invite script for master nodes:
- Generates secure invite tokens with auto-approve option
- Outputs copy-pasteable join URL and CLI command
- Supports --ip flag to specify master address
- Prefers 192.168.x.x addresses in auto-detection

Improvements to sbx-mesh-join:
- Creates UCI config file if missing (touch + set)
- Properly initializes config section before setting options
- Handles fresh installs without existing masterlink config

Workflow:
  Master: sbx-mesh-invite --ip 192.168.255.200
  Peer:   sbx-mesh-join 192.168.255.200 <token>

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-26 15:23:55 +01:00
60334e96ea fix(luci-app-masterlink): Handle missing JSON fields in sbx-mesh-join
Add || true to jsonfilter commands to prevent script exit when
optional fields (master_fingerprint, depth) are missing from API
response. The set -e directive was causing premature exit.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-26 15:17:44 +01:00
349b20a750 fix(luci-app-masterlink): Use HTTPS instead of HTTP for mesh join API
- Change API endpoint from http://IP:7331 to https://IP (port 443)
- Add -k flag for curl to handle self-signed certificates
- Add --no-check-certificate for wget for self-signed certs
- Update usage examples to show HTTPS URLs
- Fix menu path to /admin/secubox/master-link

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-26 15:03:02 +01:00
c4a2601c11 feat(luci-app-masterlink): Add mesh enrollment client for OpenWRT
New package for joining SecuBox mesh networks from OpenWRT devices.

RPCD handler (/usr/libexec/rpcd/luci.masterlink):
- status: Current mesh membership state
- join: Join mesh with master_ip and token
- leave: Leave current mesh network
- info: Local node info (fingerprint, hostname, IP)
- verify: Verify master before joining

CLI tool (/usr/bin/sbx-mesh-join):
- URL parsing: sbx-mesh-join 'http://ip:7331/master-link/?token=xxx'
- Direct args: sbx-mesh-join 192.168.1.1 token123
- Auto-generates node fingerprint from MAC address
- Saves to UCI on success

LuCI interface (Services > Master-Link):
- Status display (connected/pending/disconnected)
- Invite URL/token input with Verify and Join buttons
- Leave mesh button when connected
- CLI usage help section

Also adds screenshot-capture.js for automated LuCI screenshots.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-26 14:21:48 +01:00
54f7b4bc64 chore(secubox-feed): Rebuild packages with theme v1.0.0 and latest updates
- Updated luci-theme-secubox from 0.4.8-r1 to 1.0.0-r2
- Rebuilt all LuCI apps and SecuBox packages
- Updated Packages index and apps-local.json manifest

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-26 12:10:44 +01:00
e7a9062140 feat(secubox-mesh): Add network device and VM/container discovery
Enhanced mesh discovery with multi-method network device detection:

- discovery_scan_subnet(): Active /24 subnet scanning for SecuBox peers
- discovery_scan_docker(): Docker container detection via Unix socket
- discovery_scan_lxc(): LXC and Proxmox container detection
- discovery_scan_libvirt(): KVM/libvirt VM detection via virsh
- discovery_scan_all_devices(): Full ARP neighbor discovery with fingerprinting
- discovery_fingerprint_device(): Port scanning for service detection

New RPCD API methods:
- devices: List all discovered network devices
- scan_full: Trigger full network scan (includes subnet scan)
- scan_containers: Scan specifically for containers/VMs

LuCI mesh dashboard updates:
- "Discovered Devices" table with IP, MAC, type, hostname, services
- "Scan Network" button to trigger full discovery
- Device classification: secubox, server, container, vm, unknown
- Peer table now shows source field (docker:name, lxc:name, etc.)

Also includes CRT P31 theme CSS comprehensive fix for UI consistency.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-26 11:38:37 +01:00
92e5f5b95e fix(luci-theme-secubox): Fix navbar layout for LuCI bootstrap structure
- Remove sidebar navigation styles (LuCI uses horizontal top nav)
- Add proper flexbox header layout:
  - .brand on left with hostname
  - #topmenu.nav horizontal menu in center
  - #indicators on right
- Add dropdown menu styles for submenu items
- Add #tabmenu secondary navigation styles
- Fix footer to use flex layout
- Update responsive styles for mobile header wrapping

The layout now properly positions:
- Header bar (sticky, 50px height)
- Main content below header
- Footer at bottom

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-26 08:20:09 +01:00
5294d26375 fix(luci-theme-secubox): Add ucode templates for LuCI 24.10 compatibility
- Add header.ut and footer.ut ucode templates (required by modern LuCI)
- Remove old Lua templates (incompatible with OpenWrt 24.10)
- Add mobile.css for responsive styling
- Update UCI defaults to register theme in luci.themes section
- Bump PKG_RELEASE to 3

The theme now properly loads via LuCI's theme system with:
- CRT P31 phosphor green cascade.css
- crt-engine.js for scanline effects
- Proper ucode template integration

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-26 07:29:55 +01:00
1140221f4a feat(luci-theme-secubox): Add CRT P31 phosphor green terminal theme
Complete LuCI theme implementation with:
- CRT P31 phosphor green color scheme with scanline effects
- Header, footer, and sysauth login page templates
- Cascading CSS with CRT glow and phosphor effects
- CRT engine JS for terminal-style animations
- CRT components JS for reusable UI components
- UCI defaults to set as default LuCI theme
- Updated Makefile for proper asset installation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-26 07:18:23 +01:00
54668158c8 feat(luci-app-secubox-mesh): Add LuCI dashboard for mesh network
KISS-themed web interface for SecuBox mesh daemon management:
- Node Identity card (DID, role, mesh gate, daemon uptime)
- System Telemetry with CPU/Memory/Disk gauges and temperature
- Network stats (RX/TX totals, TCP connections, WireGuard peers)
- Configuration panel with Restart Daemon and Rotate Keys buttons
- Connected Peers table with live status
- 10-second auto-refresh polling
- Menu: SecuBox → Mesh Network

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-26 07:14:42 +01:00
cd6af3edff feat(secubox-mesh): Add OpenWrt mesh daemon with topology management
Port secuboxd from Debian/Go to OpenWrt shell implementation:
- secuboxd daemon with Unix control socket at /var/run/secuboxd/topo.sock
- secuboxctl CLI compatible with Debian version interface
- Mesh libraries: topology, discovery, election, telemetry, control
- Mesh gate election with weighted scoring (uptime, peers, CPU, memory, role)
- mDNS service discovery (_secubox._udp.local) via umdns
- DID integration via mirrornet identity library
- RPCD handler with 11 ubus methods for LuCI integration
- procd init script with respawn and network triggers
- UCI config sections: mesh, node, telemetry, discovery

Fixes subprocess state access for socat handler by saving daemon state to file.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-26 06:27:45 +01:00
707142c6bb fix(crowdsec-dashboard): Fix JSON parsing bug in overview cache
grep -c returns exit code 1 when count is 0, which triggered
the `|| echo 0` fallback to also output "0", resulting in:
  "waf_threats_today":0
  0,

This broke JSON parsing and caused the dashboard to show
CrowdSec as "STOPPED" even when running.

Fix: Use `|| :` (no-op) and set defaults with `: "${var:=0}"`

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-20 16:16:32 +01:00
ae3b2ab3b5 feat(packages): Add secubox-full meta-package and fix secubox-core
- Add p2p-mesh.sh to secubox-core install (was missing, breaking master-link)
- Create secubox-full meta-package with tiered bundles:
  - secubox-core-bundle: Essential components
  - secubox-security-bundle: WAF/IDS/threat detection
  - secubox-services-bundle: HAProxy/DNS/web services
  - secubox-luci-bundle: All LuCI apps
  - secubox-full: Everything
- Update VM and firmware workflows to include secubox-core by default
- Add secubox-p2p, secubox-master-link, secubox-identity to default installs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-20 13:46:13 +01:00
434e501dae fix(metrics): Use date -r for OpenWrt file mtime and fix grep -c double output
- Replace stat -c %Y with date -r for BusyBox compatibility (stat not available)
- Fix get_cache_age() to properly return early when cache file missing
- Fix grep -c || echo 0 pattern that caused "invalid number '0\n0'" errors
- Add proper numeric defaults using : "${var:=0}" pattern
- Add freshness metadata (_freshness) with age, timestamp, and fresh boolean

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-20 11:40:04 +01:00
b99dabaca9 feat(ui): Add progressive freshness indicators to dashboards
Add visible "Updated Xs ago" timestamps and freshness indicators to
make cached stats look more alive and help users know data currency.

Backend changes:
- luci.metrics: Add _freshness metadata (age, fresh, timestamp_epoch)
  to overview, waf_stats, and connections responses
- luci.crowdsec-dashboard: Add _freshness metadata to get_overview
  response using sed injection into cached JSON

Frontend changes:
- metrics/dashboard.js: Display freshness indicator (green/yellow/red)
  in header, animate value changes with flash effect
- crowdsec-dashboard/overview.js: Display freshness indicator next to
  running badge, update on poll

Shared utilities (kiss-theme.js):
- formatAge(seconds): Format "Xs ago", "Xm ago", "Xh ago"
- getFreshnessClass(age): Return fresh/recent/stale based on age
- getFreshnessColor(class): Return #00c853/#ff9800/#f44336
- freshnessIndicator(age, id): Create indicator DOM element
- updateFreshness(age, id): Update existing indicator

Freshness thresholds:
- Fresh (green): < 15s for metrics, < 30s for CrowdSec
- Recent (yellow): < 45s for metrics, < 90s for CrowdSec
- Stale (red): > threshold

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-20 11:05:01 +01:00
ccfb58124c docs: Add trilingual documentation (French and Chinese translations)
Add complete French (fr) and Chinese (zh) translations for all documentation:

- Root files: README, CHANGELOG, SECURITY, BETA-RELEASE
- docs/: All 16 core documentation files
- DOCS/: All 19 deep-dive documents including embedded/ and archive/
- package/secubox/: All 123+ package READMEs
- Misc: secubox-tools/, scripts/, EXAMPLES/, config-backups/, streamlit-apps/

Total: 346 translation files created

Each file includes language switcher links for easy navigation between
English, French, and Chinese versions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-20 10:00:18 +01:00
a61b0fcda8 feat(haproxy): Add Sync WAF Routes button and fix LuCI backend routing
- Add "Sync WAF Routes" button to HAProxy vhosts page in LuCI
- Add sync_mitmproxy_routes RPC method to HAProxy RPCD backend
- Fix mitmproxyctl and secubox-route to handle LuCI backends (luci, luci_default, luci_control)
- Remove outdated port 8081 skip filter in route sync that prevented LuCI routes
- These changes allow vhosts with original_backend='luci' to be properly
  routed through the WAF

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-19 19:15:51 +01:00
64a12a65ad fix(droplet): Fix BusyBox tr bug in name sanitization too
The buggy tr '[:upper:]' '[:lower:]' was also used for sanitizing
site names, causing 'ziptest' to become 'ziwtest'. Use awk tolower()
for all lowercase conversions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-19 11:19:17 +01:00
afaa9c05ef feat(droplet): Add multi-file upload support
- Allow selecting and uploading multiple files at once
- Each file gets its own name input field
- Files are processed sequentially with progress indicator
- Errors are collected and displayed at the end

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-19 11:06:11 +01:00
1a1ca1794a fix(droplet): Use awk for lowercase instead of buggy BusyBox tr
BusyBox tr '[:upper:]' '[:lower:]' has a bug that converts 'p' to 'w',
causing .zip to be detected as .ziw. Use awk tolower() instead.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-19 11:04:05 +01:00
b76131ed1d fix(droplet): Strip CR/LF from file extension detection
Windows uploads may include carriage returns in filenames, causing
.zip to be detected as .ziw. Strip \r\n from extension string.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-19 10:57:22 +01:00
c79b3cb27b feat(repo): Add unified repo-deploy.sh and multi-arch support
- Add repo-deploy.sh script for staging and deploying packages
- Replicate _all.ipk packages to all 6 architectures automatically
- Add "Refresh Indexes" button to LuCI dashboard for local deployments
- Add RPCD refresh method to regenerate Packages indexes on-device
- Support architectures: aarch64_cortex-a72, aarch64_cortex-a53,
  aarch64_generic, x86_64, mips_24kc, mipsel_24kc

Usage:
  ./secubox-tools/repo-deploy.sh stage --clean
  ./secubox-tools/repo-deploy.sh deploy root@192.168.255.1

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-19 08:03:08 +01:00
d92b3360ea feat(repo): Add unified repo-deploy.sh and multi-arch support
- Add repo-deploy.sh script for staging and deploying packages
- Replicate _all.ipk packages to all 6 architectures automatically
- Add "Refresh Indexes" button to LuCI dashboard for local deployments
- Add RPCD refresh method to regenerate Packages indexes on-device
- Support architectures: aarch64_cortex-a72, aarch64_cortex-a53,
  aarch64_generic, x86_64, mips_24kc, mipsel_24kc

Usage:
  ./secubox-tools/repo-deploy.sh stage --clean
  ./secubox-tools/repo-deploy.sh deploy root@192.168.255.1

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-19 07:48:59 +01:00
9ddf5a4e0b fix(build): Fix 16 failed packages with missing Build/Compile and URL config
- Add missing 'define Build/Compile' to script-only packages:
  - secubox-app-config-vault
  - secubox-app-gotosocial
  - secubox-app-ipblocklist
  - secubox-app-ksmbd
  - secubox-app-qbittorrent
  - secubox-app-talk-hpb
  - secubox-app-vhost-manager
  - secubox-app-webtorrent
  - secubox-avatar-tap
  - secubox-core-users
  - secubox-dpi-dual
  - secubox-app-backup

- Fix luci-app-interceptor: Add missing BuildPackage call
- Fix luci-app-master-link: Correct RPCD handler filename (underscore → dash)
- Fix luci-app-config-vault: Add Build/Compile definition

- Create secubox-console Makefile (new package for remote management)
- Create secubox-app-backup cron job file

- Update secubox-app-repo: Change feed URLs from local IP (192.168.255.1:8888)
  to repo.secubox.in domain with HTTPS and proper src/gz format

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-18 18:01:51 +01:00
dd18e5c4aa fix(repo): Fix BusyBox ash compatibility in repo-sync
Wrap for loop with output redirection in subshell for
BusyBox ash compatibility when generating Packages index.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-18 16:43:27 +01:00
21a8f06058 chore(secubox-app-bonus): Rebuild local feed with repo packages
- Add secubox-app-repo and luci-app-repo to local feed
- Regenerate Packages index
- Update all embedded packages

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-18 12:54:11 +01:00
6d2ee8ae8f fix(repo-sync): Fix shell syntax error in for loop
Remove invalid 2>/dev/null redirection from for loop header

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-18 12:33:06 +01:00
86d6889285 fix(repo): Add usign package signing and fix ACL conflict
- Add usign dependency for package signing
- Sign Packages files after generation in repo-sync
- Generate signing keys automatically if not present
- Remove duplicate ACL file (now only in luci-app-repo)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-18 12:29:48 +01:00
088b6e749f fix(luci-app-repo): Add proper Package definition with TITLE field
- Add Package/luci-app-repo section with required fields
- Add Build/Compile empty target
- Add package description
- Fix build failure in SDK

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-18 10:41:36 +01:00
c152934bf1 fix(repo): Add postinst script to configure opkg feeds automatically
- Auto-create repo directories on install
- Detect device architecture and configure customfeeds.conf
- Add prerm script to cleanup on uninstall
- Points opkg to local repo at 192.168.255.1:8888

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-18 10:33:50 +01:00
9cd59b77ba feat(repo): Add secubox-app-repo and luci-app-repo packages
Backend package (secubox-app-repo):
- repoctl CLI for managing local package repository
- repo-sync script to download packages from GitHub releases
- uhttpd-based server on port 8888
- UCI configuration at /etc/config/repo
- RPCD handler for LuCI integration
- Auto-sync cron support (configurable interval)

Frontend package (luci-app-repo):
- Dashboard showing repository status and package counts
- Sync button to trigger package downloads
- Log viewer for sync operations
- Usage instructions for opkg configuration

Supported architectures:
- x86_64, aarch64_cortex-a72, aarch64_generic
- mips_24kc, mipsel_24kc

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-18 10:21:23 +01:00
a53d2b1d63 fix(metrics): Get WAF blocked count from CrowdSec mitmproxy decisions
- WAF blocked now counts mitmproxy scenario decisions (1031 blocks)
- Removed waf_threats field (redundant with waf_blocked)
- Fixed dashboard to show 3 WAF stats: Bans, Alerts, Blocked

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-17 12:41:14 +01:00
9263fd7e4b feat(metrics): KISS-styled dashboard with double-buffer caching
UI:
- Clean card grid with colored stat values
- Services status bar (HAProxy, WAF, CrowdSec) with glowing dots
- Two-panel layout for WAF/Security and Connections
- Live clock with pulsing indicator
- Proper KissTheme.wrap() integration

Performance:
- Double-buffer cache at /tmp/secubox/metrics-cache.json
- 30s TTL with async background refresh
- Cron job for periodic cache updates
- Instant RPCD response (no computation on request)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-17 12:37:57 +01:00
f25854b08b fix(metablogizer): Use mitmproxy hot-reload instead of restart
mitmproxy's haproxy_router.py addon already implements hot-reload:
- Checks routes file mtime on every request
- Auto-reloads when file changes

Removed unnecessary mitmproxy restart after adding routes.
Just ensure file permissions are correct (644) for hot-reload to work.

This makes publishing faster and avoids service disruption.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-17 11:56:11 +01:00
678e5a5921 feat(luci): Add Metrics Dashboard + fix WAF filters layout
New luci-app-metrics-dashboard with real-time system overview:
- System uptime, memory, load stats
- Core services status (HAProxy, mitmproxy, CrowdSec)
- vHosts, MetaBlog sites, Streamlit apps counts
- WAF alerts, bans, threats statistics
- Active connections (HTTP, HTTPS, SSH, TCP total)
- SSL certificates list
- Auto-refresh every 5 seconds

WAF Filters page:
- Changed stats display to single-line compact format
- Shows "17 Categories · 17 Active · 150 Rules" inline

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-17 11:54:37 +01:00
8e55757dee fix(metablogizer): Auto-restart mitmproxy after adding routes
- Add mitmproxy restart after _add_mitmproxy_route() to load new routes
- mitmproxy loads routes at startup only, so restart is required
- Run restart in background to avoid blocking publish command

Also fixed on router:
- Disabled health check for mitmproxy_inspector backend
- HAProxy health check fails because mitmproxy returns 404 for
  requests without valid Host header

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-17 11:46:53 +01:00
c8a5e1c19a fix(metablogizer): Route new sites through mitmproxy for WAF inspection
- Changed vhost backend from direct metablog_* to mitmproxy_inspector
- Added original_backend tracking for mitmproxy route resolution
- Changed server address from 192.168.255.1 to 127.0.0.1
- Added _add_mitmproxy_route helper for route registration
- Fixed both cmd_publish() and _emancipate_haproxy() functions

This ensures all newly published sites go through WAF inspection
rather than bypassing security checks.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-17 10:35:26 +01:00
e1f2a0e885 feat(droplet): Implement async publish to prevent UI timeout
- RPCD handler returns immediately with job_id (~0.04s)
- Background script uses file output to avoid pipe inheritance issues
- LuCI JS polls job_status every 2s until completion
- Uses setsid for proper process detachment
- jsonfilter for reliable parameter parsing

Fixes "Failed to publish" error caused by ubus timeout during
40+ second publish operations.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-17 09:43:19 +01:00
ddf480e6ed fix(droplet,dpi): Resolve publish hang and broken pipe errors
- dropletctl: Remove pipe to grep that blocked on background children
- metablogizerctl: Background HAProxy generate/reload (~90s with 95 certs)
- dpi-lan-collector: Pre-compute flow counts in single pass instead of
  spawning grep per client (eliminates broken pipe errors)

Publish time reduced from ~2 min to ~35 seconds.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-17 07:39:09 +01:00
ece237d194 feat(mitmproxy): Add headless mode to reduce RAM from 3.4GB to 96MB
- Add headless UCI option to use mitmdump instead of mitmweb
- Enable headless by default for WAF (mitmproxy-in) instance
- Increase default memory limit from 256MB to 2GB
- Fix LXC config generation to always recreate on service start
- Fix rootfs check path (/usr/local/bin not /usr/bin)
- Use exec in startup script for proper foreground execution

Headless mode runs mitmdump (CLI) instead of mitmweb (web UI),
saving ~3.3GB RAM while maintaining full WAF functionality.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-17 07:14:05 +01:00
3fcad8e626 fix(waf): Prevent false positive bot detection on legitimate browsers
- Add LEGITIMATE_BROWSERS whitelist (Chrome, Firefox, Safari, Edge, etc.)
- Check for legitimate browser signatures BEFORE bot signature matching
- Fix CriOS (Chrome iOS) false positive: 'mozi' substring matched Mozi botnet
- Make botnet signatures more specific: 'mozi' → 'mozi/', 'mozi '
- Prevents banning real users loading pages with multiple JS requests

Fixes false positive on IP 82.65.224.119 (French ISP, Chrome iOS user)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-16 19:30:02 +01:00
a0825c73c1 feat(waf): Add honeypot detection categories and fix JSON escapes
- Fix invalid \x00 JSON escapes to valid \u0000 Unicode escapes
- Add 4 new WAF rule categories:
  - waf_fingerprint (12 rules): WAF bypass/fingerprinting detection
  - honeypot (16 rules): Decoy file and admin panel probes
  - recon_crawler (10 rules): Reconnaissance file enumeration
  - credential_harvest (8 rules): Password/token exposure detection
- Total: 17 categories, 150 rules
- UI: Inline stats header layout for WAF Filters page

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-16 09:52:43 +01:00
f46e145927 feat(crowdsec): Add geo heatmap visualization for threat origins
- New heatmap.js component with SVG world map and country centroids
- Colored dots show threat distribution: orange (local), cyan (CAPI), red (WAF)
- Dot size scales logarithmically with threat count (4-20px)
- Hover tooltips show country code and count
- Added geo_local_raw and geo_capi_raw fields to RPCD backend
- CAPI geo extraction from decisions with GeoIP metadata
- CSS styling for heatmap container, dots, and legend

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-16 09:28:48 +01:00
b02503eac4 fix(crowdsec): Count all mitmproxy scenarios in WAF bans
Changed waf_bans_today to count all mitmproxy-* scenarios instead of
only mitmproxy-waf (which doesn't exist). Now correctly counts
mitmproxy-scanner, mitmproxy-botscan, etc.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-16 09:13:14 +01:00
f424ec72c1 fix(crowdsec): Fix rpcd blocking and show active bans
- Make refresh_cache async to prevent rpcd watchdog kills
- Fix JSON escaping for top_scenarios/countries arrays
- Show decisions as "Active Bans" when alerts_raw is empty
- Display ban expiry time instead of creation time
- Update cron to run cache refresh in background

Fixes LuCI crashes caused by 16s blocking refresh calls.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-16 08:35:03 +01:00
b9f789fdb7 fix(crowdsec): Fix alerts/scenarios/countries stats in dashboard
- alerts_24h now uses local_decisions count instead of empty file
- top_scenarios_raw now extracts from decisions JSON (was parsing CAPI metrics)
- top_countries_raw now correctly parses IsoCode from alerts GeoIP metadata
- Double-buffer caching via cron job already in place

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-16 08:29:59 +01:00
c74ba2e474 feat(luci): KISS theme rework for SMTP Relay and SecuBox Users
- Rewrite smtp-relay/settings.js with proper KISS theme styling
- Rewrite secubox-users/overview.js with proper KISS theme styling
- Use KissTheme.wrap() for consistent dark theme rendering
- Add stat cards with colored values matching mailserver reference
- Add proper form styling with inline CSS variables
- Add NZB tools (SABnzbd, NZBHydra) to KISS menu Downloads
- Add webtorrent to portal tree Downloads category
- Fix portal tree webtorrent pattern

KISS = Keep It Simple Sexy

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-16 08:20:12 +01:00
ee7cd8ef6f fix(lyrion): Fix Rescan button disabled state in updateUI
The updateUI function was incorrectly disabling the Rescan button when
Lyrion was running. Rescan should only be enabled when running.

- Split forEach into separate button handlers
- Start button: disabled when running (correct)
- Rescan button: disabled when NOT running (fixed)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-16 07:56:09 +01:00
d0cd42e2a1 fix(luci): Performance and UX improvements for exposure and portal
- Optimize exposure RPCD: O(n) single-pass awk parsing for vhost_list
  and ssl_list (fixes XHR timeout on 200+ vhosts)
- Fix portal tree URLs: Use get_menu_path() to read actual LuCI menu
  paths from JSON instead of hardcoded paths
- Add Downloads category to portal tree (torrent, droplet patterns)
- Add new apps to System category (config-vault, reporter, smtp-relay,
  rtty, dpi-dual, metacatalog)
- Enhance KISS theme menu: Add Downloads, Monitoring categories
- Fix Lyrion URL: Use HTTPS vhost instead of dynamic port URL

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-16 07:35:18 +01:00