mitmproxy / mitmproxy/mitmproxy
iOS Client Fails to Trust CA Certificate in WireGuard Mode Despite Full Trust
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 45.1k
- Forks
- 4.7k
- Avg merge
- 21h 12m
- Merged PRs (30d)
- 16
Description
Problem Description
When running mitmproxy in WireGuard mode, an iOS client fails to trust the mitmproxy CA, resulting in certificate errors for all HTTPS sites. This occurs even after the CA certificate has been installed as a profile and explicitly enabled for "Full Trust for Root Certificates" in iOS settings.
A separate Linux client connects to the same mitmproxy server, trusts the CA system-wide, and can browse all HTTPS sites without any issues, confirming the server-side setup is functional.
Steps to Reproduce
-
Server Setup (
proxyhost):- Debian 12 LXC container.
mitmproxy12.2.0 (standalone Linux binary) is installed.wireguard-toolsis installed.mitmproxyis started as asystemdservice in WireGuard mode:ExecStart=/usr/local/bin/mitmweb --mode wireguard --web-host 0.0.0.0
-
Working Linux Client Setup (
prox-testhost):- A separate Debian 12 LXC container.
- The
mitmproxy-ca-cert.pemfrom the server is copied to/usr/local/share/ca-certificates/mitmproxy.crt. update-ca-certificatesis run, successfully adding the CA to the system trust store.- The client connects to the
mitmproxyWireGuard server using the generated configuration. - Result:
curl -L https://example.comand other HTTPS sites work perfectly. Traffic is visible in themitmwebUI.
-
Failing iOS Client Setup (iPhone):
- The QR code generated by
mitmproxyis scanned and the WireGuard profile is successfully installed and connected. - The
mitmproxy-ca-cert.pemfile is installed on the iPhone, under Settings > General > VPN & Device Management. - In Settings > General > About > Certificate Trust Settings, the switch for the "mitmproxy" root certificate is toggled ON.
- The WireGuard VPN is active. DNS requests and other initial flows from the iPhone are visible in the
mitmwebUI.
- The QR code generated by
Observed Behavior
When opening Safari on the iPhone and navigating to any HTTPS site (e.g., https://example.com), the browser displays a "Connection Not Private" error.
Inspecting the certificate details on the error page correctly shows that the certificate for example.com is issued by the "mitmproxy" CA. However, the details also explicitly state that the certificate is "Not Trusted".
Expected Behavior
After enabling "Full Trust" for the mitmproxy root certificate in iOS settings, the browser should trust the certificates generated by mitmproxy and load HTTPS pages without error.
Troubleshooting Steps Taken
- Cleared Safari history and website data.
- Performed a "Reset Network Settings" on the iPhone.
- Removed and re-installed both the WireGuard profile and the CA certificate profile multiple times.
- Verified the correct DNS server (
10.0.0.53) is being assigned by the WireGuard configuration. - Blocked outgoing UDP traffic on ports 80 and 443 on the
proxyhost to rule out QUIC interference.
The issue persists despite all these steps. The core problem appears to be that iOS is ignoring the "Full Trust" setting for this specific CA when the traffic is routed through the WireGuard VPN.
I'm not sure if this is an iOS bug or not.
System Information
Mitmproxy: 12.2.0 binary
Python: 3.14.0
OpenSSL: OpenSSL 3.5.4 30 Sep 2025
Platform: Linux-6.8.4-3-pve-x86_64-with-glibc2.36
Checklist
- This bug affects the latest mitmproxy release.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No repository file, test, or entry point is identified. Start by reproducing the reported WireGuard setup with the iOS CA profile and compare it with the working Linux client, then determine whether the behavior is controlled by mitmproxy or iOS. Done would be a confirmed root cause with a concrete repository change or a documented external limitation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios
- Domain
- networking, security
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100