Automatically Connect OpenVPNGui to IPFire


Initial Installation

Set up your installation as per article Open VPN Installation for IPCop. Do not proceed further until this has been installed and tested. You must do this as an Administrator

Import your certificate into the Windows Certificate Store

  1. Run the Microsoft Management Console
    1. Start | Run | mmc
  2. Add the Certificates Snap-in
    1. File | Add/Remove Snap-in
    2. Add
    3. Certificates
    4. Add
    5. Computer Account
    6. Next
    7. Local Computer
    8. Finish
    9. Close
    10. Ok
  3. Import your PKCS12 client certificate file
    1. Console Root
    2. Certificates (Local Computer)
    3. select Personal
    4. Action
    5. All Tasks
    6. Import... (Wizard comes up)
      1. Next
      2. Browse
      3. find where your .p12 certificate is
      4. Files of type: Personal Information Exchange (*.pfx,*.p12)
      5. choose the file
      6. OK
    7. Next
    8. enter the associated password/passphrase
    9. choose 'Automatically select the certificate store based on the type of certificate'
    10. Next
    11. Finish.
    12. The certificate will be added to 'Certificates' below 'Personal'. Note: I had to exit MMC and restart it to see this certificate
  4. Get Thumbprint of Certificate
    1. double click on the certificate (it should be in Certificates, below Personal)
    2. Details
    3. Thumbprint
    4. Copy/Paste this somewhere for use later
      1. Note: I had to highlight it, then do a Ctrl-C (mouse keys don't work). I then created a text document on the desktop and pasted it in.

Extract the root certificate from your PKCS12 File

From a command prompt

cd "\Program Files\OpenVPN\config"
..\bin\openssl.exe pkcs12 -in yourkey.p12 -nokeys -cacerts -out somename-root-ca.crt

You will get the following (enter your password when asked)

WARNING: can't open config file: /usr/local/ssl/openssl.cnf
Enter Import Password:
MAC verified OK

This creates the file somename-root-ca.crt in your config folder. You will need it later.

Configure OpenVPN GUI to use Windows Certificate Store and root certificate

  1. Go to C:\Program Files\OpenVPN\config
  2. Edit your configuration file (???.ovpn)
  3. Add Line for Windows Certificate Store
    1. cryptoapicert "THUMB:your thumbprint"
    2. where your thumbprint is taken from the last step in Import your certificate into the Windows Certificate Store
    3. Example: cryptoapicert "THUMB:47 01 a6 c9 90 96 7b 3f 7b 09 1c 95 b6 44 a5 2a ca be 52 39"
  4. Add Line for name and location of Root Certificate
    1. ca "name and location of .crt file". You must double backslash the path. Backslash is an escape char, so it must be entered twice
    2. where name and location of .crt file is the complete path and filename of the ca your created in section Extract the root certificate from your PKCS12 File
    3. Example: ca "C:\\Program Files\\OpenVPN\\config\\myname-root-ca.crt"
  5. Remove all lines beginning with pkcs12 (put a pound sign in front to comment it out)

Test configuration

  1. Start OpenVPN GUI
  2. Right click on icon in systray (next to clock) and choose connect
  3. You should connect automatically.

== Set OpenVPN to run as a service ==

If all you want to do it give users the ability to run OpenVPN GUI without administrators rights, you need go no further. However, by completing the following steps, you can have the service started automatically and have the user logged into the VPN anytime their computer is online.

Edit the Registry

  1. Start | Run | Regedit
  2. Go to HKEY_LOCAL_MACHINE\SOFTWARE\OpenVPN-GUI\
  3. Create (if it does not exist) the keys allow_service and service_only
    1. Right Click on left pane when OpenVPN-GUI Highlighted
    2. Select New | String Data
  4. Set the values for allow-service and service_only to 1
  5. (Optional) Set the values of allow_edit and allow_password to 0
  6. Note: this enables (1's) and disabled (0's) menu options.

Give normal users the right to run the OpenVPN service

  1. Download and install subinacl from http://www.microsoft.com/download/en/details.aspx?id=23510 (''This is included in the Windows Resource Kits, so you might already have it).
  2. Open a command prompt
  3. %PROGRAMFILES%\Windows Resource Kits\Tools\SubInAcl.exe /SERVICE "OpenVPNService" /GRANT=username=TO
    1. %PROGRAMFILES% is generally a link to c:\Program Files
    2. username should be a Windows User Name

''You can also give users the rights to control services using Group Policies. See http://support.microsoft.com/default.aspx?scid=kb;en-us;288129 for additional information.

Set OpenVPN Service to run automatically

  1. Start | Control Panel | Administrative Tools | Services
  2. Right Click on OpenVPN Service and select Properties
  3. Change Startup Type to Automatic
  4. Click "Ok", Then File | Exit

Links

All information was gathered from the following locations. All I did was consolidate them.

  1. http://thegoldenear.org/toolbox/unices/remote-access.html#ipcop
  2. http://openvpn.se/files/howto/openvpn-howto_run_openvpn_as_nonadmin.html
  3. http://openvpn.net/archive/openvpn-users/2004-09/msg00234.html

Automatically Connect OpenVPNGui to IPCop (Zerina)

Last update:
2012-01-01 01:28
Author:
Rod
Revision:
1.3
Average rating:0 (0 Votes)

You can comment this FAQ

Chuck Norris has counted to infinity. Twice.