Commit Graph

36 Commits

Author SHA1 Message Date
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
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
d9e77745db fix(deps): Remove libubox/libubus/libuci from all SecuBox package dependencies
These base OpenWrt libraries are always present on the system but their
versions in the SDK-built feed don't match the router's installed versions,
causing opkg to fail with "Cannot satisfy dependencies" errors.

Fixed packages (18 total):
- secubox-core: removed libubox, libubus, libuci
- luci-app-ksm-manager: removed libubus, libubox
- luci-app-mqtt-bridge: removed libuci
- secubox-app-adguardhome: removed uci, libuci
- secubox-app-auth-logger: removed libubox-lua
- secubox-app-domoticz: removed uci, libuci
- secubox-app-gitea: removed uci, libuci
- secubox-app-glances: removed uci, libuci
- secubox-app-hexojs: removed uci, libuci
- secubox-app-lyrion: removed uci, libuci
- secubox-app-magicmirror2: removed uci, libuci
- secubox-app-mailinabox: removed uci, libuci
- secubox-app-mitmproxy: removed uci, libuci
- secubox-app-nextcloud: removed uci, libuci
- secubox-app-ollama: removed uci, libuci
- secubox-app-picobrew: removed uci, libuci
- secubox-app-streamlit: removed uci, libuci
- secubox-app-zigbee2mqtt: removed uci, libuci

The packages still work because these libs are implicitly available.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:46:27 +01:00
99aa610879 fix(mitmproxy): Fix web UI token access and transparent mode setup
- Add get_web_token to RPCD ACL permissions (was missing, causing 403)
- Add fallback token retrieval from container via lxc-attach
- Improve token capture regex to support alphanumeric tokens
- Fix startup script with background process + tee for reliable capture
- Add IP forwarding enablement for transparent proxy mode
- Fix bypass rule for traffic destined to router itself

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 07:34:22 +01:00
447e4ab2be fix(secubox-app-mitmproxy): Fix Docker image token capture for LuCI integration
- Add PYTHONUNBUFFERED=1 to ensure mitmweb output is not buffered
- Use inline while loop to capture authentication token from startup output
- Fix RPCD backend to read token from correct path ($DATA_DIR/.mitmproxy_token)
- Add proper shell detection and symlink creation in Docker rootfs extraction
- Remove unnecessary exec in pipeline that prevented output capture

The mitmweb authentication token is now properly captured and available
to the LuCI Web UI view for iframe embedding.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 09:24:45 +01:00
287bd24e3e fix(mitmproxy): Fix token capture with background job and tee
The previous pipe approach didn't work because the while loop
runs in a subshell. Now using a background job to poll the log
file for the token while tee outputs to both console and log.

Bump release to r13.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 08:55:34 +01:00
1dd0c95a09 feat(mitmproxy): Add embedded Web UI view with token auth
- Add get_web_token RPCD method to retrieve auth token
- Create webui.js view that embeds mitmweb in an iframe
- Capture auth token at startup and save to file
- Add Web UI navigation to all mitmproxy views
- Fix PATH for /usr/local/bin in Docker image
- Change default port from 8080 to 8888 (avoid CrowdSec conflict)

secubox-app-mitmproxy: bump to r12
luci-app-mitmproxy: bump to r2

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 08:49:59 +01:00
63422a07b0 fix(mitmproxy): Disable web authentication for LAN access
Recent mitmproxy versions require web authentication by default.
Disable it with --set web_password= for easier LAN access.

Bump release to r11.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 08:37:15 +01:00
a530e8abd6 fix(mitmproxy): Change default proxy port from 8080 to 8888
Port 8080 conflicts with CrowdSec API. Using 8888 as default.

Also removes --flow-detail option not available in latest mitmproxy.

Bump release to r10.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 08:35:51 +01:00
e5f5b9160b fix(mitmproxy): Remove --flow-detail option not in latest mitmproxy
The --flow-detail option doesn't exist in recent mitmproxy versions.

Bump release to r9.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 08:31:58 +01:00
a4fe5c0a3a feat(mitmproxy): Use official Docker image for latest mitmproxy
Extract rootfs directly from mitmproxy/mitmproxy Docker image.
This provides the latest mitmproxy with all Rust components pre-compiled.

No more version compatibility issues - uses whatever version is in
the official Docker image.

