From fdfa8dfe7fda05dee030cfd3c3949cf09ab6dab4 Mon Sep 17 00:00:00 2001 From: max Date: Sat, 26 Sep 2026 20:22:59 +0200 Subject: [PATCH] feat(installer): add custom data directory selection page and enterprise branding to client and server setups --- compilation/installer_client.iss | 66 ++++++++++++++++++++++++++++++-- compilation/installer_client.nsi | 62 +++++++++++++++++++++++++++--- compilation/installer_server.iss | 66 ++++++++++++++++++++++++++++++-- compilation/installer_server.nsi | 62 +++++++++++++++++++++++++++--- 4 files changed, 240 insertions(+), 16 deletions(-) diff --git a/compilation/installer_client.iss b/compilation/installer_client.iss index 210cbca..c972081 100644 --- a/compilation/installer_client.iss +++ b/compilation/installer_client.iss @@ -1,12 +1,22 @@ [Setup] AppName=LOGAR Client AppVersion=0.3.1 +AppPublisher=LOGAR Security Systems +AppPublisherURL=https://logar.eibl.tech +AppSupportURL=https://logar.eibl.tech +AppUpdatesURL=https://logar.eibl.tech DefaultDirName={autopf}\LOGAR OutputDir=..\dist OutputBaseFilename=LOGAR-Client-Setup PrivilegesRequired=admin Compression=lzma SolidCompression=yes +WizardStyle=modern +VersionInfoCompany=LOGAR Security Systems +VersionInfoDescription=LOGAR Windows Edge Log Forwarder Setup +VersionInfoVersion=0.3.1.0 +VersionInfoProductName=LOGAR Client +VersionInfoProductVersion=0.3.1 [Files] Source: "..\dist\Win_Client.exe"; DestDir: "{app}"; Flags: ignoreversion @@ -14,13 +24,14 @@ Source: "..\compilation\nssm.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "..\dist\runtime\*"; DestDir: "{app}\runtime"; Flags: ignoreversion recursesubdirs createallsubdirs [Dirs] -Name: "{commonappdata}\LOGAR"; Permissions: users-modify +Name: "{code:GetDataDir}"; Permissions: users-modify [Run] Filename: "{app}\nssm.exe"; Parameters: "install LOGAR_Client ""{app}\Win_Client.exe"""; Flags: runhidden Filename: "{app}\nssm.exe"; Parameters: "set LOGAR_Client AppDirectory ""{app}"""; Flags: runhidden -Filename: "{app}\nssm.exe"; Parameters: "set LOGAR_Client AppStdout ""{commonappdata}\LOGAR\client.log"""; Flags: runhidden -Filename: "{app}\nssm.exe"; Parameters: "set LOGAR_Client AppStderr ""{commonappdata}\LOGAR\client_err.log"""; Flags: runhidden +Filename: "{app}\nssm.exe"; Parameters: "set LOGAR_Client AppStdout ""{code:GetDataDir}\client.log"""; Flags: runhidden +Filename: "{app}\nssm.exe"; Parameters: "set LOGAR_Client AppStderr ""{code:GetDataDir}\client_err.log"""; Flags: runhidden +Filename: "{app}\nssm.exe"; Parameters: "set LOGAR_Client AppParameters ""--config """"{code:GetDataDir}\client_config.json"""""""; Flags: runhidden Filename: "{app}\nssm.exe"; Parameters: "start LOGAR_Client"; Flags: runhidden [UninstallRun] @@ -35,3 +46,52 @@ Type: files; Name: "{app}\*.log" Type: filesandordirs; Name: "{app}\runtime" Type: filesandordirs; Name: "{app}" Type: filesandordirs; Name: "{commonappdata}\LOGAR" + +[Code] +var + DataDirPage: TInputDirWizardPage; + +procedure InitializeWizard; +begin + DataDirPage := CreateInputDirPage( + wpSelectDir, + 'Data and Configuration Location', + 'Where should LOGAR Client store its state tracking and certificates?', + 'Select the folder where LOGAR Client should store state tracking (client_state.json), configuration (client_config.json), and mTLS certificates.'#13#10#13#10 + + 'By default, this is stored in Common AppData (C:\ProgramData\LOGAR), which is accessible to background Windows services.', + False, + '' + ); + DataDirPage.Add('Data Directory:'); + DataDirPage.Values[0] := ExpandConstant('{commonappdata}\LOGAR'); +end; + +function GetDataDir(Param: String): String; +begin + Result := DataDirPage.Values[0]; + if Result = '' then + Result := ExpandConstant('{commonappdata}\LOGAR'); +end; + +procedure CurStepChanged(CurStep: TSetupStep); +begin + if CurStep = ssPostInstall then + begin + RegWriteStringValue(HKEY_LOCAL_MACHINE, 'Software\LOGAR\LOGAR-Client', 'DataDir', GetDataDir('')); + end; +end; + +procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep); +var + CustomDataDir: String; +begin + if CurUninstallStep = usPostUninstall then + begin + if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'Software\LOGAR\LOGAR-Client', 'DataDir', CustomDataDir) then + begin + if (CustomDataDir <> '') and DirExists(CustomDataDir) then + DelTree(CustomDataDir, True, True, True); + RegDeleteKeyIncludingSubkeys(HKEY_LOCAL_MACHINE, 'Software\LOGAR\LOGAR-Client'); + end; + end; +end; diff --git a/compilation/installer_client.nsi b/compilation/installer_client.nsi index 0e778e3..cdfe74b 100644 --- a/compilation/installer_client.nsi +++ b/compilation/installer_client.nsi @@ -1,20 +1,64 @@ !include "MUI2.nsh" +!include "LogicLib.nsh" Name "LOGAR Client" OutFile "../dist/LOGAR-Client-Setup.exe" InstallDir "$PROGRAMFILES64\LOGAR" RequestExecutionLevel admin +BrandingText "LOGAR Enterprise SIEM & Edge Forwarder" + +VIProductVersion "0.3.1.0" +VIAddVersionKey "ProductName" "LOGAR Client" +VIAddVersionKey "CompanyName" "LOGAR Security Systems" +VIAddVersionKey "LegalCopyright" "© 2026 LOGAR Security Systems" +VIAddVersionKey "FileDescription" "LOGAR Windows Edge Log Forwarder Setup" +VIAddVersionKey "FileVersion" "0.3.1.0" +VIAddVersionKey "ProductVersion" "0.3.1.0" + +Var DATADIR + +# --- UI Pages --- +!define MUI_ABORTWARNING + +# Welcome Page +!define MUI_WELCOMEPAGE_TITLE "Welcome to LOGAR Client Setup" +!define MUI_WELCOMEPAGE_TEXT "LOGAR Client provides secure, encrypted Windows Event Log forwarding with automatic certificate enrollment and state tracking.\r\n\r\nThis wizard will guide you through installing the forwarder service." !insertmacro MUI_PAGE_WELCOME + +# Directory Page 1: Installation Directory +!define MUI_PAGE_HEADER_TEXT "Choose Installation Location" +!define MUI_PAGE_HEADER_SUBTEXT "Choose the folder in which to install program binaries." +!define MUI_DIRECTORYPAGE_VARIABLE $INSTDIR !insertmacro MUI_PAGE_DIRECTORY + +# Directory Page 2: Data Directory +!define MUI_PAGE_HEADER_TEXT "Choose Data & Storage Location" +!define MUI_PAGE_HEADER_SUBTEXT "Choose where state tracking, certificates, and configuration files should be stored." +!define MUI_DIRECTORYPAGE_TEXT_TOP "Choose the folder where LOGAR Client should store state tracking (client_state.json), configuration (client_config.json), and mTLS certificates.$\r$\n$\r$\nDefault is recommended for automatic background service access." +!define MUI_DIRECTORYPAGE_TEXT_DESTINATION "Data & Storage Folder" +!define MUI_DIRECTORYPAGE_VARIABLE $DATADIR +!insertmacro MUI_PAGE_DIRECTORY + +# Instfiles Page !insertmacro MUI_PAGE_INSTFILES + +# Finish Page +!define MUI_FINISHPAGE_TITLE "Installation Complete" +!define MUI_FINISHPAGE_TEXT "LOGAR Client has been successfully installed and configured as an automated background service." !insertmacro MUI_PAGE_FINISH +# Uninstaller Pages !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES !insertmacro MUI_LANGUAGE "English" +Function .onInit + SetShellVarContext all + StrCpy $DATADIR "$APPDATA\LOGAR" +FunctionEnd + Section "Install" SetShellVarContext all SetOutPath "$INSTDIR" @@ -22,21 +66,28 @@ Section "Install" File "../compilation/nssm.exe" File /r "../dist/runtime" - CreateDirectory "$APPDATA\LOGAR" - ExecWait 'icacls "$APPDATA\LOGAR" /grant "*S-1-5-32-545:(OI)(CI)M" /T /Q' + CreateDirectory "$DATADIR" + ExecWait 'icacls "$DATADIR" /grant "*S-1-5-32-545:(OI)(CI)M" /T /Q' # Install and configure service via NSSM ExecWait '"$INSTDIR\nssm.exe" install LOGAR_Client "$INSTDIR\Win_Client.exe"' ExecWait '"$INSTDIR\nssm.exe" set LOGAR_Client AppDirectory "$INSTDIR"' - ExecWait '"$INSTDIR\nssm.exe" set LOGAR_Client AppStdout "$APPDATA\LOGAR\client.log"' - ExecWait '"$INSTDIR\nssm.exe" set LOGAR_Client AppStderr "$APPDATA\LOGAR\client_err.log"' + ExecWait '"$INSTDIR\nssm.exe" set LOGAR_Client AppStdout "$DATADIR\client.log"' + ExecWait '"$INSTDIR\nssm.exe" set LOGAR_Client AppStderr "$DATADIR\client_err.log"' + ExecWait '"$INSTDIR\nssm.exe" set LOGAR_Client AppParameters "--config \"$DATADIR\client_config.json\""' ExecWait '"$INSTDIR\nssm.exe" start LOGAR_Client' WriteUninstaller "$INSTDIR\uninstall.exe" + WriteRegStr HKLM "Software\LOGAR\LOGAR-Client" "DataDir" "$DATADIR" SectionEnd Section "Uninstall" SetShellVarContext all + ReadRegStr $DATADIR HKLM "Software\LOGAR\LOGAR-Client" "DataDir" + ${If} $DATADIR == "" + StrCpy $DATADIR "$APPDATA\LOGAR" + ${EndIf} + ExecWait '"$INSTDIR\nssm.exe" stop LOGAR_Client' ExecWait '"$INSTDIR\nssm.exe" remove LOGAR_Client confirm' RMDir /r "$INSTDIR\runtime" @@ -48,5 +99,6 @@ Section "Uninstall" Delete "$INSTDIR\nssm.exe" Delete "$INSTDIR\uninstall.exe" RMDir /r "$INSTDIR" - RMDir /r "$APPDATA\LOGAR" + RMDir /r "$DATADIR" + DeleteRegKey HKLM "Software\LOGAR\LOGAR-Client" SectionEnd diff --git a/compilation/installer_server.iss b/compilation/installer_server.iss index 48e5e05..feaa556 100644 --- a/compilation/installer_server.iss +++ b/compilation/installer_server.iss @@ -1,12 +1,22 @@ [Setup] AppName=LOGAR Server AppVersion=0.3.1 +AppPublisher=LOGAR Security Systems +AppPublisherURL=https://logar.eibl.tech +AppSupportURL=https://logar.eibl.tech +AppUpdatesURL=https://logar.eibl.tech DefaultDirName={autopf}\LOGAR-Server OutputDir=..\dist OutputBaseFilename=LOGAR-Server-Setup PrivilegesRequired=admin Compression=lzma SolidCompression=yes +WizardStyle=modern +VersionInfoCompany=LOGAR Security Systems +VersionInfoDescription=LOGAR Cloud Hub & TCP Ingestion Server Setup +VersionInfoVersion=0.3.1.0 +VersionInfoProductName=LOGAR Server +VersionInfoProductVersion=0.3.1 [Files] Source: "..\dist\Server.exe"; DestDir: "{app}"; Flags: ignoreversion @@ -14,13 +24,14 @@ Source: "..\compilation\nssm.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "..\dist\runtime\*"; DestDir: "{app}\runtime"; Flags: ignoreversion recursesubdirs createallsubdirs [Dirs] -Name: "{commonappdata}\LOGAR-Server"; Permissions: users-modify +Name: "{code:GetDataDir}"; Permissions: users-modify [Run] Filename: "{app}\nssm.exe"; Parameters: "install LOGAR_Server ""{app}\Server.exe"""; Flags: runhidden Filename: "{app}\nssm.exe"; Parameters: "set LOGAR_Server AppDirectory ""{app}"""; Flags: runhidden -Filename: "{app}\nssm.exe"; Parameters: "set LOGAR_Server AppStdout ""{commonappdata}\LOGAR-Server\server.log"""; Flags: runhidden -Filename: "{app}\nssm.exe"; Parameters: "set LOGAR_Server AppStderr ""{commonappdata}\LOGAR-Server\server_err.log"""; Flags: runhidden +Filename: "{app}\nssm.exe"; Parameters: "set LOGAR_Server AppStdout ""{code:GetDataDir}\server.log"""; Flags: runhidden +Filename: "{app}\nssm.exe"; Parameters: "set LOGAR_Server AppStderr ""{code:GetDataDir}\server_err.log"""; Flags: runhidden +Filename: "{app}\nssm.exe"; Parameters: "set LOGAR_Server AppParameters ""--config """"{code:GetDataDir}\server_config.json"""""""; Flags: runhidden Filename: "{app}\nssm.exe"; Parameters: "start LOGAR_Server"; Flags: runhidden [UninstallRun] @@ -36,3 +47,52 @@ Type: files; Name: "{app}\*.log" Type: filesandordirs; Name: "{app}\runtime" Type: filesandordirs; Name: "{app}" Type: filesandordirs; Name: "{commonappdata}\LOGAR-Server" + +[Code] +var + DataDirPage: TInputDirWizardPage; + +procedure InitializeWizard; +begin + DataDirPage := CreateInputDirPage( + wpSelectDir, + 'Data and Configuration Location', + 'Where should LOGAR Server store its database, certificates, and configuration?', + 'Select the folder where LOGAR Server should store the database (logar_state.db), configuration (server_config.json), and mTLS certificates.'#13#10#13#10 + + 'By default, this is stored in Common AppData (C:\ProgramData\LOGAR-Server), which is accessible to background Windows services.', + False, + '' + ); + DataDirPage.Add('Data Directory:'); + DataDirPage.Values[0] := ExpandConstant('{commonappdata}\LOGAR-Server'); +end; + +function GetDataDir(Param: String): String; +begin + Result := DataDirPage.Values[0]; + if Result = '' then + Result := ExpandConstant('{commonappdata}\LOGAR-Server'); +end; + +procedure CurStepChanged(CurStep: TSetupStep); +begin + if CurStep = ssPostInstall then + begin + RegWriteStringValue(HKEY_LOCAL_MACHINE, 'Software\LOGAR\LOGAR-Server', 'DataDir', GetDataDir('')); + end; +end; + +procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep); +var + CustomDataDir: String; +begin + if CurUninstallStep = usPostUninstall then + begin + if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'Software\LOGAR\LOGAR-Server', 'DataDir', CustomDataDir) then + begin + if (CustomDataDir <> '') and DirExists(CustomDataDir) then + DelTree(CustomDataDir, True, True, True); + RegDeleteKeyIncludingSubkeys(HKEY_LOCAL_MACHINE, 'Software\LOGAR\LOGAR-Server'); + end; + end; +end; diff --git a/compilation/installer_server.nsi b/compilation/installer_server.nsi index 6ae3201..f0c825e 100644 --- a/compilation/installer_server.nsi +++ b/compilation/installer_server.nsi @@ -1,20 +1,64 @@ !include "MUI2.nsh" +!include "LogicLib.nsh" Name "LOGAR Server" OutFile "../dist/LOGAR-Server-Setup.exe" InstallDir "$PROGRAMFILES64\LOGAR-Server" RequestExecutionLevel admin +BrandingText "LOGAR Enterprise SIEM & Log Ingestion" + +VIProductVersion "0.3.1.0" +VIAddVersionKey "ProductName" "LOGAR Server" +VIAddVersionKey "CompanyName" "LOGAR Security Systems" +VIAddVersionKey "LegalCopyright" "© 2026 LOGAR Security Systems" +VIAddVersionKey "FileDescription" "LOGAR Cloud Hub & TCP Ingestion Server Setup" +VIAddVersionKey "FileVersion" "0.3.1.0" +VIAddVersionKey "ProductVersion" "0.3.1.0" + +Var DATADIR + +# --- UI Pages --- +!define MUI_ABORTWARNING + +# Welcome Page +!define MUI_WELCOMEPAGE_TITLE "Welcome to LOGAR Server Setup" +!define MUI_WELCOMEPAGE_TEXT "LOGAR provides high-performance encrypted log ingestion, temporal analysis, and mTLS client enrollment.\r\n\r\nThis wizard will guide you through installing LOGAR Server and configuring it as an automated Windows service." !insertmacro MUI_PAGE_WELCOME + +# Directory Page 1: Installation Directory +!define MUI_PAGE_HEADER_TEXT "Choose Installation Location" +!define MUI_PAGE_HEADER_SUBTEXT "Choose the folder in which to install program binaries." +!define MUI_DIRECTORYPAGE_VARIABLE $INSTDIR !insertmacro MUI_PAGE_DIRECTORY + +# Directory Page 2: Data Directory +!define MUI_PAGE_HEADER_TEXT "Choose Data & Storage Location" +!define MUI_PAGE_HEADER_SUBTEXT "Choose where database, certificates, and configuration files should be stored." +!define MUI_DIRECTORYPAGE_TEXT_TOP "Choose the folder where LOGAR Server should store its database (logar_state.db), configuration (server_config.json), and mTLS certificates.$\r$\n$\r$\nDefault is recommended for automatic background service access." +!define MUI_DIRECTORYPAGE_TEXT_DESTINATION "Data & Storage Folder" +!define MUI_DIRECTORYPAGE_VARIABLE $DATADIR +!insertmacro MUI_PAGE_DIRECTORY + +# Instfiles Page !insertmacro MUI_PAGE_INSTFILES + +# Finish Page +!define MUI_FINISHPAGE_TITLE "Installation Complete" +!define MUI_FINISHPAGE_TEXT "LOGAR Server has been successfully installed and started as a background Windows service.\r\n\r\nWeb Hub Dashboard: http://localhost:8443\r\nTCP Ingestion Port: 9443" !insertmacro MUI_PAGE_FINISH +# Uninstaller Pages !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES !insertmacro MUI_LANGUAGE "English" +Function .onInit + SetShellVarContext all + StrCpy $DATADIR "$APPDATA\LOGAR-Server" +FunctionEnd + Section "Install" SetShellVarContext all SetOutPath "$INSTDIR" @@ -22,21 +66,28 @@ Section "Install" File "../compilation/nssm.exe" File /r "../dist/runtime" - CreateDirectory "$APPDATA\LOGAR-Server" - ExecWait 'icacls "$APPDATA\LOGAR-Server" /grant "*S-1-5-32-545:(OI)(CI)M" /T /Q' + CreateDirectory "$DATADIR" + ExecWait 'icacls "$DATADIR" /grant "*S-1-5-32-545:(OI)(CI)M" /T /Q' # Install and configure service via NSSM ExecWait '"$INSTDIR\nssm.exe" install LOGAR_Server "$INSTDIR\Server.exe"' ExecWait '"$INSTDIR\nssm.exe" set LOGAR_Server AppDirectory "$INSTDIR"' - ExecWait '"$INSTDIR\nssm.exe" set LOGAR_Server AppStdout "$APPDATA\LOGAR-Server\server.log"' - ExecWait '"$INSTDIR\nssm.exe" set LOGAR_Server AppStderr "$APPDATA\LOGAR-Server\server_err.log"' + ExecWait '"$INSTDIR\nssm.exe" set LOGAR_Server AppStdout "$DATADIR\server.log"' + ExecWait '"$INSTDIR\nssm.exe" set LOGAR_Server AppStderr "$DATADIR\server_err.log"' + ExecWait '"$INSTDIR\nssm.exe" set LOGAR_Server AppParameters "--config \"$DATADIR\server_config.json\""' ExecWait '"$INSTDIR\nssm.exe" start LOGAR_Server' WriteUninstaller "$INSTDIR\uninstall.exe" + WriteRegStr HKLM "Software\LOGAR\LOGAR-Server" "DataDir" "$DATADIR" SectionEnd Section "Uninstall" SetShellVarContext all + ReadRegStr $DATADIR HKLM "Software\LOGAR\LOGAR-Server" "DataDir" + ${If} $DATADIR == "" + StrCpy $DATADIR "$APPDATA\LOGAR-Server" + ${EndIf} + ExecWait '"$INSTDIR\nssm.exe" stop LOGAR_Server' ExecWait '"$INSTDIR\nssm.exe" remove LOGAR_Server confirm' RMDir /r "$INSTDIR\runtime" @@ -49,5 +100,6 @@ Section "Uninstall" Delete "$INSTDIR\nssm.exe" Delete "$INSTDIR\uninstall.exe" RMDir /r "$INSTDIR" - RMDir /r "$APPDATA\LOGAR-Server" + RMDir /r "$DATADIR" + DeleteRegKey HKLM "Software\LOGAR\LOGAR-Server" SectionEnd