OpenVPN support is one of the things sorely missing from the iphone. And there is very little information about how one could go about getting OpenVPN working even on a jailbroken iphone. There is iopenvpn.com if you are running 2.x and it costs $29. This post is my attempt to fill this gap with step-by-step instructions on how to get openvpn working for free. But please be forewarned that I am not liable for any problems this might cause your iphone. Having said that, I have followed the instructions given below and have been successful in getting access to resources behind the corporate network using OpenVPN. Before we get started, here are some of the pre-requisites:

  • Jailbroken Iphone (I run 3.1.2 jailbroken using Blackrain)
  • Putty (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html)
  • WinSCP (http://winscp.net/eng/download.php or something similar)
  • OpenVPN certificates and openvpn configuration file (.ovpn). The certificate should not be password protected if you want to use this through SBSettings toggle. There is instructions to take the password off below. The .ovpn file should be renamed conf.ovpn and should also be pointing to the certificates without any path.

Step-by-Step instructions (Please run these as root by doing su root and entering your password)

  • In Cydia: Install Openvpn toggle for SBSettings
  • In your windows/mac assemble your certificate, .ovpn files etc into a local directory
  • rename your .ovpn file to conf.ovpn and add the following two lines to the end of the file. Here is a sample ovpn file. You need to change the remote host, cert details to yours.

  • up /var/mobile/Library/OpenVpn/update-resolv-conf
    down /var/mobile/Library/OpenVpn/update-resolv-conf

  • download the update-resolv-conf
  • Open a WinSCP session and copy all the files you assembled locally to /var/mobile/Library/OpenVpn
  • In the winscp session edit the /var/mobile/Library/SBSettings/Commands/com.offinf.openvpnup and change as follows:

  • #!/bin/sh
    /bin/rm /var/mobile/Library/SBSettings/Toggles/OpenVpn/OFF
    cd /var/mobile/Library/OpenVpn/
    "/usr/bin/openvpn-iphone --script-security 2 --config /var/mobile/Library/OpenVpn/conf.ovpn" &

  • Open Putty and login to your iphone as root.

  • $ cd /var/mobile/Library
    $ chown -R mobile.mobile OpenVpn
    $ cd OpenVpn
    $ chmod +x update-resolv-conf
    #### If you have a key with password. Remove the password with the command below.
    #### You will be asked for the password one last time
    #### Important: Leaving your certificate without a key is a security risk. Please turn on passcode lock in your settings
    #### This will ensure that if your phone does fall into the wrong hands they cant get into your network.
    $ cp my.key my.key.orig
    $ openssl rsa -in my.key.orig -out my.key
    #### Now test your vpn setup by doing the following:
    $ openvpn-iphone --script-security 2 --config conf.ovpn
    #### You should see it connecting to your vpn server and setting up routes. Try to use Safari to look at something
    #### behind the openvpn server.

  • Reboot your phone for the sbsettings toggle changes to take effect
  • After reboot, open SBSettings and turn on OpenVpn
  • Note: For trouble shooting install top from cydia and run top to see if the toggle spawns the openvpn-ip process.