How to import an OpenVPN profile on iOS (without iTunes)

Importing an OpenVPN configuration typically requires that the importer program has access to several files. That’s easier with the open filesystem on Android, but on iOS it’s more difficult since apps have more restricted access to the filesystem.

Here’s a way that you can import an OpenVPN configuration file on iOS without using iTunes. The secret is that we will be merging the multiple configuration files into one single file, then importing that.

  1. Download the OpenVPN files from your VPN provider. They should provide some certs and keys for you.
  2. Edit the .ovpn profile file.
  3. Comment out the following lines that look like this (add the #’s’):

     #ca ca.crt
     #cert server.crt
     #key server.key
    
  4. Add this section to the bottom of the file:

     <ca>
     [--- CONTENTS OF ca.crt GOES HERE ---]
     </ca>
     <cert>
     [--- CONTENTS OF server.crt GOES HERE ---]
     </cert>
     <key>
     [--- CONTENTS OF server.key GOES HERE ---]
     </key>
    
  5. Insert the contents of each file provided by your VPN operator into the placeholder spaces above. When you’re done, the file should look kinda like this:

     client
     dev tun
     proto tcp
     remote xxx.xxx.xxx.xxx xxxx
     resolv-retry infinite
     nobind
     persist-key
     persist-tun
     #ca ca.crt
     #cert server.crt
     #key server.key
     remote-cert-tls server
     #dhcp-option DNS 8.8.8.8
     route-delay 2
     route-method exe
     comp-lzo
     verb 3
     auth-nocache
     cipher AES-256..................................
     ncp-ciphers AES-256.............................
     <ca>
     -----BEGIN CERTIFICATE-----
     MIID............................................
     -----END CERTIFICATE-----
     </ca>
     <cert>
     Certificate:
         Data: ......................................
         Signature Algorithm: .......................
     -----BEGIN CERTIFICATE-----
     MII.............................................
     -----END CERTIFICATE-----
     </cert>
     <key>
     -----BEGIN PRIVATE KEY-----
     MII.............................................
     -----END PRIVATE KEY-----
     </key>
    
  6. Save that file and send it to yourself securely via iCloud files. (Try not to email it to yourself, that’s less secure.)
  7. On the iOS device, find the file in iCloud files. Share the file with the OpenVPN program. That will launch the importer and allow you to set up the VPN, bringing along all of the certs that used to be separate files in one package.