Fix Windows Server proxy: HKLM mirror, ProxySettingsPerUser fix, policy detect
On Server / GPO baselines, ProxySettingsPerUser=0 makes WinINet ignore HKCU entirely. When elevated, force the flag to 1 and mirror proxy values to HKLM root + Connections blob. Detect Group Policy proxy locks and surface them so the user knows browsers will keep the policy value. Add diagnose_system_proxy() logged on every chain engage. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -30,7 +30,13 @@ from .firewall import disengage as fw_disengage, engage as fw_engage, is_admin
|
||||
from .gost_util import build_gost_cmd, ensure_gost, popen_no_window, read_gost_log_tail, terminate_process
|
||||
from .leak_detect import is_chain_leak, leak_reason
|
||||
from .mac_spoof import restore_macs, spoof_all_physical
|
||||
from .sysproxy import clear_system_proxy, is_system_proxy_set, set_system_proxy
|
||||
from .sysproxy import (
|
||||
clear_system_proxy,
|
||||
detect_policy_overrides,
|
||||
diagnose_system_proxy,
|
||||
is_system_proxy_set,
|
||||
set_system_proxy,
|
||||
)
|
||||
from .validator import check_chain_exit_ip, get_direct_ip, validate_proxies
|
||||
from .vpn_detect import VpnStatus, detect_vpn
|
||||
from .win_compat import probe as _win_probe
|
||||
@@ -462,6 +468,17 @@ class ChainService:
|
||||
self._notify({"type": "hops", "hops": chain, "status": "healthy", "exit_ip": exit_ip})
|
||||
self._notify({"type": "log", "text": f"✓ Chain healthy — Exit IP: {exit_ip}"})
|
||||
self._notify({"type": "phase", "phase": "running"})
|
||||
# Pre-flight: surface Group Policy locks (they will override us).
|
||||
pol_before = detect_policy_overrides()
|
||||
if pol_before:
|
||||
self._notify({"type": "log", "text": (
|
||||
f"Group Policy proxy lock detected ({len(pol_before)} entries) — "
|
||||
"these BEAT our settings. Browsers will keep the policy proxy "
|
||||
"(or DIRECT) until those keys are removed."
|
||||
)})
|
||||
for p in pol_before[:3]:
|
||||
self._notify({"type": "log", "text": f" ! {p}"})
|
||||
|
||||
set_system_proxy(
|
||||
self._settings.local_host,
|
||||
self._settings.local_port,
|
||||
@@ -472,10 +489,13 @@ class ChainService:
|
||||
"type": "log",
|
||||
"text": (
|
||||
f"System proxy → {self._settings.listen_addr()} "
|
||||
f"(WinINet root + Connections + WinHTTP) "
|
||||
f"(HKCU + HKLM(adm) + Connections + WinHTTP) "
|
||||
f"{'OK' if applied else 'FAILED — registry write rejected'}"
|
||||
),
|
||||
})
|
||||
# Post-flight diagnostic — every layer's actual state.
|
||||
for ln in diagnose_system_proxy():
|
||||
self._notify({"type": "log", "text": f" proxy: {ln}"})
|
||||
|
||||
# ── Health monitor loop ───────────────────────────────────────────────
|
||||
hc = int(self._settings.health_check_seconds)
|
||||
|
||||
Reference in New Issue
Block a user