Bump release to r8.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 08:25:03 +01:00
7f399ec429 fix(mitmproxy): Remove --flow-detail option not available in 7.x
mitmproxy 7.0.4 doesn't support the --flow-detail option which was
causing the startup script to fail.

Bump release to r7.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 08:20:02 +01:00
6553edba3a fix(mitmproxy): Use mitmproxy 7.0.4 for Python 3.11 compatibility
mitmproxy 8.x has dataclass compatibility issues with Python 3.11
in the grpc contentviews module.

Bump release to r6.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 08:04:18 +01:00
0afdfc5b78 fix(mitmproxy): Pin werkzeug<3.0 for Flask compatibility
werkzeug 3.0+ removed url_quote from werkzeug.urls which breaks
Flask imports in mitmproxy 8.1.1.

Bump release to r5.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 07:52:44 +01:00
84a6a01fc8 fix(mitmproxy): Add build-base for zstandard compilation
zstandard requires gcc to compile. Added build-base and dev packages
for compilation, then remove them after pip install to save space.

Bump release to r4.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 07:49:24 +01:00
8b784ea99e fix(mitmproxy): Use mitmproxy 8.1.1 - last pure Python version
- mitmproxy 9.x requires mitmproxy-wireguard (Rust)
- mitmproxy 10.x requires mitmproxy_rs (Rust)
- mitmproxy 8.1.1 is the last version without any Rust dependencies

Bump release to r3.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 07:49:24 +01:00
4c7c76743d fix(mitmproxy): Use mitmproxy 9.0.1 to avoid Rust dependency
mitmproxy 10.x requires mitmproxy_rs which needs Rust compilation.
mitmproxy 9.0.1 is the last pure-Python version that works in Alpine
chroot without /proc mounted.

Bump release to r2.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 07:49:24 +01:00
8ba910c271 fix(mitmproxy): Pin to mitmproxy 10.1.6 to avoid Rust dependency
mitmproxy 10.2+ requires mitmproxy_rs which needs Rust 1.80+, but
Alpine 3.19 only has Rust 1.76. Using mitmproxy 10.1.6 which is the
last pure-Python version without Rust requirements.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 07:49:24 +01:00
f977f488e4 chore(mitmproxy): Update version to 0.4.0
Sync internal package versions for luci-app-mitmproxy and
secubox-app-mitmproxy to 0.4.0.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 07:49:24 +01:00
484c4e0574 chore(mitmproxy): Update version to 0.4.0
Sync internal package versions for luci-app-mitmproxy and
secubox-app-mitmproxy to 0.4.0.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 07:08:52 +01:00
159e1945b9 fix(mitmproxy): Install Rust toolchain for mitmproxy_rs compilation
mitmproxy 10.2+ requires mitmproxy_rs which needs Rust.
Install rust and cargo from Alpine packages, compile mitmproxy,
then remove build deps to save space.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 07:07:43 +01:00
87e6c53872 fix(mitmproxy): Use Alpine package instead of pip install
mitmproxy_rs now requires Rust compilation which fails in chroot
environment without /proc mounted. Switch to Alpine's pre-built
mitmproxy package from the community repository.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 07:03:23 +01:00
fe222d542c feat(mitmproxy): Add transparent mode, filtering addon, and whitelist
- Add nftables transparent mode support with automatic REDIRECT rules
- Create SecuBox Python filter addon for CDN/Media/Ad tracking
- Add whitelist/bypass configuration for IPs and domains
- Expand UCI config with transparent, whitelist, filtering sections
- Update RPCD backend with new config methods and firewall control
- Update LuCI settings view with all new configuration options
- Add new API methods: firewall_setup, firewall_clear, list management

Features:
- Transparent proxy with nftables integration
- CDN tracking (Cloudflare, Akamai, Fastly, etc.)
- Media streaming tracking (YouTube, Netflix, Spotify)
- Ad/tracker blocking
- IP and domain whitelist bypass

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 06:55:45 +01:00
c99d49739e feat(secubox-app-mitmproxy): Add LXC container support for mitmproxy
- Create mitmproxyctl script with LXC container management
- Alpine Linux rootfs with Python and mitmproxy via pip
- Support for regular, transparent, upstream, and reverse proxy modes
- UCI configuration for proxy_port, web_port, memory_limit, etc.
- procd init script for service management
- Update luci-app-mitmproxy RPCD backend for LXC container status

