Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

Vester test changes #171

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
30 changes: 30 additions & 0 deletions Vester/Tests/Host/Net-TSOIPv4.Vester.ps1
Original file line number Diff line number Diff line change
@@ -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
}
30 changes: 30 additions & 0 deletions Vester/Tests/Host/Net-TSOIPv6.Vester.ps1
Original file line number Diff line number Diff line change
@@ -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
}
32 changes: 32 additions & 0 deletions Vester/Tests/Host/TLS-Protocols.Vester.ps1
Original file line number Diff line number Diff line change
@@ -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
}
30 changes: 30 additions & 0 deletions Vester/Tests/Host/VSAN-ClomRebalanceThreshold.Vester.ps1
Original file line number Diff line number Diff line change
@@ -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
}
30 changes: 30 additions & 0 deletions Vester/Tests/Host/VSAN-ClomRepairDelay.Vester.ps1
Original file line number Diff line number Diff line change
@@ -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
}
27 changes: 27 additions & 0 deletions Vester/Tests/Host/VSAN-SwapThickProvisionDisabled.Vester.ps1
Original file line number Diff line number Diff line change
@@ -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
}