Commit Graph

902 Commits

Author SHA1 Message Date
daa4c48375 fix(localai): Add gte-small preset, fix RPC expect unwrapping and chat JSON escaping
- Add gte-small embedding model preset to localaictl with proper YAML
  config (embeddings: true, context_size: 512)
- Fix RPC expect declarations across api.js, dashboard.js, models.js to
  use empty expect objects, preserving full response including error fields
- Replace fragile sed/awk JSON escaping in RPCD chat and completion
  handlers with file I/O streaming through awk for robust handling of
  special characters in LLM responses
- Switch RPCD chat handler from curl to wget to avoid missing output
  file on timeout (curl doesn't create -o file on exit code 28)
- Bypass RPCD 30s script timeout for chat by calling LocalAI API
  directly from the browser via fetch()
- Add embeddings flag to models RPC and filter embedding models from
  chat view model selector

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 08:36:20 +01:00
28acb7e70f fix(localai): Fix health check and uptime detection in RPCD handler
Health check grep was case-sensitive ("ok") but LocalAI returns "OK".
Uptime detection fell into the lxc-info branch (command exists on router)
even though no localai container runs, causing uptime to always be 0.
Simplified to always use /proc/PID which works for both native and
containerized processes.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 19:04:23 +01:00
02126aa7d3 feat(wireguard-dashboard): Persist server endpoints in UCI for reuse across views
Server endpoints were stored only in browser sessionStorage, lost on tab
close/refresh. Now endpoints are saved in a dedicated UCI config file
(wireguard_dashboard) with RPCD methods to manage them. The wizard
auto-saves the endpoint after tunnel creation, and peers/QR views use a
dropdown of saved endpoints instead of requiring manual re-entry.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 18:32:36 +01:00
bb0f24d93a docs: Add RPCD and LuCI frontend guidelines to CLAUDE.md
Document lessons learned from WireGuard dashboard development:
- jshn argument size limits and manual JSON workaround
- UCI underscore-prefixed private data storage
- LuCI RPC expect field unwrapping behavior
- LuCI JS module caching and cache-busting strategies
- Quick deploy workflow for JS/RPCD changes
- Common pitfalls (params ordering, sessionStorage, interface naming)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 17:49:05 +01:00
2ed00d1967 fix(wireguard-dashboard): Fix RPC expect unwrapping, wizard interface naming and key persistence
- Change generateConfig/generateQR RPC declarations to use empty expect
  so error responses are not silently discarded by LuCI's RPC unwrapper
- Simplify handleShowQR to always check backend for stored key first
- Auto-detect next available interface name in wizard (wg1 if wg0 exists)
- Pass private key to addPeer in wizard's createPeers for QR persistence

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 17:35:44 +01:00
75e3f59207 fix(wireguard-dashboard): Bypass jshn for QR code output to avoid argument size limit
The base64-encoded SVG QR code exceeded jshn's argument list limit,
causing "Argument list too long" errors. Build the JSON response
manually via file I/O so the large string is never passed as a
command argument.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 16:57:53 +01:00
2ab0965917 feat(wireguard-dashboard): Persist peer private keys in UCI for QR code generation
Store the client private key in UCI config (_client_private_key) when a
peer is created, so QR codes and config files can be generated after
page refresh without prompting the user to manually re-enter the key.
Old peers without stored keys still get the manual entry fallback.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 16:54:26 +01:00
2d810a2e95 feat(mac-guardian): Add DHCP lease protection for odhcpd
Prevent odhcpd crashes from MAC randomization causing hostname conflicts,
stale lease pile-up, and lease flooding. Adds hostname dedup, stale lease
cleanup, flood detection, CLI commands, RPC methods, and LuCI dashboard card.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 16:22:37 +01:00
373d77368e feat(mac-guardian): Rename to secubox-app-mac-guardian and add LuCI interface
Rename package folder to follow secubox-app-* convention and add
luci-app-mac-guardian with KISS dashboard: status cards, client table
with trust/block actions, recent alerts, and configuration form.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 16:06:48 +01:00
aeb4825b25 feat(mac-guardian): Add WiFi MAC security monitor
Pure-shell WiFi MAC address security monitor detecting randomized MACs,
OUI anomalies, MAC floods, and spoofing. Integrates with CrowdSec via
JSON log parsing and provides real-time hostapd hotplug detection.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 15:26:18 +01:00
fa1f6ddbb8 feat(tor-shield): Add server mode for split-routing with public IP preservation
Server mode routes all outbound traffic through Tor while preserving
inbound connections (HAProxy, etc) on the public IP. Fixes kill switch
blocking response packets by adding ESTABLISHED,RELATED conntrack rule,
and adds PREROUTING chain for LAN client Tor routing.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 13:46:26 +01:00
ea18674638 fix(security-threats): Remove null rendering in dashboard
LuCI's E() renders null array children as literal "null" text.
Use concat with empty arrays instead of ternary-to-null for
conditional peer/IOC table sections and top-level sections.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 11:51:50 +01:00
8c0f6a9b73 fix(security-threats): Detect mitmproxy running in LXC container
The process name is mitmweb (not mitmdump) when running inside the
mitmproxy LXC container. Use pgrep -f mitmweb for correct detection.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 11:34:51 +01:00
c4302504df refactor(security-threats): KISS rewrite with mesh threat intelligence
Replace overengineered dashboard (2025 lines) with focused security
intelligence view (847 lines). Drop hero banner, risk gauge, device
zoning, nDPId correlation engine. Keep firewall stats, mitmproxy
threats, CrowdSec blocking. Add mesh intelligence section with P2P
threat-intel sharing (IOC counts, peer contributors, publish/apply).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 11:30:25 +01:00
1652b39137 feat(p2p): Add decentralized threat intelligence sharing via mesh
Share CrowdSec bans and mitmproxy detections between mesh nodes using
the existing blockchain chain + gossip sync. Received IOCs from trusted
peers are auto-applied as CrowdSec decisions based on a three-tier trust
model (direct/transitive/unknown).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 11:13:51 +01:00
857622ff56 feat(master-link): Add dynamic join IPK generation for mesh onboarding
Generate a minimal IPK on-the-fly when a client visits the master-link
landing page, so the "Download Package" step always works even without
a pre-built IPK bundle. The IPK configures the peer via postinst uci
commands (avoiding file conflicts with secubox-master-link), and can be
installed directly via opkg install URL from SSH.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 09:36:04 +01:00
cd4e991761 feat(tools): Add SecuBox image builder and sysupgrade scripts
secubox-image.sh: Dev-side image builder via OpenWrt ASU API with
build, download, firmware-selector commands. Includes first-boot
script that resizes root, adds SecuBox feed, and installs all
packages. Supports --resize flag for full eMMC utilization.

secubox-sysupgrade.sh: On-device upgrade script that detects current
device/packages, builds custom image via ASU, and applies sysupgrade.
Uses jsonfilter (OpenWrt native) for JSON parsing.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 09:02:11 +01:00
3c1d6d2fd0 feat(lyrion): Add WAN access checkbox for firewall rules
Add wan_access UCI option and LuCI checkbox to optionally open Lyrion
ports (9000, 9090, 3483 TCP+UDP) on the WAN interface. WAN rules are
automatically removed when the option is disabled.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 08:06:54 +01:00
4797b7844d fix(lyrion): Add firewall rules and fix networking for device discovery
Open LAN firewall ports (TCP 9000/9090/3483, UDP 3483) on install and
service start so Squeezebox devices can discover and connect to Lyrion.
Fix LXC config to use host networking properly and add missing Docker
TCP 9090 CLI port mapping.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 08:00:09 +01:00
62f2f6a7a8 docs(secubox): Add KISS README for all 46 remaining packages
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 07:34:06 +01:00
b516609bcc docs(master-link): Add README for both master-link packages
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 07:16:22 +01:00
e74e44158f fix(master-link): Pre-read request file fields before cat truncation
Read timestamp, approved_at, and other fields into variables before
`cat > "$request_file"` truncates the file. Fixes invalid JSON output
(`"timestamp": ,`) in ml_join_approve, ml_join_reject, and
ml_promote_to_submaster.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 06:52:14 +01:00
13960d39c3 fix(master-link): Rename RPCD to luci.master_link and flatten JSON output
Hyphens in RPCD filenames break ubus CLI argument parsing. Rename
luci.master-link to luci.master_link and update all references in
the JS view, ACL, and Makefile. Also pipe RPCD method output through
tr -d '\n\t' so ubus receives single-line JSON it can parse.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 06:40:41 +01:00
c4c829a593 fix(master-link): Suppress p2p-mesh.sh stdout noise from sourced libraries
Use >/dev/null 2>&1 instead of just 2>/dev/null when sourcing
master-link.sh and calling chain_add_block, mesh_init, peer_add,
factory_trust_peer, and gossip_sync to prevent p2p-mesh.sh usage
text and block hashes from corrupting CGI JSON responses.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 06:38:11 +01:00
62c0850829 feat(master-link): Add secure mesh onboarding packages
Implement secubox-master-link (backend) and luci-app-master-link (LuCI
frontend) for secure node onboarding into the SecuBox mesh via
HMAC-SHA256 join tokens, blockchain-backed peer trust, and gigogne
(nested) hierarchy with depth limiting.

Backend provides: token management, join/approve/reject protocol, IPK
bundle serving, CGI API endpoints, and a dark-themed landing page for
new nodes. Frontend provides a 3-tab LuCI view (overview, join requests,
mesh tree) with RPCD integration.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 06:15:47 +01:00
c0991336bb fix(mitmproxy): Fix JSON output corruption from grep -c exit codes
grep -c returns exit code 1 when no matches found (even though it
outputs 0), causing `|| echo 0` to append an extra 0 and corrupt
the JSON response. This broke ubus calls and LuCI status display.

Use `: ${var:=0}` pattern instead to provide defaults.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 05:15:27 +01:00
b2f0e23c32 fix(simplex): Use LXC configured path and skip existing rootfs download
- Read LXC path from /etc/lxc/lxc.conf instead of hardcoding /var/lib/lxc
  (OpenWrt uses /srv/lxc by default)
- Skip Alpine rootfs download if file already exists in /tmp

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 05:07:44 +01:00
c89e965631 fix(factory): Suppress ubus output to prevent JSON corruption in CGI responses
The factory_audit_log function's ubus call was only redirecting stderr,
allowing stdout JSON output to leak into CGI responses when Gitea backup
is enabled. This caused JSON parse errors in the Factory dashboard when
creating snapshots.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 04:17:48 +01:00
045af683b3 fix(feed): Remove stale mitmproxy r19 package
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 16:21:41 +01:00
d238e05098 chore(feed): Update build artifacts with WAF autoban stats UI
- luci-app-crowdsec-dashboard: WAF threats/bans stats on overview
- luci-app-mitmproxy: Auto-ban statistics card

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 16:21:10 +01:00
98440c456a feat(ui): Add WAF auto-ban statistics to dashboards
CrowdSec Dashboard:
- Added WAF Threats and WAF Auto-Bans stats cards
- Added WAF Auto-Ban status to health checks
- Shows sensitivity level (aggressive/moderate/permissive)

mitmproxy Status:
- Added WAF Auto-Ban section with statistics
- Shows threats today, bans today, total bans
- Displays sensitivity level with color coding
- Shows pending bans count when applicable

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 16:15:40 +01:00
449d5bb96e chore(feed): Update build artifacts for mitmproxy v0.5.0-r21
- secubox-app-mitmproxy: Sensitivity-based auto-ban system
- luci-app-mitmproxy: Updated frontend
- luci-app-crowdsec-dashboard: Ban button on alerts page

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 16:04:49 +01:00
56d45fe7c2 feat(waf): Add sensitivity-based auto-ban system with CrowdSec integration
WAF Auto-ban Features:
- Three sensitivity levels: aggressive, moderate, permissive
- Aggressive: Immediate ban on first critical threat
- Moderate: Ban after 3 attempts in 5 minutes (default)
- Permissive: Ban after 5 attempts in 1 hour
- Attempt tracking with configurable thresholds

Critical threats (immediate in aggressive/moderate):
- CVE exploits, SQL injection, Command injection
- XXE, Log4Shell, SSTI attacks

CrowdSec Integration:
- Auto-ban requests written to /srv/mitmproxy/autoban-requests.log
- Cron job processes bans every minute via mitmproxyctl
- Bans sent to CrowdSec for network-wide enforcement

New Commands:
- mitmproxyctl process-autoban: Process pending bans
- mitmproxyctl reload-autoban: Reload config after UCI changes

CrowdSec Dashboard:
- Added ban button to alerts page
- Modal confirmation with 24h ban duration
- Real-time banned IP tracking

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 13:40:52 +01:00
db847ba1cd feat(simplex): Add SimpleX Chat self-hosted messaging servers
Integrate SimpleX Chat SMP and XFTP servers for privacy-focused messaging:

- secubox-app-simplex: Backend with LXC container management
  - SMP server for message relay (port 5223)
  - XFTP server for encrypted file sharing (port 443)
  - Auto-download of SimpleX binaries for aarch64/x86_64
  - TLS certificate generation (self-signed or Let's Encrypt)
  - Firewall and HAProxy integration

- luci-app-simplex: LuCI dashboard with:
  - Service status monitoring
  - Server address display with copy-to-clipboard
  - Full configuration forms for SMP, XFTP, and TLS
  - Install/certificate management actions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 12:53:41 +01:00
ec31cdba12 chore(feed): Update build artifacts for mitmproxy v0.5.0-r21
Added comprehensive CVE detection patterns for WAF filtering.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 11:31:21 +01:00
94c02c9224 feat(waf): Add comprehensive CVE detection patterns
Added 60+ CVE patterns for WAF filtering:

2021 CVEs:
- CVE-2021-44228 (Log4Shell)
- CVE-2021-41773 (Apache path traversal)
- CVE-2021-26084 (Confluence OGNL)
- CVE-2021-34473 (ProxyShell)
- CVE-2021-21972 (VMware vCenter)
- CVE-2021-22986 (F5 BIG-IP)

2022 CVEs:
- CVE-2022-22963 (Spring Cloud Function)
- CVE-2022-22965 (Spring4Shell)
- CVE-2022-1388 (F5 Auth Bypass)
- CVE-2022-26134 (Confluence OGNL)
- CVE-2022-41040 (ProxyNotShell)
- CVE-2022-42889 (Apache Commons Text)

2023 CVEs:
- CVE-2023-34362 (MOVEit Transfer)
- CVE-2023-22515/22518 (Confluence)
- CVE-2023-46747 (F5 BIG-IP)
- CVE-2023-27997 (Fortinet SSL VPN)
- CVE-2023-20198 (Cisco IOS XE)
- CVE-2023-4966 (Citrix Bleed)

2024 CVEs:
- CVE-2024-3400 (PAN-OS)
- CVE-2024-21887 (Ivanti)
- CVE-2024-1709 (ScreenConnect)
- CVE-2024-27198 (TeamCity)
- CVE-2024-23897 (Jenkins)
- CVE-2024-4577 (PHP-CGI)
- CVE-2024-6387 (OpenSSH)
- CVE-2024-55591 (FortiOS)

2025 CVEs:
- CVE-2025-15467 (OpenSSL CMS)
- CVE-2025-0282 (Ivanti)
- CVE-2025-23006 (SonicWall)

Plus CMS, Framework, Database, CI/CD, and Cloud patterns.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 11:27:31 +01:00
f6ab1fc6c5 chore(feed): Update build artifacts for crowdsec-dashboard v0.7.0-r32
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 11:23:44 +01:00
21f59b6c9a fix(crowdsec): Restore working setup page from settings.js
Restored the original settings.js functionality as setup.js with
updated nav references. The simplified version was broken.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 11:01:16 +01:00
a9086b1d21 chore(feed): Update build artifacts for crowdsec-dashboard v0.7.0-r31
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 10:58:07 +01:00
6298e8b961 refactor(crowdsec): Simplify LuCI interface - KISS setup
- Remove unused views: metrics.js, waf.js, wizard.js
- Remove unused CSS: wizard.css, soc.css
- Remove settings.js, replace with simplified setup.js
- Update menu: remove WAF, Metrics entries
- Update nav.js: remove references to deleted pages
- Add status grid CSS for setup page

The new Setup page provides:
- System status overview (Agent, LAPI, CAPI, Bouncer)
- Console enrollment form
- Service controls (start/stop/restart/repair)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 10:56:13 +01:00
840d226881 fix(crowdsec): Add capi_enrolled to status response
The settings page was showing "CAPI: Error" because the status
method didn't return the capi_enrolled field. Added CAPI status
check to get_status() so the health display shows correct status.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 10:50:35 +01:00
27c5900f53 chore(feed): Update build artifacts for v0.18.2
Updated package indices and IPK files for secubox-feed.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 10:48:10 +01:00
2ce7c5da3a fix(security): Move CVE-2025-15467 detection before SSRF check
Content-Type based CVE detection must happen before SSRF patterns
to avoid false positives when routing through localhost.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 10:44:23 +01:00
77e572a787 feat(security): Add CVE-2025-15467 detection and mitmproxy threat integration
- Add CVE-2025-15467 (OpenSSL CMS stack overflow) detection patterns
- Detect S/MIME/CMS content types that may be exploited
- Integrate mitmproxy threats into security-threats dashboard
- Security threats page now shows real-time WAF detections

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 10:34:20 +01:00
4a8975f436 feat(mitmproxy): Disable LAN transparent proxy by default
LAN transparent mode now requires explicit opt-in via transparent.enabled
to prevent HTTPS certificate errors for LAN clients.

Changes:
- mitmproxyctl: Check transparent_enabled before setting up LAN firewall rules
- LuCI settings: Add warning about certificate requirements for LAN mode
- Default config already has transparent.enabled='0'

WAN protection mode remains active for incoming threat detection.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 10:20:59 +01:00
f4b9c910c5 feat(mitmproxy): Add WAN protection mode for incoming traffic inspection
Add WAF-like functionality to mitmproxy for protecting services exposed
to the internet. Incoming WAN traffic is redirected through mitmproxy
for threat detection before reaching backend services.

Features:
- WAN protection mode with nftables rules for incoming traffic
- Enhanced bot scanner detection with 50+ scanner signatures
- Behavioral detection for config/admin/backup/shell hunting
- CrowdSec integration with new scenarios for bot scanners
- LuCI interface for WAN protection configuration
- DPI mirror mode support (secondary feature)

New CrowdSec scenarios:
- secubox/mitmproxy-botscan: Detect automated reconnaissance
- secubox/mitmproxy-shell-hunter: Detect shell/backdoor hunting
- secubox/mitmproxy-config-hunter: Detect credential file hunting
- secubox/mitmproxy-suspicious-ua: Detect suspicious user agents

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 10:07:40 +01:00
f8016cb12e fix(local-build): Use feeds path for toolchain package builds
- Change build path from package/secubox/ to package/feeds/secubox/
- Add -f flag to force install from secubox feed
- Add verification that package exists after feed install

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 07:40:29 +01:00
bae3b3f0c4 feat(local-build): Add missing toolchain package shorthands
Add shorthand names for all toolchain packages so they can be used
directly with the build command without requiring full directory names.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 07:15:38 +01:00
b0cf6e2240 fix(ollama): Show start prompt when Ollama is not running
Instead of showing clickable model suggestions when Ollama is stopped,
display a helpful message prompting the user to start Ollama first.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 07:15:38 +01:00
ed7184f45f fix(dnsguard): Fix subshell issues in provider lookup methods
Replace pipe-to-while loops with grep/cut to avoid subshell variable
scope issues in method_status, method_get_providers, and method_set_provider.

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