From c8b06e86b0f83a9a4fc3c79fd6d07ae8dc03323e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Sat, 20 Apr 2024 23:29:38 +0200 Subject: [PATCH] installer: Disable Windows Firewall Exception by default. Can be re-enabled with ADD_FIREWALL_EXCEPTION=yes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jan-Otto Kröpke --- .editorconfig | 6 ++++++ .gitignore | 2 ++ README.md | 11 +++++++++-- installer/build.ps1 | 2 +- installer/windows_exporter.wxs | 24 +++++++++++++++++------- 5 files changed, 35 insertions(+), 10 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..77b61139 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,6 @@ +root = true + +[*.wxs] + +indent_style = space +indent_size = 2 \ No newline at end of file diff --git a/.gitignore b/.gitignore index e8af3c55..b225252a 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ output/ .vscode .idea *.syso +installer/*.msi +installer/*.wixpdb \ No newline at end of file diff --git a/README.md b/README.md index 54bddd77..879f3057 100644 --- a/README.md +++ b/README.md @@ -121,11 +121,19 @@ Example service collector with a custom query. msiexec /i ENABLED_COLLECTORS=os,service --% EXTRA_FLAGS="--collector.service.services-where ""Name LIKE 'sql%'""" ``` -On some older versions of Windows you may need to surround parameter values with double quotes to get the install command parsing properly: +On some older versions of Windows, +you may need to surround parameter values with double quotes to get the installation command parsing properly: ```powershell msiexec /i C:\Users\Administrator\Downloads\windows_exporter.msi ENABLED_COLLECTORS="ad,iis,logon,memory,process,tcp,textfile,thermalzone" TEXTFILE_DIRS="C:\custom_metrics\" ``` +To install the exporter with creating a firewall exception, use the following command: + +```powershell +msiexec /i ADD_FIREWALL_EXCEPTION=yes +``` + + Powershell versions 7.3 and above require [PSNativeCommandArgumentPassing](https://learn.microsoft.com/en-us/powershell/scripting/learn/experimental-features?view=powershell-7.3) to be set to `Legacy` when using `--% EXTRA_FLAGS`: ```powershell @@ -133,7 +141,6 @@ $PSNativeCommandArgumentPassing = 'Legacy' msiexec /i ENABLED_COLLECTORS=os,service --% EXTRA_FLAGS="--collector.service.services-where ""Name LIKE 'sql%'""" ``` - ## Kubernetes Implementation See detailed steps to install on Windows Kubernetes [here](./kubernetes/kubernetes.md). diff --git a/installer/build.ps1 b/installer/build.ps1 index 1c2bd769..62606a49 100644 --- a/installer/build.ps1 +++ b/installer/build.ps1 @@ -24,7 +24,7 @@ Copy-Item -Force $PathToExecutable Work/windows_exporter.exe Write-Verbose "Creating windows_exporter-${Version}-${Arch}.msi" $wixArch = @{"amd64" = "x64"; "arm64" = "arm64"}[$Arch] -$wixOpts = "-ext WixFirewallExtension -ext WixUtilExtension" + Invoke-Expression "wix build -arch $wixArch -o .\windows_exporter-$($Version)-$($Arch).msi .\windows_exporter.wxs -d Version=$($Version) -ext WixToolset.Firewall.wixext -ext WixToolset.Util.wixext" Write-Verbose "Done!" diff --git a/installer/windows_exporter.wxs b/installer/windows_exporter.wxs index bf52f61f..1db05f66 100644 --- a/installer/windows_exporter.wxs +++ b/installer/windows_exporter.wxs @@ -15,6 +15,9 @@ + + + @@ -49,11 +52,7 @@ - - - - - + @@ -64,15 +63,26 @@ + + + + + + + - + + + + + - +