- 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>
45 lines
674 B
Bash
Executable File
45 lines
674 B
Bash
Executable File
#!/bin/sh /etc/rc.common
|
|
|
|
START=95
|
|
STOP=10
|
|
USE_PROCD=1
|
|
|
|
PROG=/usr/sbin/mitmproxyctl
|
|
NAME=mitmproxy
|
|
CONFIG=mitmproxy
|
|
|
|
start_service() {
|
|
local enabled
|
|
config_load "$CONFIG"
|
|
config_get enabled main enabled '0'
|
|
|
|
[ "$enabled" = "1" ] || {
|
|
echo "mitmproxy is disabled. Enable with: uci set mitmproxy.main.enabled=1"
|
|
return 0
|
|
}
|
|
|
|
procd_open_instance
|
|
procd_set_param command "$PROG" service-run
|
|
procd_set_param respawn 3600 5 5
|
|
procd_set_param stdout 1
|
|
procd_set_param stderr 1
|
|
procd_close_instance
|
|
}
|
|
|
|
stop_service() {
|
|
"$PROG" service-stop
|
|
}
|
|
|
|
reload_service() {
|
|
stop
|
|
start
|
|
}
|
|
|
|
service_triggers() {
|
|
procd_add_reload_trigger "$CONFIG"
|
|
}
|
|
|
|
status() {
|
|
"$PROG" status
|
|
}
|