Jumat, 03 Juli 2015

How to automatically log in to OpenVPN on Windows

Many people want to have their OpenVPN connection automatically start up and log in when they boot up their computer. Although there is no direct option in OpenVPN for Windows to accomplish it, it can be done.
The first step is to launch OpenVPN with a configuration attached so that it can connect to a server.
The following launch string is needed for either method:
For 32 bit Windows - "C:\Program Files\OpenVPN\bin\openvpn-gui.exe" --connect xxxxx.ovpn
For 64 bit Windows - "C:\Program Files (x86)\OpenVPN\bin\openvpn-gui.exe" --connect xxxxx.ovpn
The xxxxx is replaced with the name of the OpenVPN configuration file you wish to start. Your list of available .ovpn files can be found in the 'OpenVPN/config' folder on your computer.
You now need to add this to your WIndows registry start settings. Open regedit on your computer and go to:
Add a new string entry. Give it a name you can identify later such as "openvpn" then add the above string.
OpenVPN auto start

Note 1: If your Windows is not on the C: drive or you have OpenVPN installed in a different location, you will need to adjust the location in the above string to match your setup. You can also use the relative location such as %ProgramFiles% instead of C:\Program Files. However, that only solves the problem of Windows on a different drive. If you have OpenVPN loaded in a non standard location, you would still need to edit the string.
Note 2: For Windows Vista and Windows 7 and 8, OpenVPN-GUI must be run as administrator in order for the VPN to properly function. The most direct way to avoid these conflicts is to disable the UAC in Windows 7 and Vista. You can also set the program to always run as administrator in the properties of the application. Right-click on ' openvpn-gui-1.0.3.exe ', select 'Properties' then 'Compatibility'. Check the 'Run as Administrator' box.
When Windows boots it will start OpenVPN and attempt to log in to the VPN server that config file is pointing to.
OpenVPN will likely ask for a user name and password -- this is where things become problematic in Windows. Currently, there is no secure way to store the user name and password in Windows using OpenVPN. For security purposes, most versions of OpenVPN do not allow a user/password to be read from a file. If one is willing to take the security risk of having their login information saved in the clear on their hard drive, they can make OpenVPN automatically log in.
Recognizing the security risks the procedure is as follows:
1 - Create a file in the OpenVPN/config folder named password.txt
On the first line type your user name.
On the second line type your password
Save the file.
2 - Edit the .ovpn file referenced above in your launch string and find the line that reads 'auth-user-pass'.
Change it to 'auth-user-pass password.txt'.  Save and exit.
3 - Install version 2.3 of OpenVPN which supports this feature

Tidak ada komentar:

Posting Komentar