Setting up OpenVPN client on iOS

It goes without saying that it might be a good idea to be careful about what you do on an unsecured wifi. And there are times, such as when travelling, when the only connectivity option is a public, unsecured wifi.

Normally, you just avoid doing anything sensitive while on such connection, but during longer trips, for example, it might be difficult.

There are tons of VPN providers nowadays and these usually make your client setup as easy as possible, but if you want to use your own server for this then for some reason I found that the client configuration part can still take time as the documentation is a bit suboptimal to say the least.

Anyways, long story short, the client configuration is acutally straightforward.
You only need to import one configuration file into your iOS device and in this file you can copy/paste all the certs and key.

Here’s a working example that I tested with OpenVPN 2.2* on the server side and OpenVPN connect 1.1.1 on an iPhone running iOS 10.0.2

client
proto tcp
remote YOUR_VPN_SERVER_HOSTNAME
port YOUR_VPN_SERVER_PORT
dev tun
nobind

key-direction 1

<ca>
-----BEGIN CERTIFICATE-----
... your ca cert here ...
-----END CERTIFICATE-----
</ca>

<cert>
-----BEGIN CERTIFICATE-----
... your client cert here ...
-----END CERTIFICATE-----
</cert>

<key>
-----BEGIN PRIVATE KEY-----
... your client key here ...
-----END PRIVATE KEY-----
</key>

You simply need to copy/paste the contents of your ca.crt and client crt and key into this file, then name it, say, my-vpn-config.ovpn.

Then you need to somehow import it in your iOS device.
I used OneDrive for this, but quite possibly you can use any other cloud storage service or even just email it as an attachment.

Main thing to look for is the “Open in another app” feature

Afterwards, select OpenVPN

And then OpenVPN connect app will allow you to import it nicely

And you’re done.