Ports:
- 8080: Proxy port
- 8081: Web interface (mitmweb)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 06:40:08 +01:00
a677f8cf49 feat: Media-flow UI + security updates
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 07:57:39 +01:00
71ed9ce7e3 fix: Install zstandard 0.23.0 first for musllinux wheel support
The zstandard package required by mitmproxy 8.1.1 doesn't have musllinux
wheels in older versions, causing pip to try compiling from source which
fails without gcc on the router.

Fix: Pre-install zstandard 0.23.0 which has musllinux aarch64 wheels
before installing mitmproxy.

Changes:
- Bump version to 2.1.0
- Revert to pip-based installation (native build requires full toolchain)
- Add zstandard 0.23.0 pre-install step in postinst
- Restore wrapper scripts for mitmproxy/mitmdump/mitmweb

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 18:35:31 +01:00
7f5cb14b96 feat: Rewrite mitmproxy with native OpenWrt build (v10.0.0)
Complete rewrite of secubox-app-mitmproxy to use native OpenWrt packages
instead of pip runtime installation.

New packages created:
- mitmproxy (10.0.0) - Native build from GitHub source
- python3-mitmproxy-rs (0.5.2) - Rust extension with PyO3
- python3-h11 (0.14.0) - HTTP/1.1 protocol
- python3-h2 (4.1.0) - HTTP/2 protocol
- python3-hyperframe (6.0.1) - HTTP/2 framing
- python3-hpack (4.0.0) - HPACK compression
- python3-wsproto (1.2.0) - WebSocket protocol
- python3-aioquic (1.0.0) - QUIC/HTTP3 support
- python3-pylsqpack (0.3.18) - QPACK encoder
- python3-kaitaistruct (0.10) - Binary parsing
- python3-publicsuffix2 (2.20191221) - Domain parsing
- python3-ldap3 (2.9.1) - LDAP support

Changes to secubox-app-mitmproxy:
- Removed pip dependency, now uses native +mitmproxy package
- Removed wrapper scripts (native binaries from mitmproxy package)
- Fixed iptables cleanup to use configured port
- Bumped version to 2.0.0

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 18:28:53 +01:00
c1c713d4c4 fix: Use mitmproxy 8.1.1 (pure Python, no Rust)
mitmproxy 9.x requires mitmproxy-wireguard (Rust).
Version 8.1.1 is pure Python and works on OpenWrt.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 15:36:11 +01:00
5f721d6d2c fix: Use mitmproxy 9.0.1 (no Rust dependency)
mitmproxy 10.x requires mitmproxy-rs which needs Rust compiler.
Version 9.0.1 is pure Python and works on OpenWrt.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 15:35:05 +01:00
31bbcaa89c fix: Use mitmproxy 10.4.2 for Python 3.10+ compatibility
mitmproxy 11.x requires Python 3.12 which is not available on OpenWrt.
Version 10.4.2 is the last stable release supporting Python 3.10+.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 15:03:21 +01:00
22bdf79f66 fix: mitmproxy runtime pip installation for architecture independence
- Switch to runtime pip installation instead of build-time
- Remove complex build dependencies (python3-package.mk)
- Add wrapper scripts for mitmproxy, mitmdump, mitmweb
- Postinst installs mitmproxy==11.1.3 via pip on device
- Supports all architectures with PKGARCH:=all

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 14:51:51 +01:00
7481c8acfc fix: Build mitmproxy from Python source for aarch64
- Update mitmproxy to v11.1.3
- Build from Python source (no prebuilt arm64 binaries)
- Add Python dependencies
- Add mitmproxy to local-build.sh and sync-openwrt-packages.sh
- Set PKGARCH:=all for Python package

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 14:32:59 +01:00
6c4257f950 feat: Add mitmproxy HTTPS interception proxy packages
New packages for full URL/cookie/header capture via MITM proxy:

secubox-app-mitmproxy:
- Downloads mitmproxy v11.1.2 binary for aarch64
- Transparent proxy mode with iptables integration
- mitmweb UI on port 8081
- Auto CA certificate generation
- mitmproxyctl CLI management tool

luci-app-mitmproxy:
- SecuBox themed dashboard with red color scheme
- Real-time request capture view
- Top hosts statistics
- CA certificate management
- Full UCI settings interface
- RPCD backend for ubus API

This enables full HTTP/HTTPS inspection including:
- Complete URLs (not just hostnames like nDPId)
- Cookies and headers
- Request/response bodies
- Flow recording for replay

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 14:25:12 +01:00