Skip to content

Commit d962e41

Browse files
Merge pull request #973 from dataplat/instancecheckscontinued
Instancecheckscontinued more checks added #882
2 parents cffe0eb + 6d1ebe0 commit d962e41

File tree

6 files changed

+220
-171
lines changed

6 files changed

+220
-171
lines changed

containers/JessAndBeard.psm1

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2343,13 +2343,21 @@ The Tags are the same"
23432343
PassedChange = 0 # + or - the number of tests passed for v5
23442344
FailedChange = -12 # + or - the number of tests failed for v5
23452345
SkippedChange = 0 # + or - the number of tests skipped for v5
2346-
}
2346+
},
23472347
@{
23482348
Name = 'LinkedServerConnection'
23492349
RunChange = -3 # + or - the number of tests for v5
23502350
PassedChange = -3 # + or - the number of tests passed for v5
23512351
FailedChange = 0 # + or - the number of tests failed for v5
23522352
SkippedChange = 0 # + or - the number of tests skipped for v5
2353+
},
2354+
@{
2355+
Name = 'SupportedBuild'
2356+
RunChange = -3 # + or - the number of tests run for v5
2357+
PassedChange = -3 # + or - the number of tests passed for v5
2358+
FailedChange = 0 # + or - the number of tests failed for v5
2359+
SkippedChange = 0 # + or - the number of tests skipped for v5
2360+
23532361
}
23542362
)
23552363
$runchange = 0

developing/Robs-Instance.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ $Checks = 'HideInstance'
1414
$Checks = 'LoginAuditFailed'
1515
$Checks = 'LoginAuditSuccessful'
1616
$Checks = 'LoginCheckPolicy'
17+
$Checks = 'SuspectPageLimit'
18+
$Checks = 'SupportedBuild'
19+
$Checks = 'LoginMustChange'
1720
$Checks = 'LoginAuditSuccessful', 'LoginAuditFailed'
1821

1922
Invoke-PerfAndValidateCheck -Checks $Checks

source/checks/Instancev5.Tests.ps1

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,13 +220,31 @@ Describe "Successful Login Auditing" -Tag LoginAuditSuccessful, Security, CIS, M
220220

221221
Describe "Login Check Policy" -Tag LoginCheckPolicy, Security, CIS, Medium, Instance -ForEach $InstancesToTest {
222222
$skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.security.LoginCheckPolicy' }).Value
223-
Context "Testing if the CHECK_POLICY is enabled on all logins on $psitem" {
224-
It "All logins should have the CHECK_POLICY option set to ON on $psitem" -Skip:$skip {
223+
Context "Testing if the CHECK_POLICY is enabled on all logins on <_.Name>" {
224+
It "All logins should have the CHECK_POLICY option set to ON on <_.Name>" -Skip:$skip {
225225
($psitem.logins | Where-Object { $_.LoginType -eq 'SqlLogin' -and $_.PasswordPolicyEnforced -eq $false -and $_.IsDisabled -eq $false }).Count | Should -Be 0 -Because "We expected the CHECK_POLICY for the all logins to be enabled"
226226
}
227227
}
228228
}
229229

230+
Describe "Login Must Change" -Tag LoginMustChange, Security, CIS, Medium, Instance -ForEach $InstancesToTest {
231+
$skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.security.LoginMustChange' }).Value
232+
Context "Testing if the new SQL logins that have not logged have to change their password when they log in on <_.Name>" {
233+
It "All new sql logins should have the have to change their password when they log in for the first time on <_.Name>" -Skip:$skip {
234+
$PsItem.LoginMustChangeCount | Should -Be 0 -Because "We expected the all the new sql logins to have to change the password on first login"
235+
}
236+
}
237+
}
238+
239+
Describe "Login Password Expiration" -Tag LoginPasswordExpiration, Security, CIS, Medium, Instance -ForEach $InstancesToTest {
240+
$skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.security.LoginPasswordExpiration' }).Value
241+
Context "Testing if the login password expiration is enabled for sql logins in the sysadmin role on <_.Name>" {
242+
It "All sql logins should have the password expiration option set to ON in the sysadmin role on <_.Name>" -Skip:$skip {
243+
$PsItem.LoginPasswordExpirationCount | Should -Be 0 -Because "We expected the password expiration policy to set on all sql logins in the sysadmin role"
244+
}
245+
}
246+
}
247+
230248
Describe "Instance MaxDop" -Tag MaxDopInstance, MaxDop, Medium, Instance -ForEach ($InstancesToTest | Where-Object { $psitem.Name -notin $psitem.ConfigValues.ExcludeInstanceMaxDop }) {
231249
$skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.MaxDopInstance' }).Value
232250
Context "Testing Instance MaxDop Value on <_.Name>" {
@@ -375,6 +393,29 @@ Describe "SQL Mail XPs Disabled" -Tag SQLMailXPsDisabled, Security, CIS, Low, In
375393
}
376394
}
377395

396+
Describe "Supported Build" -Tag SupportedBuild, DISA, High, Instance -ForEach $InstancesToTest {
397+
$skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.SupportedBuild' }).Value
398+
Context "Checking that build is still supported by Microsoft for <_.Name>" -Skip:$skip {
399+
It "The build is not behind the latest build by more than <_.SupportedBuild.BuildBehind> for <_.Name>" {
400+
$psItem.SupportedBuild.Compliant | Should -BeTrue -Because "this build $($psItem.SupportedBuild.Build) should not be behind the required build"
401+
}
402+
It "The build is supported by Microsoft for <_.Name>" {
403+
$psItem.SupportedBuild.InsideMicrosoftSupport | Should -BeTrue -Because "this build $($psItem.SupportedBuild.Build) is now unsupported by Microsoft"
404+
}
405+
It "The build is supported by Microsoft within the warning window of <_.SupportedBuild.BuildWarning> months for <_.Name>" {
406+
$psItem.SupportedBuild.InsideBuildWarning | Should -BeTrue -Because "this build $($psItem.SupportedBuild.Build) will be unsupported by Microsoft on $($psItem.SupportedBuild.SupportedUntil) which is less than $($psItem.SupportedBuild.BuildWarning) months away"
407+
}
408+
}
409+
}
410+
411+
Describe "Suspect Page Limit Nearing" -Tag SuspectPageLimit, Medium, Instance -ForEach $InstancesToTest {
412+
$skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.suspectpagelimit' }).Value
413+
Context "Testing if the suspect_pages table is nearing the limit of 1000 rows on on <_.Name>" {
414+
It "The suspect_pages table in msdb shouldn't be nearing the limit of 1000 rows on on <_.Name>" -Skip:$skip {
415+
$PSItem.SuspectPageCountResult | Should -BeTrue -Because "The suspect_pages table in msdb shouldn't be nearing the limit of 1000 rows"
416+
}
417+
}
418+
}
378419
Describe "Trace Flags Expected" -Tag TraceFlagsExpected, TraceFlag, High, Instance -ForEach $InstancesToTest {
379420
$skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.TraceFlagsExpected' }).Value
380421
Context "Testing Expected Trace Flags on <_.Name>" {

0 commit comments

Comments
 (0)