diff --git a/images/win/Windows2016-Azure.json b/images/win/Windows2016-Azure.json index 349591cd..69081492 100644 --- a/images/win/Windows2016-Azure.json +++ b/images/win/Windows2016-Azure.json @@ -694,12 +694,6 @@ "{{ template_dir }}/scripts/Installers/Validate-AzureModules.ps1" ] }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-DotnetTLS.ps1" - ] - }, { "type": "powershell", "scripts":[ diff --git a/images/win/Windows2019-Azure.json b/images/win/Windows2019-Azure.json index 94a9a937..61c2bd06 100644 --- a/images/win/Windows2019-Azure.json +++ b/images/win/Windows2019-Azure.json @@ -693,12 +693,6 @@ "{{ template_dir }}/scripts/Installers/Validate-AzureModules.ps1" ] }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-DotnetTLS.ps1" - ] - }, { "type": "powershell", "scripts":[ diff --git a/images/win/scripts/Installers/Update-DotnetTLS.ps1 b/images/win/scripts/Installers/Update-DotnetTLS.ps1 index f07e3ca0..b854e660 100644 --- a/images/win/scripts/Installers/Update-DotnetTLS.ps1 +++ b/images/win/scripts/Installers/Update-DotnetTLS.ps1 @@ -13,6 +13,7 @@ if(Test-Path $registryPath){ $registryPath = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319" if(Test-Path $registryPath){ Set-ItemProperty -Path $registryPath -Name $name -Value $value -Type DWORD -} +} +Invoke-PesterTests -TestFile "Tools" -TestName "DotnetTLS" diff --git a/images/win/scripts/Installers/Validate-DotnetTLS.ps1 b/images/win/scripts/Installers/Validate-DotnetTLS.ps1 deleted file mode 100644 index 0d17c7b0..00000000 --- a/images/win/scripts/Installers/Validate-DotnetTLS.ps1 +++ /dev/null @@ -1,18 +0,0 @@ -################################################################################ -## File: Validate-DotnetTLS.ps1 -## Desc: Validate DotNetFramework security protocol to TLS 1.2 -################################################################################ - -$protocols = [Net.ServicePointManager]::SecurityProtocol -$protocolArr = $protocols -split ', ' -if ($protocolArr.Contains('Tls12')) -{ - Write-Host 'Tls 1.2 has been enabled.' -} -else -{ - Write-Host 'Tls 1.2 has not been enabled.' - exit 1 -} - - diff --git a/images/win/scripts/Tests/Tools.Tests.ps1 b/images/win/scripts/Tests/Tools.Tests.ps1 index 6ddbcb21..848e82ea 100644 --- a/images/win/scripts/Tests/Tools.Tests.ps1 +++ b/images/win/scripts/Tests/Tools.Tests.ps1 @@ -14,4 +14,12 @@ Describe "Kind" { It "Kind" { "kind version" | Should -ReturnZeroExitCode } +} + +Describe "DotnetTLS" { + It "Tls 1.2 is enabled" { + $protocols = [Net.ServicePointManager]::SecurityProtocol + $protocolArr = $protocols -split ', ' + $protocolArr.Contains('Tls12') | Should -BeTrue + } } \ No newline at end of file