fix(streamlit): Route CLI emancipate through WAF (mitmproxy_inspector)
- Update _emancipate_haproxy() to use mitmproxy_inspector backend - Add mitmproxy route entries for domain -> streamlit port - Aligns CLI behavior with RPCD emancipate_instance Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
dd9d1f1236
commit
93fcefa5c3
@ -1301,11 +1301,11 @@ _emancipate_haproxy() {
|
|||||||
uci set haproxy.${server_name}.check="1"
|
uci set haproxy.${server_name}.check="1"
|
||||||
uci set haproxy.${server_name}.enabled="1"
|
uci set haproxy.${server_name}.enabled="1"
|
||||||
|
|
||||||
# Create vhost with SSL
|
# Create vhost with SSL - Route through mitmproxy_inspector for WAF protection
|
||||||
local vhost_name=$(echo "$domain" | tr '.-' '_')
|
local vhost_name=$(echo "$domain" | tr '.-' '_')
|
||||||
uci set haproxy.${vhost_name}=vhost
|
uci set haproxy.${vhost_name}=vhost
|
||||||
uci set haproxy.${vhost_name}.domain="$domain"
|
uci set haproxy.${vhost_name}.domain="$domain"
|
||||||
uci set haproxy.${vhost_name}.backend="$backend_name"
|
uci set haproxy.${vhost_name}.backend="mitmproxy_inspector"
|
||||||
uci set haproxy.${vhost_name}.ssl="1"
|
uci set haproxy.${vhost_name}.ssl="1"
|
||||||
uci set haproxy.${vhost_name}.ssl_redirect="1"
|
uci set haproxy.${vhost_name}.ssl_redirect="1"
|
||||||
uci set haproxy.${vhost_name}.acme="1"
|
uci set haproxy.${vhost_name}.acme="1"
|
||||||
@ -1313,6 +1313,17 @@ _emancipate_haproxy() {
|
|||||||
|
|
||||||
uci commit haproxy
|
uci commit haproxy
|
||||||
|
|
||||||
|
# Add mitmproxy route for this domain
|
||||||
|
local routes_file="/srv/mitmproxy/haproxy-routes.json"
|
||||||
|
local routes_file_in="/srv/mitmproxy-in/haproxy-routes.json"
|
||||||
|
if [ -f "$routes_file" ]; then
|
||||||
|
# Add route: "domain": ["192.168.255.1", port]
|
||||||
|
sed -i "s/}$/,\"${domain}\":[\"192.168.255.1\",${port}]}/" "$routes_file" 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
if [ -f "$routes_file_in" ]; then
|
||||||
|
sed -i "s/}$/,\"${domain}\":[\"192.168.255.1\",${port}]}/" "$routes_file_in" 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
|
||||||
# Generate HAProxy config
|
# Generate HAProxy config
|
||||||
if command -v haproxyctl >/dev/null 2>&1; then
|
if command -v haproxyctl >/dev/null 2>&1; then
|
||||||
haproxyctl generate 2>/dev/null
|
haproxyctl generate 2>/dev/null
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user