fix(mitmproxy): Sync autoban config to all instances

The reload-autoban command was only writing to the default data path,
missing the mitmproxy-in and mitmproxy-out instances. Now iterates
over all configured instances to ensure autoban.json is updated
everywhere.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
CyberMind-FR 2026-02-14 06:03:46 +01:00
parent 1fcddb6de3
commit 507263f6a7

View File

@ -1435,11 +1435,24 @@ cmd_haproxy_enable() {
# =============================================================================
cmd_reload_autoban_config() {
load_config
log_info "Reloading auto-ban configuration..."
write_autoban_config
log_info "Auto-ban config updated at $data_path/autoban.json"
# Write to all instance data paths
local instances=$(uci show mitmproxy 2>/dev/null | grep '=instance$' | sed 's/mitmproxy\.\([^=]*\)=instance/\1/')
if [ -n "$instances" ]; then
for inst in $instances; do
load_instance_config "$inst"
load_config
write_autoban_config
log_info "Auto-ban config updated at $data_path/autoban.json"
done
else
# Legacy single-instance mode
load_config
write_autoban_config
log_info "Auto-ban config updated at $data_path/autoban.json"
fi
}
cmd_process_autoban() {