Skip to content

[ps-installation-script] better error message in case of failed instrumentation installer download #6165

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion packaging/installer/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,17 @@ if ($with_dotnet_instrumentation) {
$download = "https://github.com/signalfx/splunk-otel-dotnet/releases/latest/download/$module_name"
$dotnet_autoinstr_path = Join-Path $tempdir $module_name
echo "Downloading .NET Instrumentation installer ..."
Invoke-WebRequest -Uri $download -OutFile $dotnet_autoinstr_path -UseBasicParsing
try {
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should include tls13?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should do the trick, may need to add comment that 3072 is TLS 1.2 and 12288 is TLS 1.3
[Net.ServicePointManager]::SecurityProtocol = 3072 -bor 12288

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I considered that but decided it'd be preferable to:

  • set it consistently in the script (as similar is configured in multiplace places already)
  • use enum values instead of magic numbers e.g.
    [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 -bor [Net.SecurityProtocolType]::Tls13

Copy link

@RassK RassK Apr 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to separate it to a new issue then, if there are multiple places. The idea is not to require older security protocols but instead use newest as possible and fallback if not possible.

[Net.SecurityProtocolType]::Tls13 is available in .NET FX 4.8+. I think PowerShell 5.1 what we require (min) is still at 4.5. So the enum value is not available there.

Invoke-WebRequest -Uri $download -OutFile $dotnet_autoinstr_path -UseBasicParsing
} catch {
$err = $_.Exception.Message
$message = "
An error occured when trying to download .NET Instrumentation installer from $download. This may be due to a network connectivity issue.
$err
"
throw "$message"
}
Import-Module $dotnet_autoinstr_path
} else {
$dotnet_autoinstr_path = $dotnet_psm1_path
Expand Down