OpenVPN

An OpenVPN profile connects to an OpenVPN server with the server's own .ovpn file: over UDP, over TCP, or with stunnel inside an ordinary TLS connection on port 443. SRP VPN Connect does this with the same core on iPhone and Android: OpenVPN 3 Core 3.11.7.

How an OpenVPN connection works

  1. The profile. The .ovpn file says where the server is and holds the certificates and keys: the server's CA, the phone's own certificate and key, and the tls-crypt key that hides the connection from anyone without it. A profile for a password login has no certificate of its own and asks for a username and password instead.
  2. The connection. The app connects to the server over UDP or TCP, as the profile says. With stunnel on, it opens a TLS connection to the server's stunnel listener first, which looks like a web connection on port 443, and OpenVPN runs inside it over TCP.
  3. The handshake. Both ends check each other's certificates in a TLS handshake inside OpenVPN's control channel, then agree on a cipher for the traffic, usually AES-256-GCM.
  4. The tunnel. The server gives the phone an address, its name servers and its routes, usually all of the phone's IPv4 traffic, and the app sets up the VPN with them.
  5. Keeping it up. Both ends ping each other every 10 seconds when nothing else goes. When the connection breaks, the server restarts, or nothing has come for 60 seconds, Auto Reconnect connects again.

Where to start

  1. Set up the server: OpenVPN server builds an OpenVPN 2.6 server on Ubuntu 24.04 with certificates, profiles for the phones, an optional password login, and stunnel with a Let's Encrypt certificate.
  2. Install the app: on iPhone from TestFlight, on Android by building it from the source; see Installation. Our tests ran the code of commit 48eaf2f7 on the iPhone and of cd3916be, which follows it, on Android; on iPhone use TestFlight build 39 (commit c088fdb7) or later, the first with this code.
  3. Add an OpenVPN profile: Setting up the app.
  4. The server settings that matter to the app, and what each profile field does: Configuration Reference.
  5. If it does not connect: Troubleshooting.

What was tested

Test results lists every case we ran against our OpenVPN server, with its result on an iPhone and on an Android phone: transfers over UDP, TCP and stunnel in both directions and 16 connections at once, UDP through the tunnel, certificate and password logins and their refusals, revoked and foreign certificates, a server of another CA, the Server and Port fields and a profile with two servers, stunnel with Let's Encrypt and with a CA of its own, other names, TLS 1.2 only and a closed port, each TLS Fragmentation mode as the server received it, damaged, static-key and passphrase-protected profiles, older servers (net30, tls-auth with AES-CBC, compression), the log levels, and what happens on sleep, when the server restarts or halts the session, when stunnel restarts, when the network path goes dead, when the phone switches networks, when the server is away for a while and when Retry Times runs out.