Examples service

jochenwierum edited this page Aug 28, 2012 · 2 revisions

Using and Controlling the OpenVPN Windows Service

How to control a OpenVPN Windows Service

Controlling a OpenVPN Process which runs as Windows service is possible since OpenVPN Manager 0.0.3.0. It is not very complicated and this guide will help you using this feature.

First, when installing OpenVPN, make sure that you also install the OpenVPN Windows Service. Then run regedit and navigate to HKEY_LOCAL_MACHINE\SOFTWARE\OpenVPN\. There are two important key: config_dir and config_ext. When the OpenVPN Service is statet, it opens the directory specified config_dir. Then it locates all files in this directory which ends with config_ext. It will not walk into subdirectories. OpenVPN Manager cannot guess, which file is used by the Service and which file should be startet as a userspace process. So use a different folder or a different file extension if you want to use both methods to control OpenVPN. I suggest using "ovpns" as config_ext.

Start OpenVPN Manager and check if all directories are located correctly. To control the Service, OpenVPN Manager depends on a few settings in the configuration file. The following directives must be set:

management 127.0.0.1 11193
management-query-passwords
management-hold
management-signal
management-forget-disconnect
auth-retry interact

If you have an OpenVPN version which is compiled with smartcard support, also add the following line:

pkcs11-id-management

The "management" directive can contain any port. When OpenVPN Manager starts a userspace process, it uses port 11194 + x, where x is the number of the connection. So I suggest to use Port 11193 - x for your custom configurations. When all these directives are set, OpenVPN Manager will list the file in the status window.

You may now (re-) start the OpenVPN Service. Start a "cmd" as Administrator and type something like:

C:\Windows\system32>net stop "OpenVPN Service"
C:\Windows\system32>net start "OpenVPN Service"

That's it, you're done. Try connect to the OpenVPN Service.