I hated running a VPN on Android, so I built a way to access my self-hosted services without one
retained text
I self-host a bunch of services on my VPS, some of which store pretty sensitive stuff. I wanted to keep them inaccessible to unauthenticated clients without relying on the apps' own login pages. The obvious solution is WireGuard/Tailscale, but I really dislike running a VPN, especially on Android. It takes up Android's only VPN slot, adds another layer of routing and encryption, and needs an always-on process with periodic keepalives, which drains my battery. So I ended up inventing a different approach: **mTLS directly between my devices and nginx, with no VPN involved.** The server side is pretty straightforward: nginx requires a client certificate signed by my private CA before forwarding requests to the actual services. Port 443 is publicly reachable, but clients without a valid certificate can't get through to the backend. The interesting part was Android. Most Android apps don't automatically use certificates from the system KeyChain, so I wrote an Xposed module that hooks into Conscrypt and the Android KeyChain APIs. It automatically supplies my client certificate to whitelisted apps when connecting to my servers. The result: * No VPN, TUN interface, or additional traffic routing. * No always-on VPN process or keepalives. * The Android VPN slot stays available for other VPNs. * Existing apps can use mTLS without being modified. * Client certificates are only offered for explicitly allowed hosts and apps. There are limitations, of course. It requires a rooted Android device, doesn't support every TLS implementation (Cronet, Flutter, etc.), and isn't a replacement for application-level authentication or CSRF protection. Detailed write-up and guide here: [https://difhel.dev/en/blog/zero-trust-beyond-vpn](https://difhel.dev/en/blog/zero-trust-beyond-vpn) The proof-of-concept Xposed module, test app, example PKI, and nginx configuration are open source (MIT).
document fetched 2026-11-20 00:29 · canonical https://reddit.com/r/selfhosted/comments/1y06zqq/i_hated_running_a_vpn_on_android_so_i_built_a_way