diff --git a/Vester/Tests/Host/Net-TSOIPv4.Vester.ps1 b/Vester/Tests/Host/Net-TSOIPv4.Vester.ps1 new file mode 100644 index 0000000..5512ce8 --- /dev/null +++ b/Vester/Tests/Host/Net-TSOIPv4.Vester.ps1 @@ -0,0 +1,30 @@ +# Test file for the Vester module - https://github.com/WahlNetwork/Vester +# Called via Invoke-Pester VesterTemplate.Tests.ps1 + +# Test title, e.g. 'DNS Servers' +$Title = 'TCP Segmentation Offload (IPv4)' + +# Test description: How New-VesterConfig explains this value to the user +$Description = 'Enable (1) or Disable (0) TCP Segmentation Offload for IPv4' + +# The config entry stating the desired values +$Desired = $cfg.host.netusehwtso + +# The test value's data type, to help with conversion: bool/string/int +$Type = 'int' + +# The command(s) to pull the actual value for comparison +# $Object will scope to the folder this test is in (Cluster, Host, etc.) +[ScriptBlock]$Actual = { + (Get-AdvancedSetting -Entity $Object | Where-Object -FilterScript { + $_.Name -eq 'Net.UseHwTSO' + }).Value +} + +# The command(s) to match the environment to the config +# Use $Object to help filter, and $Desired to set the correct value +[ScriptBlock]$Fix = { + Get-AdvancedSetting -Entity $Object | Where-Object -FilterScript { + $_.Name -eq 'Net.UseHwTSO' + } | Set-AdvancedSetting -Value $Desired -Confirm:$false -ErrorAction Stop +} diff --git a/Vester/Tests/Host/Net-TSOIPv6.Vester.ps1 b/Vester/Tests/Host/Net-TSOIPv6.Vester.ps1 new file mode 100644 index 0000000..508c3bd --- /dev/null +++ b/Vester/Tests/Host/Net-TSOIPv6.Vester.ps1 @@ -0,0 +1,30 @@ +# Test file for the Vester module - https://github.com/WahlNetwork/Vester +# Called via Invoke-Pester VesterTemplate.Tests.ps1 + +# Test title, e.g. 'DNS Servers' +$Title = 'TCP Segmentation Offload (IPv6)' + +# Test description: How New-VesterConfig explains this value to the user +$Description = 'Enable (1) or Disable (0) TCP Segmentation Offload for IPv6' + +# The config entry stating the desired values +$Desired = $cfg.host.netusehwtso6 + +# The test value's data type, to help with conversion: bool/string/int +$Type = 'int' + +# The command(s) to pull the actual value for comparison +# $Object will scope to the folder this test is in (Cluster, Host, etc.) +[ScriptBlock]$Actual = { + (Get-AdvancedSetting -Entity $Object | Where-Object -FilterScript { + $_.Name -eq 'Net.UseHwTSO6' + }).Value +} + +# The command(s) to match the environment to the config +# Use $Object to help filter, and $Desired to set the correct value +[ScriptBlock]$Fix = { + Get-AdvancedSetting -Entity $Object | Where-Object -FilterScript { + $_.Name -eq 'Net.UseHwTSO6' + } | Set-AdvancedSetting -Value $Desired -Confirm:$false -ErrorAction Stop +} diff --git a/Vester/Tests/Host/TLS-Protocols.Vester.ps1 b/Vester/Tests/Host/TLS-Protocols.Vester.ps1 new file mode 100644 index 0000000..d0caaca --- /dev/null +++ b/Vester/Tests/Host/TLS-Protocols.Vester.ps1 @@ -0,0 +1,32 @@ +# Test file for the Vester module - https://github.com/WahlNetwork/Vester +# Called via Invoke-Pester VesterTemplate.Tests.ps1 +# vSphere 6.5 Hardening Guide Guideline ID - ESXi.Disable-oldtls-protocols +# Recommended Setting: "sslv3,tlsv1,tlsv1.1" + +# Test title, e.g. 'DNS Servers' +$Title = 'Legacy TLS Protocols' + +# Test description: How New-VesterConfig explains this value to the user +$Description = 'Disables legacy TLS protocols (Defaults to SSLv3)' + +# The config entry stating the desired values +$Desired = $cfg.host.TLSProtocols + +# The test value's data type, to help with conversion: bool/string/int +$Type = 'string' + +# The command(s) to pull the actual value for comparison +# $Object will scope to the folder this test is in (Cluster, Host, etc.) +[ScriptBlock]$Actual = { + (Get-AdvancedSetting -Entity $Object | Where-Object -FilterScript { + $_.Name -eq 'UserVars.ESXiVPsDisabledProtocols' + }).Value +} + +# The command(s) to match the environment to the config +# Use $Object to help filter, and $Desired to set the correct value +[ScriptBlock]$Fix = { + Get-AdvancedSetting -Entity $Object | Where-Object -FilterScript { + $_.Name -eq 'UserVars.ESXiVPsDisabledProtocols' + } | Set-AdvancedSetting -Value $Desired -Confirm:$false -ErrorAction Stop +} \ No newline at end of file diff --git a/Vester/Tests/Host/VSAN-ClomRebalanceThreshold.Vester.ps1 b/Vester/Tests/Host/VSAN-ClomRebalanceThreshold.Vester.ps1 new file mode 100644 index 0000000..d8d7364 --- /dev/null +++ b/Vester/Tests/Host/VSAN-ClomRebalanceThreshold.Vester.ps1 @@ -0,0 +1,30 @@ +# Test file for the Vester module - https://github.com/WahlNetwork/Vester +# Called via Invoke-Pester VesterTemplate.Tests.ps1 + +# Test title, e.g. 'DNS Servers' +$Title = 'VSAN Component Rebalance Threshold' + +# Test description: How New-VesterConfig explains this value to the user +$Description = 'Percentage disk fullness after which rebalancing is triggered' + +# The config entry stating the desired values +$Desired = $cfg.host.vsanclomrebalancethreshold + +# The test value's data type, to help with conversion: bool/string/int +$Type = 'int' + +# The command(s) to pull the actual value for comparison +# $Object will scope to the folder this test is in (Cluster, Host, etc.) +[ScriptBlock]$Actual = { + (Get-AdvancedSetting -Entity $Object | Where-Object -FilterScript { + $_.Name -eq 'VSAN.ClomRebalanceThreshold' + }).Value +} + +# The command(s) to match the environment to the config +# Use $Object to help filter, and $Desired to set the correct value +[ScriptBlock]$Fix = { + Get-AdvancedSetting -Entity $Object | Where-Object -FilterScript { + $_.Name -eq 'VSAN.ClomRebalanceThreshold' + } | Set-AdvancedSetting -Value $Desired -Confirm:$false -ErrorAction Stop +} diff --git a/Vester/Tests/Host/VSAN-ClomRepairDelay.Vester.ps1 b/Vester/Tests/Host/VSAN-ClomRepairDelay.Vester.ps1 new file mode 100644 index 0000000..78d71ac --- /dev/null +++ b/Vester/Tests/Host/VSAN-ClomRepairDelay.Vester.ps1 @@ -0,0 +1,30 @@ +# Test file for the Vester module - https://github.com/WahlNetwork/Vester +# Called via Invoke-Pester VesterTemplate.Tests.ps1 + +# Test title, e.g. 'DNS Servers' +$Title = 'VSAN Component Repair Delay' + +# Test description: How New-VesterConfig explains this value to the user +$Description = 'Minutes to wait for absent components to come back before starting repair' + +# The config entry stating the desired values +$Desired = $cfg.host.vsanclomrepairdelay + +# The test value's data type, to help with conversion: bool/string/int +$Type = 'int' + +# The command(s) to pull the actual value for comparison +# $Object will scope to the folder this test is in (Cluster, Host, etc.) +[ScriptBlock]$Actual = { + (Get-AdvancedSetting -Entity $Object | Where-Object -FilterScript { + $_.Name -eq 'VSAN.ClomRepairDelay' + }).Value +} + +# The command(s) to match the environment to the config +# Use $Object to help filter, and $Desired to set the correct value +[ScriptBlock]$Fix = { + Get-AdvancedSetting -Entity $Object | Where-Object -FilterScript { + $_.Name -eq 'VSAN.ClomRepairDelay' + } | Set-AdvancedSetting -Value $Desired -Confirm:$false -ErrorAction Stop +} diff --git a/Vester/Tests/Host/VSAN-SwapThickProvisionDisabled.Vester.ps1 b/Vester/Tests/Host/VSAN-SwapThickProvisionDisabled.Vester.ps1 new file mode 100644 index 0000000..cf7402d --- /dev/null +++ b/Vester/Tests/Host/VSAN-SwapThickProvisionDisabled.Vester.ps1 @@ -0,0 +1,27 @@ +# Test file for the Vester module - https://github.com/WahlNetwork/Vester +# Called via Invoke-Pester VesterTemplate.Tests.ps1 +# vSphere 6.0 Hardening Guide Guideline ID - ESXi.TransparentPageSharing-intra-enabled + +# Test title, e.g. 'DNS Servers' +$Title = 'vSAN Swap Thick Provision Disabled' + +# Test description: How New-VesterConfig explains this value to the user +$Description = '1 (Create Thin vSwap Files), 0 (Create Traditional Thick vSwap Files) ... helps save capacity in VSAN when you do not plan to overprovision on memory in the cluster' + +# The config entry stating the desired values +$Desired = $cfg.host.VSANSwapThickProvisionDisabled + +# The test value's data type, to help with conversion: bool/string/int +$Type = 'int' + +# The command(s) to pull the actual value for comparison +# $Object will scope to the folder this test is in (Cluster, Host, etc.) +[ScriptBlock]$Actual = { + (Get-AdvancedSetting -Entity $Object -Name "VSAN.SwapThickProvisionDisabled").Value +} + +# The command(s) to match the environment to the config +# Use $Object to help filter, and $Desired to set the correct value +[ScriptBlock]$Fix = { + Get-AdvancedSetting -Entity $Object -Name "VSAN.SwapThickProvisionDisabled" | Set-AdvancedSetting -Value $Desired -Confirm:$false -ErrorAction Stop +}