Custom OpenVPN Installer XP (NSIS)

In this tutorial I will show you how to roll your own custom OpenVPN client installer using NSIS. The installer will include the Better OpenVPN GUI Client that I have previously written about. This tutorial is a modified version of Mathias Sundman’s original tutorial which can be found here.

Note: Customized OpenVPN Installer Source has been updated to version 2.3.11 including the NDIS Version 6 network driver and our OpenVPN GUI v10 client on May 13, 2016. The new NDIS 6 driver is compatible and recommended for Windows Vista and newer OS’s. Also note that the OpenSSL heartbleed vulnerability does not affect this package as it is a client only install package. OpenVPN Installer 2.4.X is available at Custom OpenVPN Installer (NSIS)

Required software

  • NSIS 3.0b3 – Nullsoft Scriptable Install System available here.
  • Customized OpenVPN Installer Source and NSIS build scripts available (Vista +) here.
  • Deprecated OpenVPN Installer Source and NSIS build scripts available (XP) here.

Preparations

  • Download and install NSIS 3.0b3 (requires full install).
  • Download and extract the OpenVPN-N6-Installer-Source.zip file referred to above.
  • Note: all source files must be in the same directory in order to compile.

Packaging

  • Building the installer package: simply right-click the NSIS script (openvpn.nsi) and chose Compile NSI.
  • openvpn.nsi may be modified using Notepad++ or your favorite text editor to customize your installer.
  • Do not modify setpath.nsi.

Modify The Script

How do I include my own openvpn configuration file?

  • Create your own config file and name it as you want the connection named when using the GUI. For example Office.ovpn.
  • Create a config folder inside the openvpn folder.
  • Put Office.ovpn in the openvpn\config folder.
  • Under the OpenVPN GUI section in the NSIS script uncomment the following line: File "${HOME}\config\Office.ovpn"
Did you find this article useful? Why not share it with your friends?

33 thoughts on “Custom OpenVPN Installer XP (NSIS)

  1. Hi. This is great, but the username password dialog doesn’t have option to save login details. Please can you tell me how to do that? Or is that part of the version 11 GUI?

    I have now spent days trying different OpenVPN GUI versions from different places and none work with saving login plus having custom installer (for config file).
    Some save login details but those ones I cannot work out how to config the installer to include my config files etc. I am now going round in circles 🙁

    Thank you.

    1. Paul, we will be releasing a new article in the next week or so detailing the build for 2.4 and above. We have already published our build of the v11 client here. Using the client, you can pass your username and password using a text file with username on first line and password on second line. In your config, you should have a line like auth-user-pass Home.txt where home.txt is the file with username and password. Hope that helps

      1. Thanks for the reply.

        I have found this method, (having an auth file with login details). But it’s another step in the puzzle for some clients. They would have to create or edit the file. I guess I could export their login details from my website database to a text file for them to download, but they’d still have to save it to the correct directory etc.

        My users are mostly elderly/retired. I’m trying to set up a UK VPN so people who have moved from the UK can still watch UK TV. Since they’re not good with computers, I need to make this as easy as possible.

        The clients *should* already know their website login details, so subscribing / using a VPN should be as easy as downloading, installing (with the config already set up), then entering their login details, which gets saved for future use.

        I have found some OpenVPN GUI version has option to save username and password. 2.4 does this I believe, but with no customer installer guide on the net, I am completely lost. So, fingers crossed that your new article will be what I am looking for 🙂

        Kind regards.

        1. Paul, unfortunately I don’t think the 2.4 branch is going to have the features you need. You could probably build custom installers on the fly from your website if you are using a PHP based site. I know Pfsense currently has that feature. If you would like me to contact you offline via email to discuss further, let me know.

          1. The GUI (11.4.0.0) is installed with the latest openvpn-install-2.4.0-I601 in my case has username and password dialog with “save password” option which saves between sessions.
            This would be perfect, if I could work out how to make an installer and package the config file.
            if you are making a custom installer for this version then that sounds like it will be what I really need.
            (Hopefully with no other settings changed so the save password option is still there and installs shortcuts.)
            If not, then I would appreciate if you could contact me. Many thanks

  2. There is an issue with the openvpn.nsi, you should also add the HKLM, not just the HKCU for the openvpn-gui, or it will start just for the current user.

  3. Now openvpn-gui 11 is out and it requires changes to incorporate with new openvpnserviceinteractive service, now the client must run as admin in order to make functions like push route work, what change should I make in order to make it work? Thank you.

  4. can i install or embed browser certificate file programatically like with nsis installer of openvpn. bcz clients don’t like to do this manual steps is there any way please help. thanx

  5. After connect openvpn i want to hide the disconnect and exit option from openvpn gui options please help me how to do it. thanx

    1. Menu items are controlled by registry settings at HKEY_LOCAL_MACHINE\SOFTWARE\OpenVPN-GUI. That is where I would take a look.

  6. How to connect openvpn directly to proxy server like squid?? is there any configuration if yes then please give me a sample configuration for it. thanx.

  7. I have transparent squid proxy with –enable-ssl manual compiled and installed self signed certificate for https connection. but it give me certificate untrusted error on client side when i connect with openvpn client can you please help me how to get rid of this problem i will be many many thankfull to you thanx.

    1. You will need to import your CA certificate on your client as a trusted authority in order to prevent the certificate errors. Hope that helps.

  8. It seems there’s a dead link in this article – the link for “Customized OpenVPN Installer Source and NSIS build scripts available (Vista +)” leads to a page that gives a 403 error.

    1. In my case, having a shortcut is irrelevant as it installs the GUI client in the tray which is all I need. You can certainly add shortcuts to your deployment in the NSIS script using the CreateShortCut command.

  9. Very useful manual, but I fiound a “small” bug.
    x64 version work fine, but x86 version doesn’t work.
    I had to relpace driver’s files (driver\x86) and devcon.exe (bin\x86).

    Thanks a lot.

    1. Thanks for the comment Andrew. Can I ask what version of Windows you are testing on? The files attached were tested on Windows 7.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.