From a8a65b850c7a5991da43d5eee897632cafe07275 Mon Sep 17 00:00:00 2001 From: Jared Goodwin Date: Thu, 27 Jun 2024 15:20:15 -0700 Subject: [PATCH] Add SecurityProtocols >= Tls12. --- Server/wwwroot/Content/Install-Remotely.ps1 | 22 +++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/Server/wwwroot/Content/Install-Remotely.ps1 b/Server/wwwroot/Content/Install-Remotely.ps1 index 940fb5091..b82f688d3 100644 --- a/Server/wwwroot/Content/Install-Remotely.ps1 +++ b/Server/wwwroot/Content/Install-Remotely.ps1 @@ -18,7 +18,18 @@ param ( [switch]$Quiet ) -[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 +#region Set SecurityProtocol +# This will include all security protocols greater than or equal to TLS 1.2. +[System.Net.SecurityProtocolType]$SecurityProtocols = 0; +[System.Enum]::GetValues([System.Net.SecurityProtocolType]) | Where-Object { + $_ -ge [System.Net.SecurityProtocolType]::Tls12 +} | ForEach-Object { + $SecurityProtocols = $SecurityProtocols -bor $_ +} +[System.Net.ServicePointManager]::SecurityProtocol = $SecurityProtocols +#endregion + +#region Set Variables $LogPath = "$env:TEMP\Remotely_Install.txt" [string]$HostName = $null @@ -41,7 +52,9 @@ else { } $InstallPath = "$env:ProgramFiles\Remotely" +#endregion +#region Functions function Write-Log($Message) { if (!$Quiet) { Write-Host $Message @@ -185,6 +198,10 @@ function Install-Remotely { Start-Service -Name Remotely_Service } +#endregion + +#region Main + try { Run-StartupChecks @@ -205,6 +222,7 @@ try { } catch { Write-Log -Message "Error occurred: $($Error[0].InvocationInfo.PositionMessage)" - throw $Error[0] + throw $Error[0] Do-Exit } +#endregion \ No newline at end of file