summaryrefslogtreecommitdiffstats
path: root/install-win32
diff options
context:
space:
mode:
authorjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2005-09-26 05:28:27 +0000
committerjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2005-09-26 05:28:27 +0000
commit6fbf66fad3367b24fd6743bcd50254902fd9c8d5 (patch)
tree9802876e3771744eead18917bb47ff6e90ac39f5 /install-win32
downloadopenvpn-6fbf66fad3367b24fd6743bcd50254902fd9c8d5.tar.gz
openvpn-6fbf66fad3367b24fd6743bcd50254902fd9c8d5.tar.xz
openvpn-6fbf66fad3367b24fd6743bcd50254902fd9c8d5.zip
This is the start of the BETA21 branch.
It includes the --topology feature, and TAP-Win32 driver changes to allow non-admin access. git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@580 e7ae566f-a301-0410-adde-c780ea21d3b5
Diffstat (limited to 'install-win32')
-rwxr-xr-xinstall-win32/buildopensslpath.bat3
-rwxr-xr-xinstall-win32/openssl.bat5
-rwxr-xr-xinstall-win32/openvpn.nsi.in570
-rwxr-xr-xinstall-win32/prebuild145
-rwxr-xr-xinstall-win32/sample.ovpn103
-rwxr-xr-xinstall-win32/setpath.nsi231
-rwxr-xr-xinstall-win32/u2d.c20
7 files changed, 1077 insertions, 0 deletions
diff --git a/install-win32/buildopensslpath.bat b/install-win32/buildopensslpath.bat
new file mode 100755
index 0000000..b77ce12
--- /dev/null
+++ b/install-win32/buildopensslpath.bat
@@ -0,0 +1,3 @@
+REM set path for OpenSSL build
+
+set PATH=c:\bin;C:\Perl\bin\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;c:\MinGW\bin;c:\msys\1.0\bin
diff --git a/install-win32/openssl.bat b/install-win32/openssl.bat
new file mode 100755
index 0000000..c3492e0
--- /dev/null
+++ b/install-win32/openssl.bat
@@ -0,0 +1,5 @@
+REM Build openssl.exe with DLL linkage to OpenSSL library
+REM Run this script from top level of OpenSSL source tree
+REM eg.: cp /y/openvpn/20/openvpn/install-win32/openssl.bat .
+
+gcc -o openssl tmp\verify.o tmp\asn1pars.o tmp\req.o tmp\dgst.o tmp\dh.o tmp\dhparam.o tmp\enc.o tmp\passwd.o tmp\gendh.o tmp\errstr.o tmp\ca.o tmp\pkcs7.o tmp\crl2p7.o tmp\crl.o tmp\rsa.o tmp\rsautl.o tmp\dsa.o tmp\dsaparam.o tmp\x509.o tmp\genrsa.o tmp\gendsa.o tmp\s_server.o tmp\s_client.o tmp\speed.o tmp\s_time.o tmp\apps.o tmp\s_cb.o tmp\s_socket.o tmp\app_rand.o tmp\version.o tmp\sess_id.o tmp\ciphers.o tmp\nseq.o tmp\pkcs12.o tmp\pkcs8.o tmp\spkac.o tmp\smime.o tmp\rand.o tmp\engine.o tmp\ocsp.o tmp\prime.o tmp\openssl.o -leay32 -lssl32 -L. -lwsock32 -lgdi32
diff --git a/install-win32/openvpn.nsi.in b/install-win32/openvpn.nsi.in
new file mode 100755
index 0000000..076479b
--- /dev/null
+++ b/install-win32/openvpn.nsi.in
@@ -0,0 +1,570 @@
+; ****************************************************************************
+; * Copyright (C) 2002-2005 OpenVPN Solutions LLC *
+; * This program is free software; you can redistribute it and/or modify *
+; * it under the terms of the GNU General Public License version 2 *
+; * as published by the Free Software Foundation. *
+; ****************************************************************************
+
+; OpenVPN install script for Windows, using NSIS
+
+!include "MUI.nsh"
+!include "setpath.nsi"
+
+!define HOME "c:\src\openvpn"
+!define BIN "${HOME}\bin"
+
+!define PRODUCT_NAME "OpenVPN"
+!define VERSION "@VERSION@" # AUTO_VERSION
+
+!define TAP "tap0801"
+!define TAPDRV "${TAP}.sys"
+
+; something like "-DBG2"
+!define OUTFILE_LABEL ""
+
+; something like "DEBUG2"
+!define TITLE_LABEL ""
+
+; Default service settings
+!define SERV_CONFIG_DIR "$INSTDIR\config"
+!define SERV_CONFIG_EXT "ovpn"
+!define SERV_EXE_PATH "$INSTDIR\bin\openvpn.exe"
+!define SERV_LOG_DIR "$INSTDIR\log"
+!define SERV_PRIORITY "NORMAL_PRIORITY_CLASS"
+!define SERV_LOG_APPEND "0"
+
+;--------------------------------
+;Configuration
+
+ ;General
+
+ OutFile "openvpn-${VERSION}${OUTFILE_LABEL}-install.exe"
+
+ SetCompressor bzip2
+
+ ShowInstDetails show
+ ShowUninstDetails show
+
+ ;Folder selection page
+ InstallDir "$PROGRAMFILES\${PRODUCT_NAME}"
+
+ ;Remember install folder
+ InstallDirRegKey HKCU "Software\${PRODUCT_NAME}" ""
+
+;--------------------------------
+;Modern UI Configuration
+
+ Name "${PRODUCT_NAME} ${VERSION} ${TITLE_LABEL}"
+
+ !define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of OpenVPN, an Open Source VPN package by James Yonan.\r\n\r\nNote that the Windows version of OpenVPN will only run on Win 2000, XP, or higher.\r\n\r\n\r\n"
+
+ !define MUI_COMPONENTSPAGE_TEXT_TOP "Select the components to install/upgrade. Stop any OpenVPN processes or the OpenVPN service if it is running. All DLLs are installed locally."
+
+ !define MUI_COMPONENTSPAGE_SMALLDESC
+ !define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\INSTALL-win32.txt"
+ !define MUI_FINISHPAGE_NOAUTOCLOSE
+ !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
+ !define MUI_ABORTWARNING
+ !define MUI_ICON "${HOME}\install-win32\openvpn.ico"
+ !define MUI_UNICON "${HOME}\install-win32\openvpn.ico"
+ !define MUI_HEADERIMAGE
+ !define MUI_HEADERIMAGE_BITMAP "${HOME}\install-win32\install-whirl.bmp"
+ !define MUI_UNFINISHPAGE_NOAUTOCLOSE
+
+ !insertmacro MUI_PAGE_WELCOME
+ !insertmacro MUI_PAGE_LICENSE "${HOME}\install-win32\license.txt"
+ !insertmacro MUI_PAGE_COMPONENTS
+ !insertmacro MUI_PAGE_DIRECTORY
+ !insertmacro MUI_PAGE_INSTFILES
+ !insertmacro MUI_PAGE_FINISH
+
+ !insertmacro MUI_UNPAGE_CONFIRM
+ !insertmacro MUI_UNPAGE_INSTFILES
+ !insertmacro MUI_UNPAGE_FINISH
+
+
+;--------------------------------
+;Languages
+
+ !insertmacro MUI_LANGUAGE "English"
+
+;--------------------------------
+;Language Strings
+
+ LangString DESC_SecOpenVPNUserSpace ${LANG_ENGLISH} "Install OpenVPN user-space components, including openvpn.exe."
+
+ LangString DESC_SecOpenVPNEasyRSA ${LANG_ENGLISH} "Install OpenVPN RSA scripts for X509 certificate management."
+
+ LangString DESC_SecOpenSSLDLLs ${LANG_ENGLISH} "Install OpenSSL DLLs locally (may be omitted if DLLs are already installed globally)."
+
+ LangString DESC_SecTAP ${LANG_ENGLISH} "Install/Upgrade the TAP-Win32 virtual device driver. Will not interfere with CIPE."
+
+ LangString DESC_SecService ${LANG_ENGLISH} "Install the OpenVPN service wrapper (openvpnserv.exe)"
+
+ LangString DESC_SecOpenSSLUtilities ${LANG_ENGLISH} "Install the OpenSSL Utilities (used for generating public/private key pairs)."
+
+ LangString DESC_SecAddPath ${LANG_ENGLISH} "Add OpenVPN executable directory to the current user's PATH."
+
+ LangString DESC_SecAddShortcuts ${LANG_ENGLISH} "Add OpenVPN shortcuts to the current user's Start Menu."
+
+ LangString DESC_SecFileAssociation ${LANG_ENGLISH} "Register OpenVPN config file association (*.${SERV_CONFIG_EXT})"
+
+;--------------------------------
+;Reserve Files
+
+ ;Things that need to be extracted on first (keep these lines before any File command!)
+ ;Only useful for BZIP2 compression
+
+ ReserveFile "${HOME}\install-win32\install-whirl.bmp"
+
+;--------------------------------
+;Macros
+
+!macro WriteRegStringIfUndef ROOT SUBKEY KEY VALUE
+Push $R0
+ReadRegStr $R0 "${ROOT}" "${SUBKEY}" "${KEY}"
+StrCmp $R0 "" +1 +2
+WriteRegStr "${ROOT}" "${SUBKEY}" "${KEY}" '${VALUE}'
+Pop $R0
+!macroend
+
+!macro DelRegStringIfUnchanged ROOT SUBKEY KEY VALUE
+Push $R0
+ReadRegStr $R0 "${ROOT}" "${SUBKEY}" "${KEY}"
+StrCmp $R0 '${VALUE}' +1 +2
+DeleteRegValue "${ROOT}" "${SUBKEY}" "${KEY}"
+Pop $R0
+!macroend
+
+!macro DelRegKeyIfUnchanged ROOT SUBKEY VALUE
+Push $R0
+ReadRegStr $R0 "${ROOT}" "${SUBKEY}" ""
+StrCmp $R0 '${VALUE}' +1 +2
+DeleteRegKey "${ROOT}" "${SUBKEY}"
+Pop $R0
+!macroend
+
+!macro DelRegKeyIfEmpty ROOT SUBKEY
+Push $R0
+EnumRegValue $R0 "${ROOT}" "${SUBKEY}" 1
+StrCmp $R0 "" +1 +2
+DeleteRegKey /ifempty "${ROOT}" "${SUBKEY}"
+Pop $R0
+!macroend
+
+;------------------------------------------
+;Set reboot flag based on tapinstall return
+
+Function CheckReboot
+ IntCmp $R0 1 "" noreboot noreboot
+ IntOp $R0 0 & 0
+ SetRebootFlag true
+ DetailPrint "REBOOT flag set"
+ noreboot:
+FunctionEnd
+
+;--------------------------------
+;Installer Sections
+
+Function .onInit
+ ClearErrors
+ UserInfo::GetName
+ IfErrors ok
+ Pop $R0
+ UserInfo::GetAccountType
+ Pop $R1
+ StrCmp $R1 "Admin" ok
+ Messagebox MB_OK "Administrator privileges required to install OpenVPN [$R0/$R1]"
+ Abort
+ ok:
+FunctionEnd
+
+!define SF_SELECTED 1
+
+Section "OpenVPN User-Space Components" SecOpenVPNUserSpace
+
+ SetOverwrite on
+ SetOutPath "$INSTDIR\bin"
+
+ File "${HOME}\openvpn.exe"
+
+SectionEnd
+
+Section "OpenVPN RSA Certificate Management Scripts" SecOpenVPNEasyRSA
+
+ SetOverwrite on
+ SetOutPath "$INSTDIR\easy-rsa"
+
+ File "${HOME}\install-win32\openssl.cnf.sample"
+ File "${HOME}\easy-rsa\Windows\vars.bat.sample"
+
+ File "${HOME}\easy-rsa\Windows\init-config.bat"
+
+ File "${HOME}\easy-rsa\Windows\README.txt"
+ File "${HOME}\easy-rsa\Windows\build-ca.bat"
+ File "${HOME}\easy-rsa\Windows\build-dh.bat"
+ File "${HOME}\easy-rsa\Windows\build-key-server.bat"
+ File "${HOME}\easy-rsa\Windows\build-key.bat"
+ File "${HOME}\easy-rsa\Windows\build-key-pkcs12.bat"
+ File "${HOME}\easy-rsa\Windows\clean-all.bat"
+ File "${HOME}\easy-rsa\Windows\index.txt.start"
+ File "${HOME}\easy-rsa\Windows\revoke-full.bat"
+ File "${HOME}\easy-rsa\Windows\serial.start"
+
+SectionEnd
+
+Section "OpenVPN Service" SecService
+
+ SetOverwrite on
+
+ SetOutPath "$INSTDIR\bin"
+ File "${HOME}\service-win32\openvpnserv.exe"
+
+ SetOutPath "$INSTDIR\config"
+
+ FileOpen $R0 "$INSTDIR\config\README.txt" w
+ FileWrite $R0 "This directory should contain OpenVPN configuration files$\r$\n"
+ FileWrite $R0 "each having an extension of .${SERV_CONFIG_EXT}$\r$\n"
+ FileWrite $R0 "$\r$\n"
+ FileWrite $R0 "When OpenVPN is started as a service, a separate OpenVPN$\r$\n"
+ FileWrite $R0 "process will be instantiated for each configuration file.$\r$\n"
+ FileClose $R0
+
+ SetOutPath "$INSTDIR\sample-config"
+ File "${HOME}\install-win32\sample.${SERV_CONFIG_EXT}"
+ File "${HOME}\install-win32\client.${SERV_CONFIG_EXT}"
+ File "${HOME}\install-win32\server.${SERV_CONFIG_EXT}"
+
+ CreateDirectory "$INSTDIR\log"
+ FileOpen $R0 "$INSTDIR\log\README.txt" w
+ FileWrite $R0 "This directory will contain the log files for OpenVPN$\r$\n"
+ FileWrite $R0 "sessions which are being run as a service.$\r$\n"
+ FileClose $R0
+
+SectionEnd
+
+Section "OpenVPN File Associations" SecFileAssociation
+SectionEnd
+
+Section "OpenSSL DLLs" SecOpenSSLDLLs
+
+ SetOverwrite on
+ SetOutPath "$INSTDIR\bin"
+ File "${BIN}\libeay32.dll"
+ File "${BIN}\libssl32.dll"
+
+SectionEnd
+
+Section "OpenSSL Utilities" SecOpenSSLUtilities
+
+ SetOverwrite on
+ SetOutPath "$INSTDIR\bin"
+ File "${BIN}\openssl.exe"
+
+SectionEnd
+
+Section "TAP-Win32 Virtual Ethernet Adapter" SecTAP
+
+ SetOverwrite on
+ SetOutPath "$INSTDIR\bin"
+ File "${BIN}\ti3790\tapinstall.exe"
+
+ FileOpen $R0 "$INSTDIR\bin\addtap.bat" w
+ FileWrite $R0 "rem Add a new TAP-Win32 virtual ethernet adapter$\r$\n"
+ FileWrite $R0 '"$INSTDIR\bin\tapinstall.exe" install "$INSTDIR\driver\OemWin2k.inf" ${TAP}$\r$\n'
+ FileWrite $R0 "pause$\r$\n"
+ FileClose $R0
+
+ FileOpen $R0 "$INSTDIR\bin\deltapall.bat" w
+ FileWrite $R0 "echo WARNING: this script will delete ALL TAP-Win32 virtual adapters (use the device manager to delete adapters one at a time)$\r$\n"
+ FileWrite $R0 "pause$\r$\n"
+ FileWrite $R0 '"$INSTDIR\bin\tapinstall.exe" remove ${TAP}$\r$\n'
+ FileWrite $R0 "pause$\r$\n"
+ FileClose $R0
+
+ SetOutPath "$INSTDIR\driver"
+ File "${HOME}\tap-win32\i386\OemWin2k.inf"
+ File "${HOME}\tap-win32\i386\${TAPDRV}"
+
+SectionEnd
+
+Section "Add OpenVPN to PATH" SecAddPath
+
+ ; remove previously set path (if any)
+ Push "$INSTDIR\bin"
+ Call RemoveFromPath
+
+ ; append our bin directory to end of current user path
+ Push "$INSTDIR\bin"
+ Call AddToPath
+
+SectionEnd
+
+Section "Add Shortcuts to Start Menu" SecAddShortcuts
+
+ SetOverwrite on
+ CreateDirectory "$SMPROGRAMS\OpenVPN"
+ WriteINIStr "$SMPROGRAMS\OpenVPN\OpenVPN Windows Notes.url" "InternetShortcut" "URL" "http://openvpn.net/INSTALL-win32.html"
+ WriteINIStr "$SMPROGRAMS\OpenVPN\OpenVPN Manual Page.url" "InternetShortcut" "URL" "http://openvpn.net/man.html"
+ WriteINIStr "$SMPROGRAMS\OpenVPN\OpenVPN HOWTO.url" "InternetShortcut" "URL" "http://openvpn.net/howto.html"
+ WriteINIStr "$SMPROGRAMS\OpenVPN\OpenVPN Web Site.url" "InternetShortcut" "URL" "http://openvpn.net/"
+ CreateShortCut "$SMPROGRAMS\OpenVPN\Uninstall OpenVPN.lnk" "$INSTDIR\Uninstall.exe"
+
+SectionEnd
+
+;--------------------
+;Post-install section
+
+Section -post
+
+ ; delete old devcon.exe
+ Delete "$INSTDIR\bin\devcon.exe"
+
+ ;
+ ; install/upgrade TAP-Win32 driver if selected, using tapinstall.exe
+ ;
+ SectionGetFlags ${SecTAP} $R0
+ IntOp $R0 $R0 & ${SF_SELECTED}
+ IntCmp $R0 ${SF_SELECTED} "" notap notap
+ ; TAP install/update was selected.
+ ; Should we install or update?
+ ; If tapinstall error occurred, $5 will
+ ; be nonzero.
+ IntOp $5 0 & 0
+ nsExec::ExecToStack '"$INSTDIR\bin\tapinstall.exe" hwids ${TAP}'
+ Pop $R0 # return value/error/timeout
+ IntOp $5 $5 | $R0
+ DetailPrint "tapinstall hwids returned: $R0"
+
+ ; If tapinstall output string contains "${TAP}" we assume
+ ; that TAP device has been previously installed,
+ ; therefore we will update, not install.
+ Push "${TAP}"
+ Call StrStr
+ Pop $R0
+
+ IntCmp $5 0 "" tapinstall_check_error tapinstall_check_error
+ IntCmp $R0 -1 tapinstall
+
+ ;tapupdate:
+ DetailPrint "TAP-Win32 UPDATE"
+ nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" update "$INSTDIR\driver\OemWin2k.inf" ${TAP}'
+ Pop $R0 # return value/error/timeout
+ Call CheckReboot
+ IntOp $5 $5 | $R0
+ DetailPrint "tapinstall update returned: $R0"
+ Goto tapinstall_check_error
+
+ tapinstall:
+ DetailPrint "TAP-Win32 REMOVE OLD TAP"
+ nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" remove TAP'
+ Pop $R0 # return value/error/timeout
+ DetailPrint "tapinstall remove TAP returned: $R0"
+ nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" remove TAPDEV'
+ Pop $R0 # return value/error/timeout
+ DetailPrint "tapinstall remove TAPDEV returned: $R0"
+
+ DetailPrint "TAP-Win32 INSTALL (${TAP})"
+ nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" install "$INSTDIR\driver\OemWin2k.inf" ${TAP}'
+ Pop $R0 # return value/error/timeout
+ Call CheckReboot
+ IntOp $5 $5 | $R0
+ DetailPrint "tapinstall install returned: $R0"
+
+ tapinstall_check_error:
+ DetailPrint "tapinstall cumulative status: $5"
+ IntCmp $5 0 notap
+ MessageBox MB_OK "An error occurred installing the TAP-Win32 device driver."
+
+ notap:
+
+ ; Store install folder in registry
+ WriteRegStr HKLM SOFTWARE\OpenVPN "" $INSTDIR
+
+ ; install as a service if requested
+ SectionGetFlags ${SecService} $R0
+ IntOp $R0 $R0 & ${SF_SELECTED}
+ IntCmp $R0 ${SF_SELECTED} "" noserv noserv
+
+ ; set registry parameters for openvpnserv
+ !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\OpenVPN" "config_dir" "${SERV_CONFIG_DIR}"
+ !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\OpenVPN" "config_ext" "${SERV_CONFIG_EXT}"
+ !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\OpenVPN" "exe_path" "${SERV_EXE_PATH}"
+ !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\OpenVPN" "log_dir" "${SERV_LOG_DIR}"
+ !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\OpenVPN" "priority" "${SERV_PRIORITY}"
+ !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\OpenVPN" "log_append" "${SERV_LOG_APPEND}"
+
+ ; install openvpnserv as a service
+ DetailPrint "Previous Service REMOVE (if exists)"
+ nsExec::ExecToLog '"$INSTDIR\bin\openvpnserv.exe" -remove'
+ Pop $R0 # return value/error/timeout
+ DetailPrint "Service INSTALL"
+ nsExec::ExecToLog '"$INSTDIR\bin\openvpnserv.exe" -install'
+ Pop $R0 # return value/error/timeout
+
+ noserv:
+ ; Store README, license, icon
+ SetOverwrite on
+ SetOutPath $INSTDIR
+ File "${HOME}\install-win32\INSTALL-win32.txt"
+ File "${HOME}\install-win32\license.txt"
+ File "${HOME}\install-win32\openvpn.ico"
+
+ ; Create file association if requested
+ SectionGetFlags ${SecFileAssociation} $R0
+ IntOp $R0 $R0 & ${SF_SELECTED}
+ IntCmp $R0 ${SF_SELECTED} "" noass noass
+ !insertmacro WriteRegStringIfUndef HKCR ".${SERV_CONFIG_EXT}" "" "OpenVPNFile"
+ !insertmacro WriteRegStringIfUndef HKCR "OpenVPNFile" "" "OpenVPN Config File"
+ !insertmacro WriteRegStringIfUndef HKCR "OpenVPNFile\shell" "" "open"
+ !insertmacro WriteRegStringIfUndef HKCR "OpenVPNFile\DefaultIcon" "" "$INSTDIR\openvpn.ico,0"
+ !insertmacro WriteRegStringIfUndef HKCR "OpenVPNFile\shell\open\command" "" 'notepad.exe "%1"'
+ !insertmacro WriteRegStringIfUndef HKCR "OpenVPNFile\shell\run" "" "Start OpenVPN on this config file"
+ !insertmacro WriteRegStringIfUndef HKCR "OpenVPNFile\shell\run\command" "" '"$INSTDIR\bin\openvpn.exe" --pause-exit --config "%1"'
+
+ ; Create start menu shortcuts to addtap.bat and deltapall.bat
+ noass:
+ IfFileExists "$INSTDIR\bin\addtap.bat" "" trydeltap
+ CreateShortCut "$SMPROGRAMS\OpenVPN\Add a new TAP-Win32 virtual ethernet adapter.lnk" "$INSTDIR\bin\addtap.bat" ""
+
+ trydeltap:
+ IfFileExists "$INSTDIR\bin\deltapall.bat" "" config_shortcut
+ CreateShortCut "$SMPROGRAMS\OpenVPN\Delete ALL TAP-Win32 virtual ethernet adapters.lnk" "$INSTDIR\bin\deltapall.bat" ""
+
+ ; Create start menu shortcuts for config and log directories
+ config_shortcut:
+ IfFileExists "$INSTDIR\config" "" log_shortcut
+ CreateShortCut "$SMPROGRAMS\OpenVPN\OpenVPN configuration file directory.lnk" "$INSTDIR\config" ""
+
+ log_shortcut:
+ IfFileExists "$INSTDIR\log" "" samp_shortcut
+ CreateShortCut "$SMPROGRAMS\OpenVPN\OpenVPN log file directory.lnk" "$INSTDIR\log" ""
+
+ samp_shortcut:
+ IfFileExists "$INSTDIR\sample-config" "" genkey_shortcut
+ CreateShortCut "$SMPROGRAMS\OpenVPN\OpenVPN Sample Configuration Files.lnk" "$INSTDIR\sample-config" ""
+
+ genkey_shortcut:
+ IfFileExists "$INSTDIR\bin\openvpn.exe" "" noshortcuts
+ IfFileExists "$INSTDIR\config" "" noshortcuts
+ CreateShortCut "$SMPROGRAMS\OpenVPN\Generate a static OpenVPN key.lnk" "$INSTDIR\bin\openvpn.exe" '--pause-exit --verb 3 --genkey --secret "$INSTDIR\config\key.txt"' "$INSTDIR\openvpn.ico" 0
+
+ noshortcuts:
+ ; Create uninstaller
+ WriteUninstaller "$INSTDIR\Uninstall.exe"
+
+ ; Show up in Add/Remove programs
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayName" "${PRODUCT_NAME} ${VERSION}"
+ WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "UninstallString" "$INSTDIR\Uninstall.exe"
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayIcon" "$INSTDIR\openvpn.ico"
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayVersion" "${VERSION}"
+
+ ; Advise a reboot
+ ;Messagebox MB_OK "IMPORTANT: Rebooting the system is advised in order to finalize TAP-Win32 driver installation/upgrade (this is an informational message only, pressing OK will not reboot)."
+
+SectionEnd
+
+;--------------------------------
+;Descriptions
+
+!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenVPNUserSpace} $(DESC_SecOpenVPNUserSpace)
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenVPNEasyRSA} $(DESC_SecOpenVPNEasyRSA)
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecTAP} $(DESC_SecTAP)
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenSSLUtilities} $(DESC_SecOpenSSLUtilities)
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenSSLDLLs} $(DESC_SecOpenSSLDLLs)
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecAddPath} $(DESC_SecAddPath)
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecAddShortcuts} $(DESC_SecAddShortcuts)
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecService} $(DESC_SecService)
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecFileAssociation} $(DESC_SecFileAssociation)
+!insertmacro MUI_FUNCTION_DESCRIPTION_END
+
+;--------------------------------
+;Uninstaller Section
+
+Function un.onInit
+ ClearErrors
+ UserInfo::GetName
+ IfErrors ok
+ Pop $R0
+ UserInfo::GetAccountType
+ Pop $R1
+ StrCmp $R1 "Admin" ok
+ Messagebox MB_OK "Administrator privileges required to uninstall OpenVPN [$R0/$R1]"
+ Abort
+ ok:
+FunctionEnd
+
+Section "Uninstall"
+
+ DetailPrint "Service REMOVE"
+ nsExec::ExecToLog '"$INSTDIR\bin\openvpnserv.exe" -remove'
+ Pop $R0 # return value/error/timeout
+
+ Sleep 2000
+
+ DetailPrint "TAP-Win32 REMOVE"
+ nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" remove ${TAP}'
+ Pop $R0 # return value/error/timeout
+ DetailPrint "tapinstall remove returned: $R0"
+
+ Push "$INSTDIR\bin"
+ Call un.RemoveFromPath
+
+ RMDir /r $SMPROGRAMS\OpenVPN
+
+ Delete "$INSTDIR\bin\openvpn.exe"
+ Delete "$INSTDIR\bin\openvpnserv.exe"
+ Delete "$INSTDIR\bin\libeay32.dll"
+ Delete "$INSTDIR\bin\libssl32.dll"
+ Delete "$INSTDIR\bin\tapinstall.exe"
+ Delete "$INSTDIR\bin\addtap.bat"
+ Delete "$INSTDIR\bin\deltapall.bat"
+
+ Delete "$INSTDIR\config\README.txt"
+ Delete "$INSTDIR\config\sample.${SERV_CONFIG_EXT}.txt"
+
+ Delete "$INSTDIR\log\README.txt"
+
+ Delete "$INSTDIR\driver\OemWin2k.inf"
+ Delete "$INSTDIR\driver\${TAPDRV}"
+
+ Delete "$INSTDIR\bin\openssl.exe"
+
+ Delete "$INSTDIR\INSTALL-win32.txt"
+ Delete "$INSTDIR\openvpn.ico"
+ Delete "$INSTDIR\license.txt"
+ Delete "$INSTDIR\Uninstall.exe"
+
+ Delete "$INSTDIR\easy-rsa\openssl.cnf.sample"
+ Delete "$INSTDIR\easy-rsa\vars.bat.sample"
+ Delete "$INSTDIR\easy-rsa\init-config.bat"
+ Delete "$INSTDIR\easy-rsa\README.txt"
+ Delete "$INSTDIR\easy-rsa\build-ca.bat"
+ Delete "$INSTDIR\easy-rsa\build-dh.bat"
+ Delete "$INSTDIR\easy-rsa\build-key-server.bat"
+ Delete "$INSTDIR\easy-rsa\build-key.bat"
+ Delete "$INSTDIR\easy-rsa\build-key-pkcs12.bat"
+ Delete "$INSTDIR\easy-rsa\clean-all.bat"
+ Delete "$INSTDIR\easy-rsa\index.txt.start"
+ Delete "$INSTDIR\easy-rsa\revoke-key.bat"
+ Delete "$INSTDIR\easy-rsa\revoke-full.bat"
+ Delete "$INSTDIR\easy-rsa\serial.start"
+
+ Delete "$INSTDIR\sample-config\*.ovpn"
+
+ RMDir "$INSTDIR\bin"
+ RMDir "$INSTDIR\driver"
+ RMDir "$INSTDIR\easy-rsa"
+ RMDir "$INSTDIR\sample-config"
+ RMDir "$INSTDIR"
+
+ !insertmacro DelRegKeyIfUnchanged HKCR ".${SERV_CONFIG_EXT}" "OpenVPNFile"
+ DeleteRegKey HKCR "OpenVPNFile"
+ DeleteRegKey HKLM SOFTWARE\OpenVPN
+ DeleteRegKey HKCU "Software\${PRODUCT_NAME}"
+ DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenVPN"
+
+ ;Messagebox MB_OK "IMPORTANT: If you intend on reinstalling OpenVPN after this uninstall, and you are running Win2K, you are strongly urged to reboot before reinstalling (this is an informational message only, pressing OK will not reboot)."
+
+SectionEnd
diff --git a/install-win32/prebuild b/install-win32/prebuild
new file mode 100755
index 0000000..bd3e699
--- /dev/null
+++ b/install-win32/prebuild
@@ -0,0 +1,145 @@
+# Given a standard OpenVPN tarball tree,
+# build a Windows tree which is NSIS-ready.
+#
+# Requires:
+# MinGW
+# MSYS GNU shell environment
+# See other requirements below
+
+# Top level directory.
+H=/c/src
+
+# Output NSIS-ready tree here (will be deleted
+# if already exists).
+OUT=$H/openvpn-build
+
+# Source distribution is here. Can be the top
+# level directory of exploded tarball.
+IN=/y/openvpn/20/openvpn
+
+# Already built OpenSSL tree.
+SSL=$H/openssl-0.9.7g
+
+# Already built LZO tree.
+LZO=$H/lzo-1.08
+
+# Already built dmalloc tree.
+# Optional, but leave defined even if you are not using
+# dmalloc.
+DMALLOC=$H/dmalloc-5.4.2
+
+# TAP binaries should be here: tap0801.sys and tapinstall.exe
+# These must be built with MS DDK.
+TAPBIN=$H/tapbin
+
+# u2d.c should exist here.
+SCRIPTS=$IN/install-win32
+
+# Put service.[ch] here from MS Platform SDK.
+SVC_TEMPLATE=$H/svc-template
+
+# Misc files/directories which should be copied to OUT (optional)
+MISC=$H/add
+
+# Temporary directory
+TMP=/tmp
+
+# End of user-defined parameters.
+
+U2D=$TMP/u2d
+
+echo BUILD u2d
+gcc -O2 $SCRIPTS/u2d.c -o $U2D
+
+echo BUILD output dir from source
+rm -rf $OUT
+mkdir $OUT
+
+cp $IN/*.[ch] $OUT
+rm -f $OUT/config.h
+
+if [ $MISC ]; then
+ cp $MISC/*.* $OUT
+fi
+
+echo BUILD makefile
+
+sed "s#^OPENSSL = .*\$#OPENSSL = $SSL#" <$IN/makefile.w32 | \
+sed "s#^LZO = .*\$#LZO = $LZO#" | \
+sed "s#^DMALLOC = .*\$#DMALLOC = $DMALLOC#" >$OUT/Makefile
+
+echo BUILD bin
+
+mkdir $OUT/bin
+for f in libeay32.dll libssl32.dll openssl.exe ; do
+ cp $SSL/$f $OUT/bin
+ strip $OUT/bin/$f
+done
+
+echo BUILD install-win32
+
+mkdir $OUT/install-win32
+
+cp $IN/install-win32/openvpn.nsi $OUT/install-win32
+cp $IN/install-win32/setpath.nsi $OUT/install-win32
+cp $IN/images/install-whirl.bmp $OUT/install-win32
+cp $IN/images/openvpn.ico $OUT/install-win32
+cp $IN/INSTALL-win32.txt $OUT/install-win32
+cat $IN/COPYING $IN/COPYRIGHT.GPL | $U2D >$OUT/install-win32/license.txt
+
+$U2D <$IN/sample-config-files/client.conf >$OUT/install-win32/client.ovpn
+$U2D <$IN/sample-config-files/server.conf >$OUT/install-win32/server.ovpn
+cp $IN/install-win32/sample.ovpn $OUT/install-win32
+$U2D <$IN/easy-rsa/openssl.cnf >$OUT/install-win32/openssl.cnf.sample
+
+echo BUILD tap-win32
+
+mkdir $OUT/tap-win32
+cp $IN/tap-win32/*.[ch] $OUT/tap-win32
+cp $IN/tap-win32/*.rc $OUT/tap-win32
+cp $IN/tap-win32/MAKEFILE $OUT/tap-win32
+cp $IN/tap-win32/SOURCES $OUT/tap-win32
+
+mkdir $OUT/tap-win32/i386
+cp $IN/tap-win32/i386/OemWin2k.inf $OUT/tap-win32/i386
+cp $IN/tap-win32/i386/tap.cat $OUT/tap-win32/i386
+
+cp $TAPBIN/tap0801.sys $OUT/tap-win32/i386
+
+mkdir $OUT/bin/ti3790
+cp $TAPBIN/tapinstall.exe $OUT/bin/ti3790
+
+echo BUILD service-win32
+
+mkdir $OUT/service-win32
+cp $IN/service-win32/Makefile $OUT/service-win32
+cp $IN/service-win32/mkpatch $OUT/service-win32
+cp $IN/service-win32/openvpnserv.c $OUT/service-win32
+cp $IN/service-win32/service.patch $OUT/service-win32
+
+cp $SVC_TEMPLATE/service.[ch] $OUT/service-win32
+cp $OUT/service-win32/service.h $OUT/service-win32/service.h.orig
+cp $OUT/service-win32/service.c $OUT/service-win32/service.c.orig
+
+pushd $OUT/service-win32
+patch <service.patch
+popd
+
+echo BUILD easy-rsa
+cp -a $IN/easy-rsa $OUT
+
+echo BUILD sample-keys
+cp -a $IN/sample-keys $OUT
+
+echo COMPILE OpenVPN
+pushd $OUT
+make
+strip openvpn.exe
+popd
+
+echo COMPILE OpenVPN Service
+pushd $OUT/service-win32
+make clean
+make
+strip openvpnserv.exe
+popd
diff --git a/install-win32/sample.ovpn b/install-win32/sample.ovpn
new file mode 100755
index 0000000..5accd57
--- /dev/null
+++ b/install-win32/sample.ovpn
@@ -0,0 +1,103 @@
+# Edit this file, and save to a .ovpn extension
+# so that OpenVPN will activate it when run
+# as a service.
+
+# Change 'myremote' to be your remote host,
+# or comment out to enter a listening
+# server mode.
+remote myremote
+
+# Uncomment this line to use a different
+# port number than the default of 1194.
+; port 1194
+
+# Choose one of three protocols supported by
+# OpenVPN. If left commented out, defaults
+# to udp.
+; proto [tcp-server | tcp-client | udp]
+
+# You must specify one of two possible network
+# protocols, 'dev tap' or 'dev tun' to be used
+# on both sides of the connection. 'tap' creates
+# a VPN using the ethernet protocol while 'tun'
+# uses the IP protocol. You must use 'tap'
+# if you are ethernet bridging or want to route
+# broadcasts. 'tun' is somewhat more efficient
+# but requires configuration of client software
+# to not depend on broadcasts. Some platforms
+# such as Solaris, OpenBSD, and Mac OS X only
+# support 'tun' interfaces, so if you are
+# connecting to such a platform, you must also
+# use a 'tun' interface on the Windows side.
+
+# Enable 'dev tap' or 'dev tun' but not both!
+dev tap
+
+# This is a 'dev tap' ifconfig that creates
+# a virtual ethernet subnet.
+# 10.3.0.1 is the local VPN IP address
+# and 255.255.255.0 is the VPN subnet.
+# Only define this option for 'dev tap'.
+ifconfig 10.3.0.1 255.255.255.0
+
+# This is a 'dev tun' ifconfig that creates
+# a point-to-point IP link.
+# 10.3.0.1 is the local VPN IP address and
+# 10.3.0.2 is the remote VPN IP address.
+# Only define this option for 'dev tun'.
+# Make sure to include the "tun-mtu" option
+# on the remote machine, but swap the order
+# of the ifconfig addresses.
+;tun-mtu 1500
+;ifconfig 10.3.0.1 10.3.0.2
+
+# If you have fragmentation issues or misconfigured
+# routers in the path which block Path MTU discovery,
+# lower the TCP MSS and internally fragment non-TCP
+# protocols.
+;fragment 1300
+;mssfix
+
+# If you have set up more than one TAP-Win32 adapter
+# on your system, you must refer to it by name.
+;dev-node my-tap
+
+# You can generate a static OpenVPN key
+# by selecting the Generate Key option
+# in the start menu.
+#
+# You can also generate key.txt manually
+# with the following command:
+# openvpn --genkey --secret key.txt
+#
+# key must match on both ends of the connection,
+# so you should generate it on one machine and
+# copy it to the other over a secure medium.
+# Place key.txt in the same directory as this
+# config file.
+secret key.txt
+
+# Uncomment this section for a more reliable
+# detection when a system loses its connection.
+# For example, dial-ups or laptops that travel
+# to other locations.
+#
+# If this section is enabled and "myremote"
+# above is a dynamic DNS name (i.e. dyndns.org),
+# OpenVPN will dynamically "follow" the IP
+# address of "myremote" if it changes.
+; ping-restart 60
+; ping-timer-rem
+; persist-tun
+; persist-key
+; resolv-retry 86400
+
+# keep-alive ping
+ping 10
+
+# enable LZO compression
+comp-lzo
+
+# moderate verbosity
+verb 4
+mute 10
diff --git a/install-win32/setpath.nsi b/install-win32/setpath.nsi
new file mode 100755
index 0000000..a9626c3
--- /dev/null
+++ b/install-win32/setpath.nsi
@@ -0,0 +1,231 @@
+; Modify the user's PATH variable.
+;
+; Modified by JY to have both a RemoveFromPath
+; and an un.RemoveFromPath which are basically
+; copies of each other. Why does NSIS demand
+; this nonsense?
+;
+; Modified Feb 14, 2005 by Mathias Sundman:
+; Added code to remove the semicolon at the end of the path
+; when uninstalling.
+;
+; Added code to make sure we don't insert an extra semicolon
+; before our path if there already exist one at the end of
+; the original path.
+;
+; Removed duplicated "un. and install" functions and made
+; macros to duplicate the code instead.
+
+; example usage
+;
+;Section "Add to path"
+; Push $INSTDIR
+; Call AddToPath
+;SectionEnd
+;
+;# ...
+;
+;Section "uninstall"
+; # ...
+; Push $INSTDIR
+; Call un.RemoveFromPath
+; # ...
+;SectionEnd
+
+!verbose 3
+!include "WinMessages.NSH"
+!verbose 4
+
+;====================================================
+; AddToPath - Adds the given dir to the search path.
+; Input - head of the stack
+; Note - Win9x systems requires reboot
+;====================================================
+Function AddToPath
+ Exch $0
+ Push $1
+ Push $2
+
+ Call IsNT
+ Pop $1
+ StrCmp $1 1 AddToPath_NT
+ ; Not on NT
+ StrCpy $1 $WINDIR 2
+ FileOpen $1 "$1\autoexec.bat" a
+ FileSeek $1 0 END
+ GetFullPathName /SHORT $0 $0
+ FileWrite $1 "$\r$\nSET PATH=%PATH%;$0$\r$\n"
+ FileClose $1
+ Goto AddToPath_done
+
+ AddToPath_NT:
+ ReadRegStr $1 HKCU "Environment" "PATH"
+ StrCpy $2 $1 1 -1 # copy last char
+ StrCmp $2 ";" 0 +2 # if last char == ;
+ StrCpy $1 $1 -1 # remove last char
+
+ StrCmp $1 "" AddToPath_NTdoIt
+ StrCpy $0 "$1;$0"
+ Goto AddToPath_NTdoIt
+ AddToPath_NTdoIt:
+ WriteRegExpandStr HKCU "Environment" "PATH" $0
+ SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
+
+ AddToPath_done:
+ Pop $2
+ Pop $1
+ Pop $0
+FunctionEnd
+
+;====================================================
+; RemoveFromPath - Remove a given dir from the path
+; Input: head of the stack
+;====================================================
+!macro RemoveFromPath un
+Function ${un}RemoveFromPath
+ Exch $0
+ Push $1
+ Push $2
+ Push $3
+ Push $4
+ Push $5
+
+ Call ${un}IsNT
+ Pop $1
+ StrCmp $1 1 RemoveFromPath_NT
+ ; Not on NT
+ StrCpy $1 $WINDIR 2
+ FileOpen $1 "$1\autoexec.bat" r
+ GetTempFileName $4
+ FileOpen $2 $4 w
+ GetFullPathName /SHORT $0 $0
+ StrCpy $0 "SET PATH=%PATH%;$0"
+ SetRebootFlag true
+ Goto RemoveFromPath_dosLoop
+
+ RemoveFromPath_dosLoop:
+ FileRead $1 $3
+ StrCmp $3 "$0$\r$\n" RemoveFromPath_dosLoop
+ StrCmp $3 "$0$\n" RemoveFromPath_dosLoop
+ StrCmp $3 "$0" RemoveFromPath_dosLoop
+ StrCmp $3 "" RemoveFromPath_dosLoopEnd
+ FileWrite $2 $3
+ Goto RemoveFromPath_dosLoop
+
+ RemoveFromPath_dosLoopEnd:
+ FileClose $2
+ FileClose $1
+ StrCpy $1 $WINDIR 2
+ Delete "$1\autoexec.bat"
+ CopyFiles /SILENT $4 "$1\autoexec.bat"
+ Delete $4
+ Goto RemoveFromPath_done
+
+ RemoveFromPath_NT:
+ StrLen $2 $0
+ ReadRegStr $1 HKCU "Environment" "PATH"
+ Push $1
+ Push $0
+ Call ${un}StrStr ; Find $0 in $1
+ Pop $0 ; pos of our dir
+ IntCmp $0 -1 RemoveFromPath_done
+ ; else, it is in path
+ StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
+ IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
+ IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
+ StrLen $0 $1
+ StrCpy $1 $1 $0 $2
+ StrCpy $3 "$3$1"
+
+ StrCpy $5 $3 1 -1 # copy last char
+ StrCmp $5 ";" 0 +2 # if last char == ;
+ StrCpy $3 $3 -1 # remove last char
+
+ WriteRegExpandStr HKCU "Environment" "PATH" $3
+ SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
+
+ RemoveFromPath_done:
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Pop $0
+FunctionEnd
+!macroend
+!insertmacro RemoveFromPath ""
+!insertmacro RemoveFromPath "un."
+
+
+;====================================================
+; StrStr - Finds a given string in another given string.
+; Returns -1 if not found and the pos if found.
+; Input: head of the stack - string to find
+; second in the stack - string to find in
+; Output: head of the stack
+;====================================================
+!macro StrStr un
+Function ${un}StrStr
+ Push $0
+ Exch
+ Pop $0 ; $0 now have the string to find
+ Push $1
+ Exch 2
+ Pop $1 ; $1 now have the string to find in
+ Exch
+ Push $2
+ Push $3
+ Push $4
+ Push $5
+
+ StrCpy $2 -1
+ StrLen $3 $0
+ StrLen $4 $1
+ IntOp $4 $4 - $3
+
+ StrStr_loop:
+ IntOp $2 $2 + 1
+ IntCmp $2 $4 0 0 StrStrReturn_notFound
+ StrCpy $5 $1 $3 $2
+ StrCmp $5 $0 StrStr_done StrStr_loop
+
+ StrStrReturn_notFound:
+ StrCpy $2 -1
+
+ StrStr_done:
+ Pop $5
+ Pop $4
+ Pop $3
+ Exch $2
+ Exch 2
+ Pop $0
+ Pop $1
+FunctionEnd
+!macroend
+!insertmacro StrStr ""
+!insertmacro StrStr "un."
+
+;====================================================
+; IsNT - Returns 1 if the current system is NT, 0
+; otherwise.
+; Output: head of the stack
+;====================================================
+!macro IsNT un
+Function ${un}IsNT
+ Push $0
+ ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
+ StrCmp $0 "" 0 IsNT_yes
+ ; we are not NT.
+ Pop $0
+ Push 0
+ Return
+
+ IsNT_yes:
+ ; NT!!!
+ Pop $0
+ Push 1
+FunctionEnd
+!macroend
+!insertmacro IsNT ""
+!insertmacro IsNT "un."
+
diff --git a/install-win32/u2d.c b/install-win32/u2d.c
new file mode 100755
index 0000000..bf1f5e8
--- /dev/null
+++ b/install-win32/u2d.c
@@ -0,0 +1,20 @@
+#include <stdio.h>
+
+int
+main (int argc, char *argv[])
+{
+ int c;
+ int enable = 1;
+
+ while ((c = getchar()) != EOF)
+ {
+#if 0
+ if (c == '\r')
+ enable = 0;
+ if (enable && c == '\n')
+ putchar ('\r');
+#endif
+ putchar (c);
+ }
+ return 0;
+}