Friday, March 14, 2014

OpenVPN Client on Windows 8.1

After realizing that my L2TP VPN connection wasn't actually working when the PSK was provided, and therefore was not encrypting anything, I decided to implement OpenVPN instead.



I installed the latest OpenVPN x64 Windows client from http://openvpn.net/index.php/open-source/downloads.html and quickly discovered -- to my dismay -- that OpenVPN-GUI.exe would not run properly under Windows 8.1.

Mercifully, others had encountered the same problem and documented the basic and simple fact that the CLI application still functions properly, even if the GUI is completely borked in this version of Windows. They were right, and running openvpn.exe from the command line connects like a champ, and works beautifully.

But, this is windows and therefore I reserve the right to be too lazy to type every time I wish to connect.  So, I created a simple two-line batch file, and stuck a shortcut to it on the desktop. Now I just have to run this shortcut as administrator, check the status messages, and minimize the cmd window until I'm ready to disconnect.

The batch file looks a bit like this, but without the obfuscation listed here:
cd c:\users\USERNAME\documents\openvpn\
cmd /K C:\Progra~1\openvpn\bin\openvpn.exe MYVPNPROFILE.ovpn
As you likely guessed, the connection profile file and its corresponding certificate are contained in the C::\users\USERNAME\documents\openvpn\ directory. The "/K" parameter causes the command prompt window to remain open, which is necessary; the same is true of running the batch file as Administrator.  Terminating the window will drop the TAP network connection which is essential for the VPN to function, but it can be safely and easily minimized. If you don't run as admin, there aren't permissions to build the network connection...