Add local user for openvpn
This commit is contained in:
parent
5ced041013
commit
db38968982
@ -71,6 +71,25 @@ endif
|
|||||||
comment "Delete program shortcuts"
|
comment "Delete program shortcuts"
|
||||||
LinkFolder_uninstall
|
LinkFolder_uninstall
|
||||||
|
|
||||||
|
comment "Check if user exists."
|
||||||
|
set $ResultList2$ = getOutStreamFromSection("DosInAnIcon_checkuser")
|
||||||
|
set $UserExists$ = takeString(0,$ResultList2$)
|
||||||
|
set $UserExists$ = takeString(0,splitstring($UserExists$," "))
|
||||||
|
|
||||||
|
if $UserExists$ = "yes"
|
||||||
|
DosInAnIcon_deleteuser
|
||||||
|
else
|
||||||
|
LogError "User '" + $local_user$ + "' does not exist!"
|
||||||
|
isFatalError
|
||||||
|
endif
|
||||||
|
|
||||||
|
[DosInAnIcon_checkuser]
|
||||||
|
@echo off
|
||||||
|
net user openvpn >nul 2>&1 && echo yes || echo no
|
||||||
|
|
||||||
|
[DosInAnIcon_deleteuser]
|
||||||
|
NET USER openvpn /DELETE
|
||||||
|
|
||||||
[Winbatch_uninstall_old_32]
|
[Winbatch_uninstall_old_32]
|
||||||
"$UninstallProgramOld32$" /S
|
"$UninstallProgramOld32$" /S
|
||||||
|
|
||||||
|
@ -25,8 +25,16 @@ DefVar $OLD_VERSION$
|
|||||||
DefVar $OLD_CREATOR_TAG$
|
DefVar $OLD_CREATOR_TAG$
|
||||||
DefVar $OLD_RELEASE$
|
DefVar $OLD_RELEASE$
|
||||||
|
|
||||||
|
DefVar $openvpn_userpasswd$
|
||||||
|
DefVar $UserExists$
|
||||||
|
|
||||||
|
DefStringlist $ResultList$
|
||||||
|
DefStringlist $ResultList2$
|
||||||
|
|
||||||
Set $INST_SystemType$ = GetSystemType
|
Set $INST_SystemType$ = GetSystemType
|
||||||
set $INST_architecture$ = GetProductProperty("install_architecture","system specific")
|
set $INST_architecture$ = GetProductProperty("install_architecture","system specific")
|
||||||
|
Set $openvpn_userpasswd$ = RandomStr
|
||||||
|
|
||||||
|
|
||||||
Set $LogDir$ = "%SystemDrive%\tmp"
|
Set $LogDir$ = "%SystemDrive%\tmp"
|
||||||
|
|
||||||
@ -71,6 +79,29 @@ else
|
|||||||
Winbatch_install_cert
|
Winbatch_install_cert
|
||||||
Sub_check_exitcode
|
Sub_check_exitcode
|
||||||
|
|
||||||
|
comment "get the name of the admin group"
|
||||||
|
comment "using psgetsid from sysinernals pstools"
|
||||||
|
set $ResultList$ = getOutStreamFromSection("DosInAnIcon_get_admin_group")
|
||||||
|
|
||||||
|
set $Group$ = takeString(6,$ResultList$)
|
||||||
|
set $Group$ = takeString(1,splitstring($Group$,"\"))
|
||||||
|
|
||||||
|
comment "Check if user exists."
|
||||||
|
comment "If user exists, the password will be altered. Otherwise, the user will be created."
|
||||||
|
set $ResultList2$ = getOutStreamFromSection("DosInAnIcon_checkuser")
|
||||||
|
set $UserExists$ = takeString(0,$ResultList2$)
|
||||||
|
|
||||||
|
setLogLevel=0
|
||||||
|
|
||||||
|
comment "create our local user"
|
||||||
|
if $UserExists$ = "no"
|
||||||
|
DosInAnIcon_makeadmin
|
||||||
|
else
|
||||||
|
DosInAnIcon_alter_pw
|
||||||
|
endif
|
||||||
|
|
||||||
|
setLogLevel=3
|
||||||
|
|
||||||
comment "installing"
|
comment "installing"
|
||||||
|
|
||||||
if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only")
|
if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only")
|
||||||
@ -84,7 +115,7 @@ else
|
|||||||
comment "Patch Registry"
|
comment "Patch Registry"
|
||||||
Registry_install /32Bit
|
Registry_install /32Bit
|
||||||
comment "Create shortcuts"
|
comment "Create shortcuts"
|
||||||
LinkFolder_install
|
LinkFolder_install_32
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only"))
|
if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only"))
|
||||||
@ -98,16 +129,32 @@ else
|
|||||||
comment "Patch Registry"
|
comment "Patch Registry"
|
||||||
Registry_install /64Bit
|
Registry_install /64Bit
|
||||||
comment "Create shortcuts"
|
comment "Create shortcuts"
|
||||||
LinkFolder_install
|
LinkFolder_install_64
|
||||||
endif
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
[DosInAnIcon_get_admin_group]
|
||||||
|
@echo off
|
||||||
|
"%ScriptPath%\ALL\PsGetsid.exe" /accepteula S-1-5-32-544
|
||||||
|
|
||||||
|
[DosInAnIcon_checkuser]
|
||||||
|
@echo off
|
||||||
|
net user openvpn >nul 2>&1 && echo yes || echo no
|
||||||
|
|
||||||
|
[DosInAnIcon_makeadmin]
|
||||||
|
NET USER openvpn $openvpn_userpasswd$ /ADD /comment:"Local User created by OpenVPN opsi-package" /fullname:"Local User by Opsi OpenVPN" /passwordchg:no /passwordreq:yes /expires:never /active:yes
|
||||||
|
NET LOCALGROUP $Group$ /ADD openvpn
|
||||||
|
|
||||||
|
[DosInAnIcon_alter_pw]
|
||||||
|
NET USER openvpn $openvpn_userpasswd$
|
||||||
|
|
||||||
[Winbatch_install_cert]
|
[Winbatch_install_cert]
|
||||||
certutil -addstore "TrustedPublisher" "%ScriptPath%\OpenVPN Certificate.cer"
|
certutil -addstore "TrustedPublisher" "%ScriptPath%\OpenVPN-Certificate.cer"
|
||||||
|
|
||||||
[Winbatch_install_32]
|
[Winbatch_install_32]
|
||||||
"$Install32Exe$" /S
|
"$Install32Exe$" /S
|
||||||
|
"%ScriptPath%\ALL\CPAU.exe" -u openvpn -p $openvpn_userpasswd$ -ex "$InstallDir32$\bin\openvpn-gui.exe" -enc -file "$InstallDir32$\openvpn.job" -crc "$InstallDir32$\bin\openvpn-gui.exe"
|
||||||
|
|
||||||
[Files_install_32]
|
[Files_install_32]
|
||||||
; copy the ini file to the InstallDir
|
; copy the ini file to the InstallDir
|
||||||
@ -115,10 +162,11 @@ copy "$IniCfgFile$" "$InstallDir32$"
|
|||||||
|
|
||||||
; Example of recursively copying some files into the installation directory:
|
; Example of recursively copying some files into the installation directory:
|
||||||
;
|
;
|
||||||
; copy -s "%ScriptPath%\files\*.*" "$InstallDir32$"
|
copy -s "%ScriptPath%\ALL\CPAU.exe" "$InstallDir32$"
|
||||||
|
|
||||||
[Winbatch_install_64]
|
[Winbatch_install_64]
|
||||||
"$Install64Exe$" /S
|
"$Install64Exe$" /S
|
||||||
|
"%ScriptPath%\ALL\CPAU.exe" -u openvpn -p $openvpn_userpasswd$ -ex "$InstallDir64$\bin\openvpn-gui.exe" -enc -file "$InstallDir64$\openvpn.job" -crc "$InstallDir64$\bin\openvpn-gui.exe"
|
||||||
|
|
||||||
[Files_install_64]
|
[Files_install_64]
|
||||||
; copy the ini file to the InstallDir
|
; copy the ini file to the InstallDir
|
||||||
@ -126,7 +174,7 @@ copy "$IniCfgFile$" "$InstallDir64$"
|
|||||||
|
|
||||||
; Example of recursively copying some files into the installation directory:
|
; Example of recursively copying some files into the installation directory:
|
||||||
;
|
;
|
||||||
; copy -s "%ScriptPath%\files\*.*" "$InstallDir64$"
|
copy -s "%ScriptPath%\ALL\CPAU.exe" "$InstallDir64$"
|
||||||
|
|
||||||
[Registry_install]
|
[Registry_install]
|
||||||
; Example of setting some values of an registry key:
|
; Example of setting some values of an registry key:
|
||||||
@ -136,39 +184,55 @@ copy "$IniCfgFile$" "$InstallDir64$"
|
|||||||
; set "name2" = REG_DWORD:0001
|
; set "name2" = REG_DWORD:0001
|
||||||
; set "name3" = REG_BINARY:00 af 99 cd
|
; set "name3" = REG_BINARY:00 af 99 cd
|
||||||
|
|
||||||
[LinkFolder_install]
|
[LinkFolder_install_32]
|
||||||
; Example of deleting a folder from AllUsers startmenu:
|
set_basefolder common_programs
|
||||||
;
|
set_subfolder OpenVPN
|
||||||
; set_basefolder common_programs
|
|
||||||
; delete_subfolder $ProductId$
|
set_link
|
||||||
;
|
name: OpenVPN GUI
|
||||||
; Example of creating an shortcut to the installed exe in AllUsers startmenu:
|
target: $InstallDir32$/CPAU.exe
|
||||||
;
|
parameters: -dec -file $InstallDir32$\openvpn.job
|
||||||
; set_basefolder common_programs
|
working_dir: $InstallDir32$
|
||||||
; set_subfolder $ProductId$
|
icon_file: $InstallDir32$\icon.ico
|
||||||
;
|
icon_index:
|
||||||
; set_link
|
end_link
|
||||||
; name: $ProductId$
|
|
||||||
; target: <path to the program>
|
set_basefolder common_desktopdirectory
|
||||||
; parameters:
|
set_subfolder ""
|
||||||
; working_dir: $InstallDir$
|
|
||||||
; icon_file:
|
set_link
|
||||||
; icon_index:
|
name: OpenVPN GUI
|
||||||
; end_link
|
target: $InstallDir32$/CPAU.exe
|
||||||
;
|
parameters: -dec -file $InstallDir32$\openvpn.job
|
||||||
; Example of creating an shortcut to the installed exe on AllUsers desktop:
|
working_dir: $InstallDir32$
|
||||||
;
|
icon_file: $InstallDir32$\icon.ico
|
||||||
; set_basefolder common_desktopdirectory
|
icon_index:
|
||||||
; set_subfolder ""
|
end_link
|
||||||
;
|
|
||||||
; set_link
|
[LinkFolder_install_64]
|
||||||
; name: $ProductId$
|
set_basefolder common_programs
|
||||||
; target: <path to the program>
|
set_subfolder OpenVPN
|
||||||
; parameters: <some_param>
|
|
||||||
; working_dir: $InstallDir$
|
set_link
|
||||||
; icon_file: <path to icon file>
|
name: OpenVPN GUI
|
||||||
; icon_index: 2
|
target: $InstallDir64$/CPAU.exe
|
||||||
; end_link
|
parameters: -dec -file $InstallDir64$\openvpn.job
|
||||||
|
working_dir: $InstallDir64$
|
||||||
|
icon_file: $InstallDir64$\icon.ico
|
||||||
|
icon_index:
|
||||||
|
end_link
|
||||||
|
|
||||||
|
set_basefolder common_desktopdirectory
|
||||||
|
set_subfolder ""
|
||||||
|
|
||||||
|
set_link
|
||||||
|
name: OpenVPN GUI
|
||||||
|
target: $InstallDir64$/CPAU.exe
|
||||||
|
parameters: -dec -file $InstallDir64$\openvpn.job
|
||||||
|
working_dir: $InstallDir64$
|
||||||
|
icon_file: $InstallDir64$\icon.ico
|
||||||
|
icon_index:
|
||||||
|
end_link
|
||||||
|
|
||||||
[Sub_check_exitcode]
|
[Sub_check_exitcode]
|
||||||
comment "Test for installation success via exit code"
|
comment "Test for installation success via exit code"
|
||||||
|
@ -26,6 +26,9 @@ DefVar $OLD_VERSION$
|
|||||||
DefVar $OLD_CREATOR_TAG$
|
DefVar $OLD_CREATOR_TAG$
|
||||||
DefVar $OLD_RELEASE$
|
DefVar $OLD_RELEASE$
|
||||||
|
|
||||||
|
DefVar $UserExists$
|
||||||
|
DefStringlist $ResultList2$
|
||||||
|
|
||||||
Set $INST_SystemType$ = GetSystemType
|
Set $INST_SystemType$ = GetSystemType
|
||||||
set $INST_architecture$ = GetProductProperty("install_architecture","system specific")
|
set $INST_architecture$ = GetProductProperty("install_architecture","system specific")
|
||||||
|
|
||||||
|
@ -32,6 +32,16 @@ DL_SOURCE[3]="http://nativeex.boot-land.net/Programs/DriverSigning/DriverSigning
|
|||||||
DL_ARCH[3]="X86"
|
DL_ARCH[3]="X86"
|
||||||
DL_WINST_NAME[3]=Driversigning32Exe
|
DL_WINST_NAME[3]=Driversigning32Exe
|
||||||
|
|
||||||
|
DL_FILE[4]="CPAU-${VERSION}.zip"
|
||||||
|
DL_SOURCE[4]="http://www.joeware.net/downloads/dl.php"
|
||||||
|
DL_ARCH[4]="ALL"
|
||||||
|
DL_EXTRACT_FORMAT[4]="unzip"
|
||||||
|
|
||||||
|
DL_FILE[5]="PSTools-${VERSION}.zip"
|
||||||
|
DL_SOURCE[5]="http://download.sysinternals.com/files/PSTools.zip"
|
||||||
|
DL_ARCH[5]="ALL"
|
||||||
|
DL_EXTRACT_FORMAT[5]="unzip"
|
||||||
|
|
||||||
# File array index for the image showing while installing the program
|
# File array index for the image showing while installing the program
|
||||||
ICON_DL_INDEX=0
|
ICON_DL_INDEX=0
|
||||||
|
|
||||||
|
@ -23,3 +23,10 @@ function cleanup() {
|
|||||||
echo "Cleanup"
|
echo "Cleanup"
|
||||||
builder_cleanup
|
builder_cleanup
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function create() {
|
||||||
|
echo "Create"
|
||||||
|
builder_create
|
||||||
|
|
||||||
|
find $INST_DIR/CLIENT_DATA/ALL/ -type f ! -name 'PsGet*' ! -name 'CPAU*' -delete
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user