diff options
Diffstat (limited to 'install-win32')
30 files changed, 2735 insertions, 0 deletions
diff --git a/install-win32/GetWindowsVersion.nsi b/install-win32/GetWindowsVersion.nsi new file mode 100644 index 0000000..103caff --- /dev/null +++ b/install-win32/GetWindowsVersion.nsi @@ -0,0 +1,109 @@ +; Turn off old selected section +; GetWindowsVersion +; +; Based on Yazno's function +; Updated by Joost Verburg +; Updated for Windows 98 SE by Matthew Win Tibbals 5-21-03 +; Updated for Vista by Joe Cincotta 12-2-07 +; +; Returns on top of stack +; +; Windows Version (95, 98, ME, NT x.x, 2000, XP, 2003, VISTA) +; or +; '' (Unknown Windows Version) +; +; Usage: +; Call GetWindowsVersion +; Pop $R0 +; ; at this point $R0 is "NT 4.0" or whatnot +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +Function GetWindowsVersion + + Push $R0 + Push $R1 + + ClearErrors + + ReadRegStr $R0 HKLM \ + "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion + + IfErrors 0 lbl_winnt + + ; we are not NT + ReadRegStr $R0 HKLM \ + "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber + + StrCpy $R1 $R0 1 + StrCmp $R1 '4' 0 lbl_error + + StrCpy $R1 $R0 3 + + StrCmp $R1 '4.0' lbl_win32_95 + StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98 + + lbl_win32_95: + StrCpy $R0 '95' + Goto lbl_done + + lbl_win32_98: +;;beginning of additions to support win 98 SE + push $R0 + push "." + call strstr + pop $R0 + StrCpy $R0 $R0 "" 1 + StrCmp $R0 "10.2222" lbl_win32_98SE + StrCpy $R0 '98' ;;this line was not added + Goto lbl_done ;;this line was not added either + + lbl_win32_98SE: + StrCpy $R0 '98 SE' + Goto lbl_done +;;end of additions to support win 98 SE + lbl_win32_ME: + StrCpy $R0 'ME' + Goto lbl_done + + lbl_winnt: + + StrCpy $R1 $R0 1 + + StrCmp $R1 '3' lbl_winnt_x + StrCmp $R1 '4' lbl_winnt_x + + StrCpy $R1 $R0 3 + + StrCmp $R1 '5.0' lbl_winnt_2000 + StrCmp $R1 '5.1' lbl_winnt_XP + StrCmp $R1 '5.2' lbl_winnt_2003 + StrCmp $R1 '6.0' lbl_winnt_VISTA lbl_error + + lbl_winnt_x: + StrCpy $R0 "NT $R0" 6 + Goto lbl_done + + lbl_winnt_2000: + Strcpy $R0 '2000' + Goto lbl_done + + lbl_winnt_XP: + Strcpy $R0 'XP' + Goto lbl_done + + lbl_winnt_2003: + Strcpy $R0 '2003' + Goto lbl_done + + lbl_winnt_VISTA: + Strcpy $R0 'VISTA' + Goto lbl_done + + lbl_error: + Strcpy $R0 '' + lbl_done: + + Pop $R1 + Exch $R0 + +FunctionEnd +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/install-win32/Makefile.am b/install-win32/Makefile.am new file mode 100644 index 0000000..75932fe --- /dev/null +++ b/install-win32/Makefile.am @@ -0,0 +1,97 @@ +# +# OpenVPN -- An application to securely tunnel IP networks +# over a single UDP port, with support for SSL/TLS-based +# session authentication and key exchange, +# packet encryption, packet authentication, and +# packet compression. +# +# Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@openvpn.net> +# +# 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. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program (see the file COPYING included with this +# distribution); if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in + +dist_noinst_DATA = \ + openssl \ + GetWindowsVersion.nsi \ + build-pkcs11-helper.sh \ + buildinstaller \ + ddk-common \ + doclean \ + dosname.pl \ + getgui \ + getopenssl \ + getpkcs11helper \ + getprebuilt \ + getxgui \ + ifdef.pl \ + m4todef.pl \ + macro.pl \ + makeopenvpn \ + maketap \ + maketapinstall \ + maketext \ + openvpn.nsi \ + setpath.nsi \ + settings.in \ + trans.pl \ + u2d.c \ + winconfig + +if WIN32 + +nodist_doc_DATA = tmp/license.txt + +confdir = $(win32datadir)/config +nodist_conf_DATA = \ + tmp/openssl-1.0.0.cnf \ + tmp/client.ovpn \ + tmp/server.ovpn +dist_conf_DATA = \ + sample.ovpn + +easyrsadir = $(win32datadir)/easy-rsa/Windows +nodist_easyrsa_DATA = \ + $(top_srcdir)/easy-rsa/Windows/* + +keysdir = $(win32datadir)/sample-keys +nodist_keys_DATA = \ + $(top_srcdir)/sample-keys/* + +tmp: + mkdir tmp + +tmp/client.ovpn: tmp $(top_srcdir)/sample-config-files/client.conf + cp $(top_srcdir)/sample-config-files/client.conf tmp/client.ovpn + +tmp/server.ovpn: tmp $(top_srcdir)/sample-config-files/server.conf + cp $(top_srcdir)/sample-config-files/server.conf tmp/server.ovpn + +tmp/license.txt: tmp $(top_srcdir)/COPYING $(top_srcdir)/COPYRIGHT.GPL + cat $(top_srcdir)/COPYING $(top_srcdir)/COPYRIGHT.GPL > tmp/license.txt + +tmp/openssl-1.0.0.cnf: tmp $(top_srcdir)/easy-rsa/2.0/openssl-1.0.0.cnf + cp $(top_srcdir)/easy-rsa/2.0/openssl-1.0.0.cnf tmp/openssl-1.0.0.cnf + +clean-local: + -rm -fr tmp + +else + +dist_noinst_DATA += sample.ovpn + +endif + diff --git a/install-win32/Makefile.in b/install-win32/Makefile.in new file mode 100644 index 0000000..5f0387f --- /dev/null +++ b/install-win32/Makefile.in @@ -0,0 +1,553 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# +# OpenVPN -- An application to securely tunnel IP networks +# over a single UDP port, with support for SSL/TLS-based +# session authentication and key exchange, +# packet encryption, packet authentication, and +# packet compression. +# +# Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@openvpn.net> +# +# 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. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program (see the file COPYING included with this +# distribution); if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@WIN32_FALSE@am__append_1 = sample.ovpn +subdir = install-win32 +DIST_COMMON = $(am__dist_conf_DATA_DIST) $(am__dist_noinst_DATA_DIST) \ + $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/settings.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/version.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = settings +CONFIG_CLEAN_VPATH_FILES = +SOURCES = +DIST_SOURCES = +am__dist_conf_DATA_DIST = sample.ovpn +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(confdir)" "$(DESTDIR)$(confdir)" \ + "$(DESTDIR)$(docdir)" "$(DESTDIR)$(easyrsadir)" \ + "$(DESTDIR)$(keysdir)" +am__dist_noinst_DATA_DIST = openssl GetWindowsVersion.nsi \ + build-pkcs11-helper.sh buildinstaller ddk-common doclean \ + dosname.pl getgui getopenssl getpkcs11helper getprebuilt \ + getxgui ifdef.pl m4todef.pl macro.pl makeopenvpn maketap \ + maketapinstall maketext openvpn.nsi setpath.nsi settings.in \ + trans.pl u2d.c winconfig sample.ovpn +DATA = $(dist_conf_DATA) $(dist_noinst_DATA) $(nodist_conf_DATA) \ + $(nodist_doc_DATA) $(nodist_easyrsa_DATA) $(nodist_keys_DATA) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GREP = @GREP@ +IFCONFIG = @IFCONFIG@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +IPROUTE = @IPROUTE@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MAN2HTML = @MAN2HTML@ +MKDIR_P = @MKDIR_P@ +NETSTAT = @NETSTAT@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +ROUTE = @ROUTE@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +TAP_ID = @TAP_ID@ +TAP_WIN32_MIN_MAJOR = @TAP_WIN32_MIN_MAJOR@ +TAP_WIN32_MIN_MINOR = @TAP_WIN32_MIN_MINOR@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +win32datadir = @win32datadir@ +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in +dist_noinst_DATA = openssl GetWindowsVersion.nsi \ + build-pkcs11-helper.sh buildinstaller ddk-common doclean \ + dosname.pl getgui getopenssl getpkcs11helper getprebuilt \ + getxgui ifdef.pl m4todef.pl macro.pl makeopenvpn maketap \ + maketapinstall maketext openvpn.nsi setpath.nsi settings.in \ + trans.pl u2d.c winconfig $(am__append_1) +@WIN32_TRUE@nodist_doc_DATA = tmp/license.txt +@WIN32_TRUE@confdir = $(win32datadir)/config +@WIN32_TRUE@nodist_conf_DATA = \ +@WIN32_TRUE@ tmp/openssl-1.0.0.cnf \ +@WIN32_TRUE@ tmp/client.ovpn \ +@WIN32_TRUE@ tmp/server.ovpn + +@WIN32_TRUE@dist_conf_DATA = \ +@WIN32_TRUE@ sample.ovpn + +@WIN32_TRUE@easyrsadir = $(win32datadir)/easy-rsa/Windows +@WIN32_TRUE@nodist_easyrsa_DATA = \ +@WIN32_TRUE@ $(top_srcdir)/easy-rsa/Windows/* + +@WIN32_TRUE@keysdir = $(win32datadir)/sample-keys +@WIN32_TRUE@nodist_keys_DATA = \ +@WIN32_TRUE@ $(top_srcdir)/sample-keys/* + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu install-win32/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu install-win32/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +settings: $(top_builddir)/config.status $(srcdir)/settings.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +install-dist_confDATA: $(dist_conf_DATA) + @$(NORMAL_INSTALL) + test -z "$(confdir)" || $(MKDIR_P) "$(DESTDIR)$(confdir)" + @list='$(dist_conf_DATA)'; test -n "$(confdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(confdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(confdir)" || exit $$?; \ + done + +uninstall-dist_confDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_conf_DATA)'; test -n "$(confdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(confdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(confdir)" && rm -f $$files +install-nodist_confDATA: $(nodist_conf_DATA) + @$(NORMAL_INSTALL) + test -z "$(confdir)" || $(MKDIR_P) "$(DESTDIR)$(confdir)" + @list='$(nodist_conf_DATA)'; test -n "$(confdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(confdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(confdir)" || exit $$?; \ + done + +uninstall-nodist_confDATA: + @$(NORMAL_UNINSTALL) + @list='$(nodist_conf_DATA)'; test -n "$(confdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(confdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(confdir)" && rm -f $$files +install-nodist_docDATA: $(nodist_doc_DATA) + @$(NORMAL_INSTALL) + test -z "$(docdir)" || $(MKDIR_P) "$(DESTDIR)$(docdir)" + @list='$(nodist_doc_DATA)'; test -n "$(docdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(docdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(docdir)" || exit $$?; \ + done + +uninstall-nodist_docDATA: + @$(NORMAL_UNINSTALL) + @list='$(nodist_doc_DATA)'; test -n "$(docdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(docdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(docdir)" && rm -f $$files +install-nodist_easyrsaDATA: $(nodist_easyrsa_DATA) + @$(NORMAL_INSTALL) + test -z "$(easyrsadir)" || $(MKDIR_P) "$(DESTDIR)$(easyrsadir)" + @list='$(nodist_easyrsa_DATA)'; test -n "$(easyrsadir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(easyrsadir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(easyrsadir)" || exit $$?; \ + done + +uninstall-nodist_easyrsaDATA: + @$(NORMAL_UNINSTALL) + @list='$(nodist_easyrsa_DATA)'; test -n "$(easyrsadir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(easyrsadir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(easyrsadir)" && rm -f $$files +install-nodist_keysDATA: $(nodist_keys_DATA) + @$(NORMAL_INSTALL) + test -z "$(keysdir)" || $(MKDIR_P) "$(DESTDIR)$(keysdir)" + @list='$(nodist_keys_DATA)'; test -n "$(keysdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(keysdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(keysdir)" || exit $$?; \ + done + +uninstall-nodist_keysDATA: + @$(NORMAL_UNINSTALL) + @list='$(nodist_keys_DATA)'; test -n "$(keysdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(keysdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(keysdir)" && rm -f $$files +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(DATA) +installdirs: + for dir in "$(DESTDIR)$(confdir)" "$(DESTDIR)$(confdir)" "$(DESTDIR)$(docdir)" "$(DESTDIR)$(easyrsadir)" "$(DESTDIR)$(keysdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +@WIN32_FALSE@clean-local: +clean: clean-am + +clean-am: clean-generic clean-local mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-dist_confDATA install-nodist_confDATA \ + install-nodist_docDATA install-nodist_easyrsaDATA \ + install-nodist_keysDATA + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-dist_confDATA uninstall-nodist_confDATA \ + uninstall-nodist_docDATA uninstall-nodist_easyrsaDATA \ + uninstall-nodist_keysDATA + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-local \ + distclean distclean-generic distdir dvi dvi-am html html-am \ + info info-am install install-am install-data install-data-am \ + install-dist_confDATA install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-nodist_confDATA \ + install-nodist_docDATA install-nodist_easyrsaDATA \ + install-nodist_keysDATA install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \ + uninstall-am uninstall-dist_confDATA uninstall-nodist_confDATA \ + uninstall-nodist_docDATA uninstall-nodist_easyrsaDATA \ + uninstall-nodist_keysDATA + + +@WIN32_TRUE@tmp: +@WIN32_TRUE@ mkdir tmp + +@WIN32_TRUE@tmp/client.ovpn: tmp $(top_srcdir)/sample-config-files/client.conf +@WIN32_TRUE@ cp $(top_srcdir)/sample-config-files/client.conf tmp/client.ovpn + +@WIN32_TRUE@tmp/server.ovpn: tmp $(top_srcdir)/sample-config-files/server.conf +@WIN32_TRUE@ cp $(top_srcdir)/sample-config-files/server.conf tmp/server.ovpn + +@WIN32_TRUE@tmp/license.txt: tmp $(top_srcdir)/COPYING $(top_srcdir)/COPYRIGHT.GPL +@WIN32_TRUE@ cat $(top_srcdir)/COPYING $(top_srcdir)/COPYRIGHT.GPL > tmp/license.txt + +@WIN32_TRUE@tmp/openssl-1.0.0.cnf: tmp $(top_srcdir)/easy-rsa/2.0/openssl-1.0.0.cnf +@WIN32_TRUE@ cp $(top_srcdir)/easy-rsa/2.0/openssl-1.0.0.cnf tmp/openssl-1.0.0.cnf + +@WIN32_TRUE@clean-local: +@WIN32_TRUE@ -rm -fr tmp + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/install-win32/build-pkcs11-helper.sh b/install-win32/build-pkcs11-helper.sh new file mode 100644 index 0000000..fd336df --- /dev/null +++ b/install-win32/build-pkcs11-helper.sh @@ -0,0 +1,24 @@ +F=pkcs11-helper-1.06-beta1 +OPENSSL_DIR=`pwd`/openssl-0.9.8h + +PKCS11_HELPER_DIR=`pwd`/pkcs11-helper +rm -rf $PKCS11_HELPER_DIR +mkdir $PKCS11_HELPER_DIR +tbz=$F.tar.bz2 + +rm -rf $F +tar xfj $tbz + +cd $F +./configure \ + MAN2HTML=true \ + --disable-crypto-engine-gnutls \ + --disable-crypto-engine-nss \ + PKG_CONFIG=true \ + OPENSSL_CFLAGS="-I${OPENSSL_DIR}/include" \ + OPENSSL_LIBS="-L${OPENSSL_DIR}/out -leay32" + +make +make install DESTDIR="${PKCS11_HELPER_DIR}" + +# ./configure doesn't need this any more: ac_cv_type_size_t=no diff --git a/install-win32/buildinstaller b/install-win32/buildinstaller new file mode 100644 index 0000000..a17a027 --- /dev/null +++ b/install-win32/buildinstaller @@ -0,0 +1,14 @@ +#!/bin/sh + +# load version.nsi definitions +. autodefs/defs.sh + +# build the installer +rm -f $GENOUT/*.exe +'/c/Program Files/NSIS/makensis' $GENOUT/nsi/openvpn.nsi &>makensis.log +tail -20 makensis.log + +# sign the installer +if [ -d "$SIGNTOOL" ]; then + python $SIGNTOOL/signapp.py "$(echo $(pwd)/$GENOUT/*.exe)" +fi diff --git a/install-win32/ddk-common b/install-win32/ddk-common new file mode 100644 index 0000000..b45c9e5 --- /dev/null +++ b/install-win32/ddk-common @@ -0,0 +1,2 @@ +# DDKs <= 5600 use "AMD64", later use "x64" +x64_tag=x64 diff --git a/install-win32/doclean b/install-win32/doclean new file mode 100644 index 0000000..3f39543 --- /dev/null +++ b/install-win32/doclean @@ -0,0 +1,6 @@ +#!/bin/sh + +# get version.nsi definitions +. autodefs/defs.sh + +[ "$CLEAN" = "yes" ] && rm -rf $GENOUT && KEEPAUTODEFS="yes" ./doclean diff --git a/install-win32/dosname.pl b/install-win32/dosname.pl new file mode 100644 index 0000000..a678e66 --- /dev/null +++ b/install-win32/dosname.pl @@ -0,0 +1,9 @@ +#!/usr/bin/perl + +# convert a unix filename to a DOS filename + +while ($unixname = shift(@ARGV)) { + $unixname =~ s#^/([a-zA-Z])(/|$)#$1:\\#g; + $unixname =~ s#/#\\#g; + print "$unixname\n"; +} diff --git a/install-win32/getgui b/install-win32/getgui new file mode 100644 index 0000000..aa83e85 --- /dev/null +++ b/install-win32/getgui @@ -0,0 +1,19 @@ +#!/bin/sh + +# Get and sign the OpenVPN GUI + +# load version.nsi definitions +. autodefs/defs.sh + +GUI="$OPENVPN_GUI_DIR/$OPENVPN_GUI" + +if [ -f "$GUI" ]; then + mkdir -p $GENOUT/bin &>/dev/null + cp $GUI $GENOUT/bin +fi + +if [ -f "$GENOUT/bin/$OPENVPN_GUI" ]; then + echo '!define OPENVPN_GUI_DEFINED' >autodefs/guidefs.nsi +else + cat /dev/null >autodefs/guidefs.nsi +fi diff --git a/install-win32/getopenssl b/install-win32/getopenssl new file mode 100644 index 0000000..b772741 --- /dev/null +++ b/install-win32/getopenssl @@ -0,0 +1,19 @@ +#!/bin/sh + +# get version.nsi definitions +. autodefs/defs.sh + +# Get OpenSSL binaries +if [ -d "$OPENSSL_DIR" ] ; then + mkdir -p $GENOUT/lib &>/dev/null + mkdir -p $GENOUT/bin &>/dev/null + for f in libeay32.dll libssl32.dll out/openssl.exe ; do + cp $OPENSSL_DIR/$f $GENOUT/lib + if [ -z "$NO_STRIP" ]; then + strip $GENOUT/lib/`basename $f` + fi + done + mv $GENOUT/lib/openssl.exe $GENOUT/bin +else + echo OpenSSL DIR $OPENSSL_DIR NOT FOUND +fi diff --git a/install-win32/getpkcs11helper b/install-win32/getpkcs11helper new file mode 100644 index 0000000..8fcfdd4 --- /dev/null +++ b/install-win32/getpkcs11helper @@ -0,0 +1,17 @@ +#!/bin/sh + +# get version.nsi definitions +. autodefs/defs.sh + +# Get PKCS11-helper libraries +if [ -d "$PKCS11_HELPER_DIR" ] ; then + mkdir -p $GENOUT/lib &>/dev/null + for f in libpkcs11-helper-1.dll ; do + cp $PKCS11_HELPER_DIR/usr/local/bin/$f $GENOUT/lib + if [ -z "$NO_STRIP" ]; then + strip $GENOUT/lib/$f + fi + done +else + echo PKCS11-helper DIR $PKCS11_HELPER_DIR NOT FOUND +fi diff --git a/install-win32/getprebuilt b/install-win32/getprebuilt new file mode 100644 index 0000000..36c4827 --- /dev/null +++ b/install-win32/getprebuilt @@ -0,0 +1,10 @@ +#!/bin/sh + +# get version.nsi definitions +. autodefs/defs.sh + +# Get PKCS11-helper libraries +if [ -d "$GENOUT_PREBUILT" ] && ! [ -d "$GENOUT" ]; then + echo LOADING prebuilt binaries from $GENOUT_PREBUILT + cp -a $GENOUT_PREBUILT $GENOUT +fi diff --git a/install-win32/getxgui b/install-win32/getxgui new file mode 100644 index 0000000..3a1e626 --- /dev/null +++ b/install-win32/getxgui @@ -0,0 +1,28 @@ +#!/bin/sh + +# Get and sign the OpenVPN XML-based GUI + +# load version.nsi definitions +. autodefs/defs.sh + +if [ -d "$OPENVPN_XGUI_DIR" ]; then + SIGNED_EXES="gui/ovpn-xgui-en.exe sta/ovpn-tray.exe" + UNSIGNED_EXES="xmlserv/ovpn-xmlserv.exe" + EXES="$SIGNED_EXES $UNSIGNED_EXES" + + mkdir -p $GENOUT/bin &>/dev/null + + if [ -z "$NO_STRIP" ]; then + for f in $EXES; do + cp $OPENVPN_XGUI_DIR/$f $GENOUT/bin + strip $GENOUT/bin/`basename $f` + done + fi + + rm -rf $GENOUT/htdocs + cp -a $OPENVPN_XGUI_DIR/ajax/htdocs $GENOUT/htdocs + + echo '!define OPENVPN_XGUI_DEFINED' >autodefs/xguidefs.nsi +else + cat /dev/null >autodefs/xguidefs.nsi +fi diff --git a/install-win32/ifdef.pl b/install-win32/ifdef.pl new file mode 100644 index 0000000..d240ebb --- /dev/null +++ b/install-win32/ifdef.pl @@ -0,0 +1,53 @@ +#!/usr/bin/perl + +# Simple ifdef/else/endif processor. + +die "usage: ifdef [-C<command-prefix>] [-Dname ...] [control-file ...] " if (@ARGV[0] =~ /^(-h|--help)$/); + +%Parms = (); + +$pre = "!"; +while ($arg=shift(@ARGV)) { + if ($arg =~ /^-/) { + if ($arg =~ /^-D(\w+)$/) { + $Parms{$1} = 1; + } elsif ($arg =~ /-C(.*)$/) { + $pre = $1; + } else { + die "unrecognized option: $arg"; + } + } else { + open(CONTROL, "< $arg") or die "cannot open $arg"; + while (<CONTROL>) { + if (/^!define\s+(\w+)/) { + $Parms{$1} = 1; + } + } + } +} + +sub ifdef { + my ($var, $enabled) = @_; + my $def = 0; + $def = 1 if (defined $Parms{$var}) || ($var eq "true"); + $def = 0 if $var eq "false"; + while (<STDIN>) { + if (/^\s*\Q$pre\Eifdef\s+(\w+)\s*$/) { + return 1 if ifdef ($1, $def & $enabled); + } elsif (/^\s*\Q$pre\Eelseif\s+(\w+)\s*$/) { + $def = $def ^ 1; + return ifdef ($1, $def & $enabled); + } elsif (/^\s*\Q$pre\Eelse\s*$/) { + $def = $def ^ 1; + } elsif (/^\s*\Q$pre\Eendif\s*$/) { + return 0; + } elsif (/^\s*\Q$pre\E/) { + die "unrecognized command: $_"; + } else { + print if $def && $enabled; + } + } + return 1; +} + +ifdef("true", 1); diff --git a/install-win32/m4todef.pl b/install-win32/m4todef.pl new file mode 100644 index 0000000..d2705b0 --- /dev/null +++ b/install-win32/m4todef.pl @@ -0,0 +1,15 @@ +#!/usr/bin/perl + +# used to convert version.m4 to simple +# definition format + +while (<STDIN>) { + chomp; + if (/^\s*$/) { + print "\n"; + } elsif (/^define\((\w+),\[(.*?)\]\)/) { + print "!define $1 \"$2\"\n"; + } elsif (/^dnl(.*)$/) { + print "#$1\n"; + } +} diff --git a/install-win32/macro.pl b/install-win32/macro.pl new file mode 100644 index 0000000..08ba58a --- /dev/null +++ b/install-win32/macro.pl @@ -0,0 +1,61 @@ +#!/usr/bin/perl + +# Simple macro processor. + +# Macros are defined in a control file that follows +# a simple definition-based grammar as documented in the +# trans script. Stdin is then copied to stdout, and any +# occurrence of @@MACRO@@ is substituted. Macros can also +# be specified on the command line. + +die "usage: macro [-O<openquote>] [-C<closequote>] [-Dname=var ...] [control-file ...] " if (@ARGV < 1); + +%Parms = (); +$open_quote = "@@"; +$close_quote = "@@"; + +while ($arg=shift(@ARGV)) { + if ($arg =~ /^-/) { + if ($arg =~ /^-D(\w+)(?:=(.*))?$/) { + $Parms{$1} = $2 + } elsif ($arg =~ /-O(.*)$/) { + $open_quote = $1; + } elsif ($arg =~ /-C(.*)$/) { + $close_quote = $1; + } else { + die "unrecognized option: $arg"; + } + } else { + open(CONTROL, "< $arg") or die "cannot open $arg"; + while (<CONTROL>) { + if (/^!define\s+(\w+)(?:\s+['"]?(.*?)['"]?)?\s*$/) { + $Parms{$1} = $2; + } + } + } +} + +sub print_symbol_table { + foreach my $k (sort (keys(%Parms))) { + my $v = $Parms{$k}; + print "[$k] -> \"$v\"\n"; + } +} + +#print_symbol_table (); +#exit 0; + +while (<STDIN>) { + s{ + \Q$open_quote\E + \s* + ( + \w+ + ) + \s* + \Q$close_quote\E + }{ + $Parms{$1} + }xge; + print; +} diff --git a/install-win32/makeopenvpn b/install-win32/makeopenvpn new file mode 100644 index 0000000..c1a805d --- /dev/null +++ b/install-win32/makeopenvpn @@ -0,0 +1,37 @@ +#!/bin/sh + +H=`pwd` + +# get version.nsi definitions +. autodefs/defs.sh + +if gcc --version &>/dev/null && [ -d "$OPENSSL_DIR" ] && [ -d "$LZO_DIR" ] && [ -d "$PKCS11_HELPER_DIR" ]; then + # build OpenVPN binary + + if ! [ -f Makefile ]; then + autoreconf -i -v \ + && ./configure \ + --enable-strict \ + --prefix=$H/windest \ + MAN2HTML=true \ + --with-ssl-headers=$H/$OPENSSL_DIR/include \ + --with-ssl-lib=$H/$OPENSSL_DIR/out \ + --with-lzo-headers=$H/$LZO_DIR/include \ + --with-lzo-lib=$H/$LZO_DIR \ + --with-pkcs11-helper-headers=$H/$PKCS11_HELPER_DIR/usr/local/include \ + --with-pkcs11-helper-lib=$H/$PKCS11_HELPER_DIR/usr/local/lib + fi + + make -j $MAKE_JOBS && make install + + # copy OpenVPN and service executables to GENOUT/bin + mkdir -p $GENOUT/bin &>/dev/null + cp windest/sbin/openvpn.exe $GENOUT/bin + cp windest/sbin/openvpnserv.exe $GENOUT/bin + if [ -z "$NO_STRIP" ]; then + strip $GENOUT/bin/openvpn.exe + strip $GENOUT/bin/openvpnserv.exe + fi +else + echo DID NOT BUILD openvpn.exe and openvpnserv.exe because one or more of gcc, OPENSSL_DIR, LZO_DIR, or PKCS11_HELPER_DIR directories were missing +fi diff --git a/install-win32/maketap b/install-win32/maketap new file mode 100644 index 0000000..b9c4070 --- /dev/null +++ b/install-win32/maketap @@ -0,0 +1,17 @@ +#!/bin/sh + +# Get the x86 and x64 versions of the TAP driver + +# get version.nsi definitions +. autodefs/defs.sh + +if [ -d "$TAPBINSRC" ]; then + mkdir -p $GENOUT/driver/i386 &>/dev/null + mkdir -p $GENOUT/driver/amd64 &>/dev/null + for arch in i386 amd64; do + s=$TAPBINSRC/$arch + cp $s/*.sys $s/*.cat $s/*.inf $GENOUT/driver/$arch + done +else + echo Cannot find pre-built tap drivers +fi diff --git a/install-win32/maketapinstall b/install-win32/maketapinstall new file mode 100644 index 0000000..9fe0470 --- /dev/null +++ b/install-win32/maketapinstall @@ -0,0 +1,15 @@ +#!/bin/sh + +# Get the x86 and x64 versions of the tapinstall tool + +# get version.nsi definitions +. autodefs/defs.sh + +if [ -d "$TAPBINSRC" ]; then + mkdir -p $GENOUT/tapinstall/i386 &>/dev/null + mkdir -p $GENOUT/tapinstall/amd64 &>/dev/null + cp $TAPBINSRC/i386/tapinstall.exe $GENOUT/tapinstall/i386 + cp $TAPBINSRC/amd64/tapinstall.exe $GENOUT/tapinstall/amd64 +else + echo Cannot find pre-built tapinstall +fi diff --git a/install-win32/maketext b/install-win32/maketext new file mode 100644 index 0000000..9a94a81 --- /dev/null +++ b/install-win32/maketext @@ -0,0 +1,59 @@ +#!/bin/sh + +# get version.nsi definitions +. autodefs/defs.sh + +mkdir -p $GENOUT/text &>/dev/null + +# build license file +cat COPYING COPYRIGHT.GPL >$GENOUT/text/license.txt + +# copy install file +cp INSTALL-win32.txt $GENOUT/text/INSTALL-win32.txt + +# copy sample configuration files and docs +s=$GENOUT/samples +mkdir -p $s &>/dev/null +cp sample-config-files/client.conf $s/client.$PRODUCT_FILE_EXT +cp sample-config-files/server.conf $s/server.$PRODUCT_FILE_EXT +cp install-win32/sample.ovpn $s/sample.$PRODUCT_FILE_EXT + +# get easy-rsa (Windows) +e=$GENOUT/easy-rsa +mkdir -p $e &>/dev/null +cp easy-rsa/1.0/openssl.cnf $e/openssl.cnf.sample +cp easy-rsa/Windows/* $e + +# get images +i=$GENOUT/images +mkdir -p $i &>/dev/null +cp images/*.ico $i +cp images/*.bmp $i + +# get NSI files +n=$GENOUT/nsi +mkdir -p $n &>/dev/null +cp autodefs/defs.nsi $n +cp autodefs/guidefs.nsi $n +cp autodefs/xguidefs.nsi $n +cp install-win32/openvpn.nsi $n +cp install-win32/setpath.nsi $n +cp install-win32/GetWindowsVersion.nsi $n + +if [ -n "$EXTRACT_FILES" ]; then + cp "$EXTRACT_FILES/MultiFileExtract.nsi" $n +fi + +# get OpenVPN client config files +if [ -n "$SAMPCONF_DIR" ]; then + c=$GENOUT/conf + mkdir -p $c &>/dev/null + test -n "$SAMPCONF_CONF" && cp "../$SAMPCONF_DIR/$SAMPCONF_CONF" $c + test -n "$SAMPCONF_CONF2" && cp "../$SAMPCONF_DIR/$SAMPCONF_CONF2" $c + test -n "$SAMPCONF_P12" && cp "../$SAMPCONF_DIR/$SAMPCONF_P12" $c + test -n "$SAMPCONF_TA" && cp "../$SAMPCONF_DIR/$SAMPCONF_TA" $c + test -n "$SAMPCONF_CA" && cp "../$SAMPCONF_DIR/$SAMPCONF_CA" $c + test -n "$SAMPCONF_CRT" && cp "../$SAMPCONF_DIR/$SAMPCONF_CRT" $c + test -n "$SAMPCONF_KEY" && cp "../$SAMPCONF_DIR/$SAMPCONF_KEY" $c + test -n "$SAMPCONF_DH" && cp "../$SAMPCONF_DIR/$SAMPCONF_DH" $c +fi diff --git a/install-win32/openssl/README.txt b/install-win32/openssl/README.txt new file mode 100644 index 0000000..6a042f4 --- /dev/null +++ b/install-win32/openssl/README.txt @@ -0,0 +1,21 @@ +Rebuild OpenSSL tarball without symbolic links, so +it can be extracted on Windows (run on Unix): + + [download tarball and .asc sig] + gpg --verify openssl-0.9.8k.tar.gz.asc + tar xfz openssl-0.9.8k.tar.gz + tar cfzh openssl-0.9.8k-nolinks.tar.gz openssl-0.9.8k + +To apply patch (in MSYS shell): + + cd /c/src/openssl-0.9.8k + patch -p1 <../21/install-win32/openssl/openssl098.patch + +To build OpenSSL, open a command prompt window, then: + + cd \src\openssl-0.9.8k + ms\mw + +To build a new patch (optional): + + diff -urw openssl-0.9.8k.orig openssl-0.9.8k | grep -v '^Only in' >openssl098.patch diff --git a/install-win32/openssl/openssl097.patch b/install-win32/openssl/openssl097.patch new file mode 100644 index 0000000..ccef40a --- /dev/null +++ b/install-win32/openssl/openssl097.patch @@ -0,0 +1,68 @@ +[in msys bash window] +cd /c/src/openssl-0.9.7m +patch -p1 <../21/install-win32/openssl.patch + +[open command prompt window] +cd \src\openssl-0.9.7m +ms\mw + +diff -wur openssl-0.9.7m.orig/ms/mw.bat openssl-0.9.7m/ms/mw.bat +--- openssl-0.9.7m.orig/ms/mw.bat Sat Feb 22 11:02:46 2003 ++++ openssl-0.9.7m/ms/mw.bat Mon Jan 21 23:12:34 2008 +@@ -1,17 +1,23 @@ + @rem OpenSSL with Mingw32 + @rem -------------------- + ++@rem Include MinGW, MSYS, and ActiveState Perl in path ++set PATH=c:\perl\bin;c:\MinGW\bin;c:\msys\1.0\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem ++ + @rem Makefile + perl util\mkfiles.pl >MINFO +-perl util\mk1mf.pl Mingw32 >ms\mingw32.mak ++perl util\mk1mf.pl no-idea no-mdc2 no-rc5 Mingw32 >ms\mingw32.mak ++ + @rem DLL definition files +-perl util\mkdef.pl 32 libeay >ms\libeay32.def ++perl util\mkdef.pl no-idea no-mdc2 no-rc5 32 libeay >ms\libeay32.def + if errorlevel 1 goto end +-perl util\mkdef.pl 32 ssleay >ms\ssleay32.def ++perl util\mkdef.pl no-idea no-mdc2 no-rc5 32 ssleay >ms\ssleay32.def + if errorlevel 1 goto end + + @rem Build the libraries +-make -f ms/mingw32.mak ++ ++@rem JY added --win32 flag ++make --win32 -f ms/mingw32.mak + if errorlevel 1 goto end + + @rem Generate the DLLs and input libraries +@@ -20,7 +26,9 @@ + dllwrap --dllname libssl32.dll --output-lib out/libssl32.a --def ms/ssleay32.def out/libssl.a out/libeay32.a + if errorlevel 1 goto end + ++@rem JY added openssl.exe linked to DLL ++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 ++ + echo Done compiling OpenSSL + + :end +- +diff -wur openssl-0.9.7m.orig/util/pl/Mingw32.pl openssl-0.9.7m/util/pl/Mingw32.pl +--- openssl-0.9.7m.orig/util/pl/Mingw32.pl Sun May 16 23:28:32 2004 ++++ openssl-0.9.7m/util/pl/Mingw32.pl Mon Jan 21 17:52:36 2008 +@@ -99,10 +99,10 @@ + $n=&bname($target); + $ret.="$target: $files $dep_libs\n"; + $ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n"; +- if (defined $sha1file) +- { +- $ret.="\t$openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file"; +- } ++# if (defined $sha1file) ++# { ++# $ret.="\t$openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file"; ++# } + $ret.="\n"; + return($ret); + } diff --git a/install-win32/openssl/openssl098.patch b/install-win32/openssl/openssl098.patch new file mode 100644 index 0000000..653d2fe --- /dev/null +++ b/install-win32/openssl/openssl098.patch @@ -0,0 +1,56 @@ +diff -urw tmp/openssl-0.9.8h/crypto/pqueue/pqueue.c openssl-0.9.8h/crypto/pqueue/pqueue.c +--- tmp/openssl-0.9.8h/crypto/pqueue/pqueue.c Tue Jun 28 06:53:34 2005 ++++ openssl-0.9.8h/crypto/pqueue/pqueue.c Wed Jun 4 02:52:42 2008 +@@ -199,10 +199,10 @@ + return found; + } + +-#if PQ_64BIT_IS_INTEGER + void + pqueue_print(pqueue_s *pq) + { ++#if PQ_64BIT_IS_INTEGER + pitem *item = pq->items; + + while(item != NULL) +@@ -210,8 +210,8 @@ + printf("item\t" PQ_64BIT_PRINT "\n", item->priority); + item = item->next; + } +- } + #endif ++ } + + pitem * + pqueue_iterator(pqueue_s *pq) +diff -urw tmp/openssl-0.9.8h/ms/mw.bat openssl-0.9.8h/ms/mw.bat +--- tmp/openssl-0.9.8h/ms/mw.bat Sat Feb 22 11:00:10 2003 ++++ openssl-0.9.8h/ms/mw.bat Wed Jun 4 02:56:54 2008 +@@ -1,17 +1,23 @@ + @rem OpenSSL with Mingw32 + @rem -------------------- + ++@rem Include MinGW, MSYS, and ActiveState Perl in path ++set PATH=c:\bin;C:\Perl\bin\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;c:\MinGW\bin;c:\msys\1.0\bin ++ + @rem Makefile + perl util\mkfiles.pl >MINFO +-perl util\mk1mf.pl Mingw32 >ms\mingw32.mak ++perl util\mk1mf.pl no-idea no-mdc2 no-rc5 Mingw32 >ms\mingw32.mak ++ + @rem DLL definition files +-perl util\mkdef.pl 32 libeay >ms\libeay32.def ++perl util\mkdef.pl no-idea no-mdc2 no-rc5 32 libeay >ms\libeay32.def + if errorlevel 1 goto end +-perl util\mkdef.pl 32 ssleay >ms\ssleay32.def ++perl util\mkdef.pl no-idea no-mdc2 no-rc5 32 ssleay >ms\ssleay32.def + if errorlevel 1 goto end + + @rem Build the libraries +-make -f ms/mingw32.mak ++ ++@rem JY added --win32 ++make --win32 -f ms/mingw32.mak + if errorlevel 1 goto end + + @rem Generate the DLLs and input libraries diff --git a/install-win32/openvpn.nsi b/install-win32/openvpn.nsi new file mode 100755 index 0000000..f06c5aa --- /dev/null +++ b/install-win32/openvpn.nsi @@ -0,0 +1,886 @@ +; **************************************************************************** +; * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. * +; * 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 + +SetCompressor lzma + +!include "MUI.nsh" + +!include "defs.nsi" +!include "guidefs.nsi" +!include "xguidefs.nsi" +!include "setpath.nsi" +!include "GetWindowsVersion.nsi" + +!ifdef EXTRACT_FILES +!include "MultiFileExtract.nsi" +!endif + +!define GEN ".." +!define BIN "${GEN}\bin" +!define LIB "${GEN}\lib" + +; Which GUI to use (XGUI has priority). +; We will define either USE_XGUI (XML-based version) or +; USE_GUI (Mathias Sundman version) but not both. +!ifdef OPENVPN_XGUI_DEFINED +!define USE_XGUI +!else +!ifdef OPENVPN_GUI_DEFINED +!define USE_GUI +!endif +!endif + +!define PRODUCT_ICON "icon.ico" + +!ifdef USE_XGUI +!define XGUI_POSTFIX "X" +!else +!define XGUI_POSTFIX "" +!endif + +!ifdef PRODUCT_TAP_DEBUG +!define DBG_POSTFIX "-DBG" +!else +!define DBG_POSTFIX "" +!endif + +!define VERSION "${PRODUCT_VERSION}${XGUI_POSTFIX}${DBG_POSTFIX}" + +!define TAP "${PRODUCT_TAP_ID}" +!define TAPDRV "${TAP}.sys" + +; Default service settings +!define SERV_CONFIG_DIR "$INSTDIR\config" +!define SERV_CONFIG_EXT "${PRODUCT_FILE_EXT}" +!define SERV_EXE_PATH "$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe" +!define SERV_LOG_DIR "$INSTDIR\log" +!define SERV_PRIORITY "NORMAL_PRIORITY_CLASS" +!define SERV_LOG_APPEND "0" + +; XGUI variables +!define XGUI_EXE ovpn-xgui-en.exe +!define XGUI_TRAY ovpn-tray.exe +!define XGUI_XMLSERV ovpn-xmlserv.exe +!define XGUI_HTDOCS htdocs + +!define XGUI_AJAX_GUI_NAME "${PRODUCT_NAME} Ajax GUI" +!define XGUI_TRANSITION_GUI_NAME "${PRODUCT_NAME} Transitional GUI" + +;-------------------------------- +;Configuration + + ;General + + OutFile "${GEN}\${PRODUCT_UNIX_NAME}-${VERSION}${OUTFILE_LABEL}-install.exe" + + 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 ${PRODUCT_NAME}, an Open Source VPN package by James Yonan.\r\n\r\nNote that the Windows version of ${PRODUCT_NAME} 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 ${PRODUCT_NAME} processes or the ${PRODUCT_NAME} service if it is running. All DLLs are installed locally." + + !define MUI_COMPONENTSPAGE_SMALLDESC + !ifdef USE_XGUI + !define MUI_FINISHPAGE_SHOWREADME "http://openvpn.net/" + !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED + !else + !define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\INSTALL-win32.txt" + !endif + !define MUI_FINISHPAGE_NOAUTOCLOSE + !define MUI_ABORTWARNING + !define MUI_ICON "${GEN}\images\${PRODUCT_ICON}" + !define MUI_UNICON "${GEN}\images\${PRODUCT_ICON}" + !define MUI_HEADERIMAGE + !define MUI_HEADERIMAGE_BITMAP "${GEN}\images\install-whirl.bmp" + !define MUI_UNFINISHPAGE_NOAUTOCLOSE + + !insertmacro MUI_PAGE_WELCOME + !insertmacro MUI_PAGE_LICENSE "${GEN}\text\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 ${PRODUCT_NAME} user-space components, including ${PRODUCT_UNIX_NAME}.exe." + +!ifdef USE_GUI + LangString DESC_SecOpenVPNGUI ${LANG_ENGLISH} "Install ${PRODUCT_NAME} GUI by Mathias Sundman" +!endif + +!ifdef USE_XGUI + LangString DESC_SecOpenVPNXGUI ${LANG_ENGLISH} "Install ${PRODUCT_NAME} XML-based GUI" +!endif + + LangString DESC_SecOpenVPNEasyRSA ${LANG_ENGLISH} "Install ${PRODUCT_NAME} 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_SecPKCS11DLLs ${LANG_ENGLISH} "Install PKCS#11 helper DLLs locally (may be omitted if DLLs are already installed globally)." + + LangString DESC_SecTAP ${LANG_ENGLISH} "Install/Upgrade the TAP virtual device driver. Will not interfere with CIPE." + + LangString DESC_SecService ${LANG_ENGLISH} "Install the ${PRODUCT_NAME} service wrapper (${PRODUCT_UNIX_NAME}serv.exe)" + + LangString DESC_SecOpenSSLUtilities ${LANG_ENGLISH} "Install the OpenSSL Utilities (used for generating public/private key pairs)." + + LangString DESC_SecAddPath ${LANG_ENGLISH} "Add ${PRODUCT_NAME} executable directory to the current user's PATH." + + LangString DESC_SecAddShortcuts ${LANG_ENGLISH} "Add ${PRODUCT_NAME} shortcuts to the current user's Start Menu." + + LangString DESC_SecFileAssociation ${LANG_ENGLISH} "Register ${PRODUCT_NAME} 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 "${GEN}\images\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 + +# Verify that user has admin privs + UserInfo::GetName + IfErrors ok + Pop $R0 + UserInfo::GetAccountType + Pop $R1 + StrCmp $R1 "Admin" ok + Messagebox MB_OK "Administrator privileges required to install ${PRODUCT_NAME} [$R0/$R1]" + Abort + ok: + +# Delete previous start menu + RMDir /r $SMPROGRAMS\${PRODUCT_NAME} + +!ifdef CHECK_WINDOWS_VERSION +# Check windows version + Call GetWindowsVersion + Pop $1 + StrCmp $1 "2000" goodwinver + StrCmp $1 "XP" goodwinver + StrCmp $1 "2003" goodwinver + StrCmp $1 "VISTA" goodwinver + + Messagebox MB_OK "Sorry, ${PRODUCT_NAME} does not currently support Windows $1" + Abort + +goodwinver: + System::Call "kernel32::GetCurrentProcess() i .s" + System::Call "kernel32::IsWow64Process(i s, *i .r0)" + IntCmp $0 0 init32bits + + ; we are running on 64-bit windows + StrCmp $1 "VISTA" vista64bummer + +# Messagebox MB_OK "Sorry, ${PRODUCT_NAME} doesn't currently support 64-bit Windows." +# Abort + +vista64bummer: + +# Messagebox MB_OK "Sorry, ${PRODUCT_NAME} doesn't currently support 64-bit Vista because Microsoft doesn't allow the installation of 64 bit unsigned drivers." +# Abort + +init32bits: + +!endif + +FunctionEnd + +!ifndef SF_SELECTED +!define SF_SELECTED 1 +!endif + +;-------------------- +;Pre-install section + +Section -pre + + ; Stop OpenVPN if currently running + DetailPrint "Previous Service REMOVE (if exists)" + nsExec::ExecToLog '"$INSTDIR\bin\${PRODUCT_UNIX_NAME}serv.exe" -remove' + Pop $R0 # return value/error/timeout + +!ifdef USE_XGUI + DetailPrint "Previous XML Service REMOVE (if exists)" + nsExec::ExecToLog '"$INSTDIR\bin\${XGUI_XMLSERV}" -remove' + Pop $R0 # return value/error/timeout +!endif + + Sleep 3000 + +SectionEnd + +Section "${PRODUCT_NAME} User-Space Components" SecOpenVPNUserSpace + + SetOverwrite on + SetOutPath "$INSTDIR\bin" + + File "${BIN}\${PRODUCT_UNIX_NAME}.exe" + +SectionEnd + +!ifdef USE_GUI +Section "${PRODUCT_NAME} GUI" SecOpenVPNGUI + + SetOverwrite on + SetOutPath "$INSTDIR\bin" + + File "${BIN}\${OPENVPN_GUI}" + +SectionEnd +!endif + +!ifdef USE_XGUI +Section "${PRODUCT_NAME} XML-based GUI" SecOpenVPNXGUI + + SetOverwrite on + + SetOutPath "$INSTDIR\bin" + File "${BIN}\${XGUI_EXE}" + File "${BIN}\${XGUI_TRAY}" + File "${BIN}\${XGUI_XMLSERV}" + + SetOutPath "$INSTDIR\${XGUI_HTDOCS}" + File "${GEN}\${XGUI_HTDOCS}\*.*" + +SectionEnd +!endif + +Section "${PRODUCT_NAME} RSA Certificate Management Scripts" SecOpenVPNEasyRSA + + SetOverwrite on + SetOutPath "$INSTDIR\easy-rsa" + + File "${GEN}\easy-rsa\openssl-1.0.0.cnf" + File "${GEN}\easy-rsa\vars.bat.sample" + + File "${GEN}\easy-rsa\init-config.bat" + + File "${GEN}\easy-rsa\README.txt" + File "${GEN}\easy-rsa\build-ca.bat" + File "${GEN}\easy-rsa\build-dh.bat" + File "${GEN}\easy-rsa\build-key-server.bat" + File "${GEN}\easy-rsa\build-key.bat" + File "${GEN}\easy-rsa\build-key-pkcs12.bat" + File "${GEN}\easy-rsa\clean-all.bat" + File "${GEN}\easy-rsa\index.txt.start" + File "${GEN}\easy-rsa\revoke-full.bat" + File "${GEN}\easy-rsa\serial.start" + +SectionEnd + +Section "${PRODUCT_NAME} Service" SecService + + SetOverwrite on + + SetOutPath "$INSTDIR\bin" + File "${BIN}\${PRODUCT_UNIX_NAME}serv.exe" + + SetOutPath "$INSTDIR\config" + + FileOpen $R0 "$INSTDIR\config\README.txt" w + FileWrite $R0 "This directory should contain ${PRODUCT_NAME} configuration files$\r$\n" + FileWrite $R0 "each having an extension of .${SERV_CONFIG_EXT}$\r$\n" + FileWrite $R0 "$\r$\n" + FileWrite $R0 "When ${PRODUCT_NAME} is started as a service, a separate ${PRODUCT_NAME}$\r$\n" + FileWrite $R0 "process will be instantiated for each configuration file.$\r$\n" + FileClose $R0 + + SetOutPath "$INSTDIR\sample-config" + File "${GEN}\samples\sample.${SERV_CONFIG_EXT}" + File "${GEN}\samples\client.${SERV_CONFIG_EXT}" + File "${GEN}\samples\server.${SERV_CONFIG_EXT}" + + CreateDirectory "$INSTDIR\log" + FileOpen $R0 "$INSTDIR\log\README.txt" w + FileWrite $R0 "This directory will contain the log files for ${PRODUCT_NAME}$\r$\n" + FileWrite $R0 "sessions which are being run as a service.$\r$\n" + FileClose $R0 + +SectionEnd + +Section "${PRODUCT_NAME} File Associations" SecFileAssociation +SectionEnd + +Section "OpenSSL DLLs" SecOpenSSLDLLs + + SetOverwrite on + SetOutPath "$INSTDIR\bin" + File "${LIB}\libeay32.dll" + File "${LIB}\libssl32.dll" + +SectionEnd + +Section "OpenSSL Utilities" SecOpenSSLUtilities + + SetOverwrite on + SetOutPath "$INSTDIR\bin" + File "${BIN}\openssl.exe" + +SectionEnd + +Section "PKCS#11 DLLs" SecPKCS11DLLs + + SetOverwrite on + SetOutPath "$INSTDIR\bin" + File "${LIB}\libpkcs11-helper-1.dll" + +SectionEnd + +Section "TAP Virtual Ethernet Adapter" SecTAP + + SetOverwrite on + + FileOpen $R0 "$INSTDIR\bin\addtap.bat" w + FileWrite $R0 "rem Add a new TAP 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 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 + + ; Check if we are running on a 64 bit system. + System::Call "kernel32::GetCurrentProcess() i .s" + System::Call "kernel32::IsWow64Process(i s, *i .r0)" + IntCmp $0 0 tap-32bit + +; tap-64bit: + + DetailPrint "We are running on a 64-bit system." + + SetOutPath "$INSTDIR\bin" + + File "${GEN}\tapinstall\amd64\tapinstall.exe" + + SetOutPath "$INSTDIR\driver" + + File "${GEN}\driver\amd64\OemWin2k.inf" + File "${GEN}\driver\amd64\${PRODUCT_TAP_ID}.cat" + File "${GEN}\driver\amd64\${TAPDRV}" + +goto tapend + +tap-32bit: + + DetailPrint "We are running on a 32-bit system." + + SetOutPath "$INSTDIR\bin" + File "${GEN}\tapinstall\i386\tapinstall.exe" + + SetOutPath "$INSTDIR\driver" + File "${GEN}\driver\i386\OemWin2k.inf" + File "${GEN}\driver\i386\${PRODUCT_TAP_ID}.cat" + File "${GEN}\driver\i386\${TAPDRV}" + + tapend: + +SectionEnd + +Section "Add ${PRODUCT_NAME} 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\${PRODUCT_NAME}" + CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}\Documentation" + WriteINIStr "$SMPROGRAMS\${PRODUCT_NAME}\Documentation\${PRODUCT_NAME} Windows Notes.url" "InternetShortcut" "URL" "http://openvpn.net/INSTALL-win32.html" + WriteINIStr "$SMPROGRAMS\${PRODUCT_NAME}\Documentation\${PRODUCT_NAME} Manual Page.url" "InternetShortcut" "URL" "http://openvpn.net/man.html" + WriteINIStr "$SMPROGRAMS\${PRODUCT_NAME}\Documentation\${PRODUCT_NAME} HOWTO.url" "InternetShortcut" "URL" "http://openvpn.net/howto.html" + WriteINIStr "$SMPROGRAMS\${PRODUCT_NAME}\Documentation\${PRODUCT_NAME} Web Site.url" "InternetShortcut" "URL" "http://openvpn.net/" + CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall ${PRODUCT_NAME}.lnk" "$INSTDIR\Uninstall.exe" + +SectionEnd + +;-------------------- +;Post-install section + +Section -post + + SetOverwrite on + + ; delete old devcon.exe + Delete "$INSTDIR\bin\devcon.exe" + + ; Store README, license, icon + SetOverwrite on + SetOutPath $INSTDIR + !ifndef USE_XGUI + File "${GEN}\text\INSTALL-win32.txt" + !endif + File "${GEN}\text\license.txt" + File "${GEN}\images\${PRODUCT_ICON}" + + ; store sample config files + !ifdef SAMPCONF_DIR + SetOverwrite on + SetOutPath "$INSTDIR\config" + !ifdef SAMPCONF_CONF + File "${GEN}\conf\${SAMPCONF_CONF}" + !endif + !ifdef SAMPCONF_CONF2 + File "${GEN}\conf\${SAMPCONF_CONF2}" + !endif + !ifdef SAMPCONF_P12 + File "${GEN}\conf\${SAMPCONF_P12}" + !endif + !ifdef SAMPCONF_TA + File "${GEN}\conf\${SAMPCONF_TA}" + !endif + !ifdef SAMPCONF_CA + File "${GEN}\conf\${SAMPCONF_CA}" + !endif + !ifdef SAMPCONF_CRT + File "${GEN}\conf\${SAMPCONF_CRT}" + !endif + !ifdef SAMPCONF_KEY + File "${GEN}\conf\${SAMPCONF_KEY}" + !endif + !ifdef SAMPCONF_DH + File "${GEN}\conf\${SAMPCONF_DH}" + !endif + !endif + + ; Try to extract files if present + !ifdef EXTRACT_FILES + Push "$INSTDIR" + Call MultiFileExtract + Pop $R0 + IntCmp $R0 0 +3 +1 +1 + DetailPrint "MultiFileExtract Failed status=$R0" + goto +2 + DetailPrint "MultiFileExtract Succeeded" + !endif + + ; + ; install/upgrade TAP 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 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 REMOVE OLD TAP" + + nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" remove TAP0801' + Pop $R0 # return value/error/timeout + DetailPrint "tapinstall remove TAP0801 returned: $R0" + + DetailPrint "TAP 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 device driver." + + notap: + + ; Store install folder in registry + WriteRegStr HKLM SOFTWARE\${PRODUCT_NAME} "" $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\${PRODUCT_NAME}" "config_dir" "${SERV_CONFIG_DIR}" + !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "config_ext" "${SERV_CONFIG_EXT}" + !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "exe_path" "${SERV_EXE_PATH}" + !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "log_dir" "${SERV_LOG_DIR}" + !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "priority" "${SERV_PRIORITY}" + !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "log_append" "${SERV_LOG_APPEND}" + + ; install openvpnserv as a service (to be started manually from service control manager) + DetailPrint "Service INSTALL" + nsExec::ExecToLog '"$INSTDIR\bin\${PRODUCT_UNIX_NAME}serv.exe" -install' + Pop $R0 # return value/error/timeout + + noserv: + !ifdef USE_XGUI + IfFileExists "$INSTDIR\bin\${XGUI_XMLSERV}" "" fileass + ; install and automatically start XML service + DetailPrint "XML Service INSTALL" + nsExec::ExecToLog '"$INSTDIR\bin\${XGUI_XMLSERV}" -install' + Pop $R0 # return value/error/timeout + + Sleep 2000 + + DetailPrint "XML Service START" + nsExec::ExecToLog '"$INSTDIR\bin\${XGUI_XMLSERV}" -start' + Pop $R0 # return value/error/timeout + + !endif + + ; Create file association if requested + fileass: + SectionGetFlags ${SecFileAssociation} $R0 + IntOp $R0 $R0 & ${SF_SELECTED} + IntCmp $R0 ${SF_SELECTED} "" noass noass + WriteRegStr HKCR ".${SERV_CONFIG_EXT}" "" "${PRODUCT_NAME}File" + WriteRegStr HKCR "${PRODUCT_NAME}File" "" "${PRODUCT_NAME} Config File" + WriteRegStr HKCR "${PRODUCT_NAME}File\shell" "" "open" + WriteRegStr HKCR "${PRODUCT_NAME}File\DefaultIcon" "" "$INSTDIR\${PRODUCT_ICON},0" + WriteRegStr HKCR "${PRODUCT_NAME}File\shell\open\command" "" 'notepad.exe "%1"' + WriteRegStr HKCR "${PRODUCT_NAME}File\shell\run" "" "Start ${PRODUCT_NAME} on this config file" + WriteRegStr HKCR "${PRODUCT_NAME}File\shell\run\command" "" '"$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe" --pause-exit --config "%1"' + + ; Create start menu folders + noass: + CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}\Utilities" + CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}\Shortcuts" + + ; Create start menu and desktop shortcuts to OpenVPN GUI + !ifdef USE_GUI + IfFileExists "$INSTDIR\bin\${OPENVPN_GUI}" "" tryaddxgui + CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME} GUI.lnk" "$INSTDIR\bin\${OPENVPN_GUI}" "" + CreateShortcut "$DESKTOP\${PRODUCT_NAME} GUI.lnk" "$INSTDIR\bin\${OPENVPN_GUI}" + !endif + + ; Create start menu and desktop shortcuts to OpenVPN XGUI + tryaddxgui: + !ifdef USE_XGUI + IfFileExists "$INSTDIR\bin\${XGUI_EXE}" "" tryaddtray + CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${XGUI_TRANSITION_GUI_NAME}.lnk" "$INSTDIR\bin\${XGUI_EXE}" "" +# CreateShortcut "$DESKTOP\${XGUI_TRANSITION_GUI_NAME}.lnk" "$INSTDIR\bin\${XGUI_EXE}" + tryaddtray: + IfFileExists "$INSTDIR\bin\${XGUI_TRAY}" "" tryaddtap + CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${XGUI_AJAX_GUI_NAME}.lnk" "$INSTDIR\bin\${XGUI_EXE}" "" + CreateShortcut "$DESKTOP\${XGUI_AJAX_GUI_NAME}.lnk" "$INSTDIR\bin\${XGUI_TRAY}" + !endif + + ; Create start menu shortcuts to addtap.bat and deltapall.bat + tryaddtap: + IfFileExists "$INSTDIR\bin\addtap.bat" "" trydeltap + CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Utilities\Add a new TAP virtual ethernet adapter.lnk" "$INSTDIR\bin\addtap.bat" "" + + trydeltap: + IfFileExists "$INSTDIR\bin\deltapall.bat" "" config_shortcut + CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Utilities\Delete ALL TAP 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\${PRODUCT_NAME}\Shortcuts\${PRODUCT_NAME} configuration file directory.lnk" "$INSTDIR\config" "" + + log_shortcut: + IfFileExists "$INSTDIR\log" "" samp_shortcut + CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Shortcuts\${PRODUCT_NAME} log file directory.lnk" "$INSTDIR\log" "" + + samp_shortcut: + IfFileExists "$INSTDIR\sample-config" "" genkey_shortcut + CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Shortcuts\${PRODUCT_NAME} Sample Configuration Files.lnk" "$INSTDIR\sample-config" "" + + genkey_shortcut: + IfFileExists "$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe" "" noshortcuts + IfFileExists "$INSTDIR\config" "" noshortcuts + CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Utilities\Generate a static ${PRODUCT_NAME} key.lnk" "$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe" '--pause-exit --verb 3 --genkey --secret "$INSTDIR\config\key.txt"' "$INSTDIR\${PRODUCT_ICON}" 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\${PRODUCT_ICON}" + 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 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) + !ifdef USE_GUI + !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenVPNGUI} $(DESC_SecOpenVPNGUI) + !endif + !ifdef USE_XGUI + !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenVPNXGUI} $(DESC_SecOpenVPNXGUI) + !endif + !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 ${SecPKCS11DLLs} $(DESC_SecPKCS11DLLs) + !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 ${PRODUCT_NAME} [$R0/$R1]" + Abort + ok: +FunctionEnd + +Section "Uninstall" + +!ifdef USE_XGUI + DetailPrint "XML Service REMOVE" + nsExec::ExecToLog '"$INSTDIR\bin\${XGUI_XMLSERV}" -remove' + Pop $R0 # return value/error/timeout +!endif + + ; Stop OpenVPN if currently running + DetailPrint "Service REMOVE" + nsExec::ExecToLog '"$INSTDIR\bin\${PRODUCT_UNIX_NAME}serv.exe" -remove' + Pop $R0 # return value/error/timeout + + Sleep 3000 + + DetailPrint "TAP 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\${PRODUCT_NAME} + + ; delete sample config files + !ifdef SAMPCONF_DIR + !ifdef SAMPCONF_CONF + Delete "$INSTDIR\config\${SAMPCONF_CONF}" + !endif + !ifdef SAMPCONF_CONF2 + Delete "$INSTDIR\config\${SAMPCONF_CONF2}" + !endif + !ifdef SAMPCONF_P12 + Delete "$INSTDIR\config\${SAMPCONF_P12}" + !endif + !ifdef SAMPCONF_TA + Delete "$INSTDIR\config\${SAMPCONF_TA}" + !endif + !ifdef SAMPCONF_CA + Delete "$INSTDIR\config\${SAMPCONF_CA}" + !endif + !ifdef SAMPCONF_CRT + Delete "$INSTDIR\config\${SAMPCONF_CRT}" + !endif + !ifdef SAMPCONF_KEY + Delete "$INSTDIR\config\${SAMPCONF_KEY}" + !endif + !ifdef SAMPCONF_DH + Delete "$INSTDIR\config\${SAMPCONF_DH}" + !endif + !endif + + !ifdef USE_GUI + Delete "$INSTDIR\bin\${OPENVPN_GUI}" + Delete "$DESKTOP\${PRODUCT_NAME} GUI.lnk" + !endif + + !ifdef USE_XGUI + Delete "$INSTDIR\bin\${XGUI_EXE}" + Delete "$INSTDIR\bin\${XGUI_TRAY}" + Delete "$INSTDIR\bin\${XGUI_XMLSERV}" + RMDir /r "$INSTDIR\${XGUI_HTDOCS}" + Delete "$DESKTOP\${XGUI_AJAX_GUI_NAME}.lnk" + Delete "$DESKTOP\${XGUI_TRANSITION_GUI_NAME}.lnk" + !endif + + Delete "$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe" + Delete "$INSTDIR\bin\${PRODUCT_UNIX_NAME}serv.exe" + Delete "$INSTDIR\bin\libeay32.dll" + Delete "$INSTDIR\bin\libssl32.dll" + Delete "$INSTDIR\bin\libpkcs11-helper-1.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\${PRODUCT_TAP_ID}.cat" + Delete "$INSTDIR\driver\${TAPDRV}" + + Delete "$INSTDIR\bin\openssl.exe" + + Delete "$INSTDIR\INSTALL-win32.txt" + Delete "$INSTDIR\${PRODUCT_ICON}" + Delete "$INSTDIR\license.txt" + Delete "$INSTDIR\Uninstall.exe" + + Delete "$INSTDIR\easy-rsa\openssl-1.0.0.cnf" + 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\*.${PRODUCT_FILE_EXT}" + + RMDir "$INSTDIR\bin" + RMDir "$INSTDIR\config" + RMDir "$INSTDIR\driver" + RMDir "$INSTDIR\easy-rsa" + RMDir "$INSTDIR\sample-config" + RMDir /r "$INSTDIR\log" + RMDir "$INSTDIR" + + !insertmacro DelRegKeyIfUnchanged HKCR ".${SERV_CONFIG_EXT}" "${PRODUCT_NAME}File" + DeleteRegKey HKCR "${PRODUCT_NAME}File" + DeleteRegKey HKLM SOFTWARE\${PRODUCT_NAME} + DeleteRegKey HKCU "Software\${PRODUCT_NAME}" + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" + + ;Messagebox MB_OK "IMPORTANT: If you intend on reinstalling ${PRODUCT_NAME} 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/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/settings.in b/install-win32/settings.in new file mode 100644 index 0000000..4a0a564 --- /dev/null +++ b/install-win32/settings.in @@ -0,0 +1,71 @@ +# Version numbers, settings, and dependencies +# for Windows OpenVPN installer. + +# Get the OpenVPN version number +!include "autodefs/version.in" + +# Branding +!define PRODUCT_NAME "OpenVPN" +!define PRODUCT_UNIX_NAME "openvpn" +!define PRODUCT_FILE_EXT "ovpn" + +# Allow --askpass and --auth-user-pass passwords to be read from a file +;!define ENABLE_PASSWORD_SAVE + +# Include the OpenVPN GUI exe in the installer. +# May be undefined. +!define OPENVPN_GUI_DIR "../openvpn-gui" +!define OPENVPN_GUI "openvpn-gui-1.0.3.exe" + +# Include the OpenVPN XML-based GUI exe in the installer. +# May be undefined. +;!define OPENVPN_XGUI_DIR "../ovpnxml" + +# Prebuilt libraries. DMALLOC is optional. +!define OPENSSL_DIR "../openssl.mingw/openssl-0.9.8o" +!define LZO_DIR "../lzo-2.02" +!define PKCS11_HELPER_DIR "../pkcs11-helper" +;!define DMALLOC_DIR "../dmalloc-5.4.2" + +# Prebuilt TAP drivers and tapinstall +!define TAPBINSRC "../tap_dist" + +# Directory containing python script for signing .exe files +!define SIGNTOOL "../signtool" + +# Optional directory of prebuilt OpenVPN binary components, +# to be used as a source when build-from-scratch prerequisites +# are not met. +;!define GENOUT_PREBUILT "../gen-prebuilt" + +# -j parameter passed to make +!define MAKE_JOBS 1 + +# output directory for built binaries +# and other generated files +!define GENOUT "gen" + +# delete GENOUT directory before starting +# set to "yes" or "no" +!define CLEAN "yes" + +# Don't strip executables and DLLs +;!define NO_STRIP + +; DEBUGGING -- set to something like "-DBG2" +!define OUTFILE_LABEL "" + +; DEBUGGING -- set to something like "DEBUG2" +!define TITLE_LABEL "" + +# include a sample configuration file and key +;!define SAMPCONF_DIR "test-key" +;!define SAMPCONF_CONF "test.ovpn" +;!define SAMPCONF_P12 "test.p12" +;!define SAMPCONF_TA "ta.key" +;!define SAMPCONF_CA "ca.crt" +;!define SAMPCONF_CRT "test.crt" +;!define SAMPCONF_KEY "test.key" + +# Extract files embedded in installer +;!define EXTRACT_FILES diff --git a/install-win32/trans.pl b/install-win32/trans.pl new file mode 100644 index 0000000..34fd207 --- /dev/null +++ b/install-win32/trans.pl @@ -0,0 +1,97 @@ +#!/usr/bin/perl + +# This script translates a simple definition-based grammar +# to either C, sh, Javascript, or in (in = identity grammar, i.e. +# same grammar as input). +# +# Input grammar: +# (1) comments having ';' or '#' as the first char in the line +# (2) a blank line +# (3) !include "file" +# (4) !define foo bar +# (5) !define foo "bar" +# +# Environmental variables can be used to override a setting. +# The special value "null" causes the variable to be undefined. +# If an environmental value is bracketed, i.e [abc], the brackets +# will be converted to double quotes prior to output. + +sub comment { + my ($cmt) = @_; + print "//$cmt\n" if ($mode =~ /^(c|js|h)$/); + print "#$cmt\n" if ($mode =~ /^(sh|nsi|in)$/); +} + +sub define { + my ($name, $value) = @_; + if ($mode eq "sh") { + $value="true" if !$value; + print "[ -z \"\$$name\" ] && export $name=$value\n"; + print "[ \"\$$name\" = \"$nulltag\" ] && unset $name\n"; + } else { + if ($ENV{$name}) { + $value = $ENV{$name}; + $value = "\"$1\"" if ($value =~ /\[(.*)\]$/); + } + if ($value ne $nulltag) { + print "#define $name $value\n" if ($mode =~ /^(c|h)$/); + print "!define $name $value\n" if ($mode =~ /^(nsi|in)$/); + print "var $name=$value;\n" if ($mode eq "js"); + } else { + print "//#undef $name\n" if ($mode =~ /^(c|h)$/); + print "#!undef $name\n" if ($mode eq "nsi"); + print ";!undef $name\n" if ($mode eq "in"); + print "//undef $name\n" if ($mode eq "js"); + } + } +} + +sub include_file { + local $_; + $include_file_level++; + die "!include file nesting too deep" if ($include_file_level > $max_inc_depth); + my ($parm) = @_; + my $fn = "$incdir/$parm"; + local *IN; + open(IN, "< $fn") or die "cannot open $fn"; + while (<IN>) { + chomp; + if (/^\s*$/) { + print "\n"; + } elsif (/^[#;](.*)$/) { + comment ($1); + } elsif (/^!define\s+(\w+)(?:\s+(.*?))?\s*$/) { + define ($1, $2); + } elsif (/^!include\s+"(.+)"$/) { + include_file ($1); + } else { + die "can't parse this line: $_\n"; + } + } + $include_file_level--; +} + +die "usage: trans <c|h|sh|js|nsi|in> [-I<dir>] [files ...]" if (@ARGV < 1); + +($mode) = shift(@ARGV); +die "mode must be one of c, h, sh, js, nsi, or in" if !($mode =~ /^(c|h|sh|js|nsi|in)$/); + +$nulltag = "null"; +$max_inc_depth = 10; +$include_file_level = 0; +$incdir = "."; + +comment(" This file was automatically generated by trans.pl"); + +while ($arg=shift(@ARGV)) { + if ($arg =~ /^-/) { + if ($arg =~ /^-I(.*)$/) { + $incdir = $1; + } else { + die "unrecognized option: $arg"; + } + } else { + print "\n"; + include_file ($arg); + } +} 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; +} diff --git a/install-win32/winconfig b/install-win32/winconfig new file mode 100644 index 0000000..9d686c9 --- /dev/null +++ b/install-win32/winconfig @@ -0,0 +1,18 @@ +#!/bin/sh + +# prepare files for building on Windows +# run from top directory: install-win32/winconfig + +rm -rf autodefs +mkdir autodefs + +# build multi-grammar definition files +perl install-win32/m4todef.pl <version.m4 >autodefs/version.in +for g in "h" "sh" "nsi" "in" ; do + perl install-win32/trans.pl $g install-win32/settings.in >autodefs/defs.$g +done + +cat /dev/null >autodefs/guidefs.nsi + +echo '#include "autodefs/defs.h"' >autodefs.h +echo '#include "config.h"' >>autodefs.h |