Android

TunnelWall

A free VPN and a per-app firewall, with no account

React NativeTypeScriptKotlinOpenVPNWireGuardSQLite

View source

Why I built it

I wanted my phone to be a complete toolkit for my own network without buying a security suite. HomeNet looks after the Wi-Fi. TunnelWall looks after the phone's own traffic: which apps go online, how much data they use, and stopping the ones I don't want.

It started as a VPN client for VPN Gate, a free network of volunteer relays run by the University of Tsukuba, so I could use a VPN without signing up anywhere. The firewall joined it later because Android allows only one VPN at a time, and a firewall on a phone works by being that VPN.

What it does

How it works

The relay list is fetched over HTTPS and parsed, cleaned and scored by latency in a plain TypeScript package, then cached in SQLite, so the last list shows at once while a fresh one loads. Android's VpnService hosts the tunnel, with ics-openvpn for the relays and the official WireGuard library for my own servers.

The firewall runs on firestack, the open-source network engine from the RethinkDNS app. Its Go runtime crashes when it shares a process with WireGuard's, so the firewall lives in its own Android process and shares its state with the screens through a database.

A security review hardened the relay path. The list is fetched over HTTPS only, each relay must present a certificate for the VPN Gate operator's domain, and relay configs are cut down to the directives VPN Gate uses, so a hostile relay can't write files on the phone.

Why build a VPN app when there are hundreds of free ones?

Free VPN apps usually want an account, and I had no way to check what they do with the traffic they carry. VPN Gate relays are free and need no account, but using them normally means downloading config files and importing them into a separate OpenVPN app. TunnelWall puts the relay list, the connection and a firewall in one app that reports to nobody.

Why not just install RethinkDNS for the firewall?

RethinkDNS is a good app, and TunnelWall's firewall is built on its engine. The problem is that Android runs one VPN at a time, so a separate firewall app and a VPN app can't both be on. Putting both in one app solves that.

Where it stands

Android only, installed from my private Store. The app is GPL-2.0 because it includes ics-openvpn. An iOS version is partly built.