VPNAndroid

From Amahi Wiki
Revision as of 20:27, 8 August 2011 by Smccloud (talk | contribs)
Jump to: navigation, search

VPN Client - Android - HTC Android G1/Dream

This guide is written for a HTC Android G1/Dream phone rooted with Cyanongenmod 5.

[update March 24, 2011: Tested and works with Cyanogenmod 7.0, thus any CM7 compatible phone]

[update August 8, 2011: Tested and works with Cyanogenmod 7.1, thus any CM 7.1 compatible phone]

In your Linux-based OS computer..

Then, from the terminal run

bash code
​cd /home/username/openvpn openssl pkcs12 -export -in AmahiHDAClient.crt -inkey AmahiHDAClient.key -certfile ca-cert.crt -name Amahi -out certs.p12​


You will be asked for a export password for the certs.p12 file - enter amahi twice.

You should now have a certs.p12 file in your /home/username/openvpn folder, copy this certs.p12 file to the root of your sdcard on the Android phone.

Now on the Android phone..

    Menu -> Settings -> Location & Security -> Install from SD card

This will show you certs.p12, select this and enter the password amahi, after it has extracted the certificates, you will be asked to name the certificate, enter Amahi.

Now on the Android phone

    Menu -> Settings -> Wireless & networks -> VPN settings -> Add VPN -> Add OpenVPN VPN

VPN name = Amahi

Set VPN server = yourHDAnickname.yourhda.com

User authentication = Yes

Set CA certificate - Amahi

Set user certificate - Amahi

Menu -> Advanced -> LZO compression = Yes

Back

Menu -> Save

You should now see an Amahi entry, click on this to connect. It may ask you for the certificate access password. Then it may ask for your username and password that you use to loginon your HDA. You should see that you are connected, enjoy your VPN connection to your HDA server.

VPN Client - Android 2.2 - DROID X (Verizon Wireless)

Contact me in the forums if you need help setting this up. If you have a later version of Android such as Gingerbread (Android 2.3) then you can't use this tutorial for setting up openvpn. You can however use the openvpn configurations if your phone is already set up with openvpn.

Sag47 00:51, 5 April 2011 (PDT)

This tutorial is not for the feeble minded. I tried writing it as best as I could to keep it a "How to VPN" article and not a "How to root my droid" topic.

The default Droid X from Verizon does not come with openvpn installed. It's a little annoying and you have to be a little tech savvy to get it working. I am outlining instructions here for how I connected my Droid X to my Amahi HDA.

Some prerequisites:

  • Your phone must be rooted.
  • I am running Android 2.2 so these instructions may become outdated. I also recommend you be running Android 2.2 Froyo on your Droid X
  • You should have adb installed (or running a more advanced bash terminal on Android like Better Terminal Emulator Pro app)
  • Install the following apps
    • OpenVPN Installer
    • OpenVPN Settings

Create a directory on your SDCARD called openvpn or if in the terminal /sdcard/openvpn.

Follow the general VPNLinux instructions but place all of the configurations and certificates in the openvpn folder on your sdcard.

Install openvpn using the "OpenVPN Installer" app and select /system/bin each time the app asks for a location to place a binary.

You can run one of the following commands to grab the mount point of your system folder. (Run commands through adb or in a terminal on your Droid)

    df | grep system
    cat /proc/mounts | grep system
    cat /proc/mounts

My device is mounted on /dev/block/mmcblk1p21 so that is the device I am using in this tutorial. Download tun_alt.ko as recommended in this post. Copy it to the root of your sdcard.

Now we install the kernel module. Run the following command sequence (through adb or a terminal on your Droid).

    su
    mount -o rw,remount /dev/block/mmcblk1p21 /system
    mv /sdcard/tun_alt.ko /system/lib/modules/tun.ko
    cd /system/lib/modules
    chown root\: tun.ko
    chmod 644 tun.ko
    
    #now lets test it
    insmod /system/lib/modules/tun.ko

If you don't see any output and the "OpenVPN Installer" app successfully installed openvpn then you should be set up.

Double check your configuration in /sdcard/openvpn. Once you know everything is good then run the "OpenVPN Settings" app. It should automatically detect your configuration.

Enable OpenVPN. Select your config to turn on the tunnel. Then you should see a prompt in your notification status prompting for a password. My Droid X connected to the network after that.

There's one final step. If you remember you manually ran the insmod /system/lib/modules/tun.ko command but when you reboot your phone the module will no longer be loaded.

Go into the settings for the "OpenVPN Settings" app and modify the TUN module settings.

  • Set "Load module using" to insmod.
  • Set "Path to tun module" to /system/lib/modules/tun.ko

Reboot your phone and test the configurations. It should be a one click process within the "OpenVPN Settings" app.