Uninstall And Manual Cleanup
Use the packaged Patronus uninstaller first. The manual commands below are recovery steps for cases where the app, helper, or an E2E test exits before it restores the local proxy or removes the local CA.
Windows
Section titled “Windows”Run the packaged uninstaller from the Patronus install folder when it is available:
& "$env:LOCALAPPDATA\Programs\Patronus Desktop\Uninstall Patronus.cmd"If Windows still shows proxy errors after uninstall, open PowerShell as Administrator and run:
$internetSettings = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings"Set-ItemProperty -Path $internetSettings -Name ProxyEnable -Value 0 -Type DWordRemove-ItemProperty -Path $internetSettings -Name ProxyServer -ErrorAction SilentlyContinueRemove-ItemProperty -Path $internetSettings -Name ProxyOverride -ErrorAction SilentlyContinueRemove-ItemProperty -Path $internetSettings -Name AutoConfigURL -ErrorAction SilentlyContinuenetsh winhttp reset proxyipconfig /flushdnsStop leftover Patronus and mitmproxy processes if they are still running:
foreach ($name in @( "patronus-helper.exe", "patronus-wfp-redirector.exe", "patronus-redirector.exe", "proxy-sidecar.exe", "mitmdump.exe", "mitmproxy.exe")) { taskkill /F /T /IM $name 2>$null}Remove Patronus/mitmproxy CA trust entries:
$thumbprints = @()foreach ($file in @( "$env:USERPROFILE\.mitmproxy\mitmproxy-ca-cert.cer", "$env:USERPROFILE\.mitmproxy\mitmproxy-ca-cert.pem", "$env:USERPROFILE\.mitmproxy\mitmproxy-ca.pem")) { if (Test-Path $file) { try { $thumbprints += ([System.Security.Cryptography.X509Certificates.X509Certificate2]::new($file)).Thumbprint } catch {} }}
Get-ChildItem Cert:\CurrentUser\Root,Cert:\LocalMachine\Root -ErrorAction SilentlyContinue | Where-Object { $thumbprints -contains $_.Thumbprint -or $_.Subject -match "(?i)\bmitmproxy\b" -or $_.Issuer -match "(?i)\bmitmproxy\b" } | Remove-Item -ForceRemove runtime CA and proxy environment values:
foreach ($name in @( "NODE_EXTRA_CA_CERTS", "SSL_CERT_FILE", "REQUESTS_CA_BUNDLE", "CURL_CA_BUNDLE", "PIP_CERT", "HTTP_PROXY", "HTTPS_PROXY", "ALL_PROXY", "http_proxy", "https_proxy", "all_proxy", "NODE_USE_ENV_PROXY")) { [Environment]::SetEnvironmentVariable($name, $null, "User") [Environment]::SetEnvironmentVariable($name, $null, "Machine") Remove-Item "Env:\$name" -ErrorAction SilentlyContinue}Remove local mitmproxy CA files if Patronus was the only app using them:
Remove-Item "$env:USERPROFILE\.mitmproxy\patronus-ca-bundle.pem" -Force -ErrorAction SilentlyContinueRemove-Item "$env:USERPROFILE\.mitmproxy\mitmproxy-ca-cert.cer" -Force -ErrorAction SilentlyContinueRemove-Item "$env:USERPROFILE\.mitmproxy\mitmproxy-ca-cert.pem" -Force -ErrorAction SilentlyContinueRemove-Item "$env:USERPROFILE\.mitmproxy\mitmproxy-ca.pem" -Force -ErrorAction SilentlyContinueRemove-Item "$env:USERPROFILE\.mitmproxy\mitmproxy-ca.p12" -Force -ErrorAction SilentlyContinueOpen a new terminal window after changing environment values.
Run the packaged uninstaller when it is available:
open "/Applications/Uninstall Patronus.app"If only the script is present:
sudo "/Applications/.uninstall_patronus_system.sh" --remove-apps --remove-mitmproxy-filesIf network access still fails after uninstall, reset manual proxy settings for all network services:
while IFS= read -r service; do [ -z "$service" ] && continue sudo networksetup -setwebproxystate "$service" off sudo networksetup -setsecurewebproxystate "$service" off sudo networksetup -setsocksfirewallproxystate "$service" off sudo networksetup -setautoproxystate "$service" offdone < <(networksetup -listallnetworkservices | tail -n +2 | sed 's/^\*//')Stop leftover Patronus and mitmproxy processes if they are still running:
pkill -x "Patronus Desktop" || truepkill -x "Patronus" || truepkill -x "proxy-sidecar" || truepkill -x "rendezvous-sidecar" || truepkill -x "mitmdump" || truepkill -x "mitmproxy" || trueRemove the mitmproxy CA from macOS keychains:
sudo security delete-certificate -c "mitmproxy" /Library/Keychains/System.keychain || truesecurity delete-certificate -c "mitmproxy" "$HOME/Library/Keychains/login.keychain-db" || trueRemove runtime CA and proxy environment values from the current launch session:
for name in NODE_EXTRA_CA_CERTS SSL_CERT_FILE REQUESTS_CA_BUNDLE CURL_CA_BUNDLE PIP_CERT HTTP_PROXY HTTPS_PROXY ALL_PROXY http_proxy https_proxy all_proxy NODE_USE_ENV_PROXY; do launchctl unsetenv "$name" || truedoneRemove Patronus shell profile blocks:
for file in "$HOME/.zshrc" "$HOME/.zprofile" "$HOME/.bash_profile" "$HOME/.bashrc" "$HOME/.profile"; do [ -f "$file" ] || continue perl -0pi -e 's/# Added by Patronus Node CA \(begin\).*?# Added by Patronus Node CA \(end\)\n?//gs' "$file" perl -0pi -e 's/# Added by Patronus Python CA \(begin\).*?# Added by Patronus Python CA \(end\)\n?//gs' "$file"doneRemove the Patronus proxy env source file and references from shell profiles:
proxy_env_file="$HOME/Library/Logs/com.patronus.desktop/patronus_proxy_env.sh"for file in "$HOME/.zshrc" "$HOME/.zprofile" "$HOME/.bash_profile" "$HOME/.bashrc" "$HOME/.profile"; do [ -f "$file" ] || continue PATRONUS_PROXY_ENV_FILE="$proxy_env_file" perl -ni -e 'print unless index($_, $ENV{PATRONUS_PROXY_ENV_FILE}) >= 0' "$file"donerm -f "$proxy_env_file"Remove local mitmproxy CA files if Patronus was the only app using them:
rm -f "$HOME/.mitmproxy/patronus-ca-bundle.pem"rm -f "$HOME/.mitmproxy/mitmproxy-ca-cert.cer"rm -f "$HOME/.mitmproxy/mitmproxy-ca-cert.pem"rm -f "$HOME/.mitmproxy/mitmproxy-ca.pem"rm -f "$HOME/.mitmproxy/mitmproxy-ca.p12"Flush DNS after changing proxy settings:
sudo dscacheutil -flushcachesudo killall -HUP mDNSResponderRestart open terminal sessions after changing launch or shell environment values.