Merge pull request #1226 from vsafonkin/v-vlsafo/add-dotnettls-pester

Add Pester test for Dotnet TLS
This commit is contained in:
Maxim Lobanov
2020-07-15 16:33:19 +03:00
committed by GitHub
5 changed files with 8 additions and 31 deletions

View File

@@ -694,12 +694,6 @@
"{{ template_dir }}/scripts/Installers/Validate-AzureModules.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-DotnetTLS.ps1"
]
},
{
"type": "powershell",
"scripts":[

View File

@@ -693,12 +693,6 @@
"{{ template_dir }}/scripts/Installers/Validate-AzureModules.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-DotnetTLS.ps1"
]
},
{
"type": "powershell",
"scripts":[

View File

@@ -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"

View File

@@ -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
}

View File

@@ -16,6 +16,12 @@ Describe "Kind" {
}
}
Describe "DotnetTLS" {
It "Tls 1.2 is enabled" {
[Net.ServicePointManager]::SecurityProtocol -band "Tls12" | Should -Be Tls12
}
}
Describe "Jq" {
It "Jq" {
"jq -n ." | Should -ReturnZeroExitCode