fix: 6.5.3 aligned with test-template
This commit is contained in:
@@ -1,48 +1,63 @@
|
|||||||
function Test-RestrictStorageProvidersOutlook {
|
function Test-RestrictStorageProvidersOutlook {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param (
|
param (
|
||||||
|
# Aligned
|
||||||
# Parameters can be added here if needed
|
# Parameters can be added here if needed
|
||||||
)
|
)
|
||||||
|
|
||||||
begin {
|
begin {
|
||||||
# Dot source the class script
|
# Dot source the class script if necessary
|
||||||
|
#. .\source\Classes\CISAuditResult.ps1
|
||||||
$auditResult = [CISAuditResult]::new()
|
# Initialization code, if needed
|
||||||
}
|
}
|
||||||
|
|
||||||
process {
|
process {
|
||||||
# 6.5.3 (L2) Ensure additional storage providers are restricted in Outlook on the web
|
# 6.5.3 (L2) Ensure additional storage providers are restricted in Outlook on the web
|
||||||
$owaPolicies = Get-OwaMailboxPolicy
|
|
||||||
$allPoliciesRestricted = $owaPolicies | ForEach-Object { $_.AdditionalStorageProvidersAvailable } | ForEach-Object { -not $_ }
|
|
||||||
|
|
||||||
# Create an instance of CISAuditResult and populate it
|
# Retrieve all OwaMailbox policies
|
||||||
|
$owaPolicies = Get-OwaMailboxPolicy
|
||||||
|
$nonCompliantPolicies = $owaPolicies | Where-Object { $_.AdditionalStorageProvidersAvailable }
|
||||||
|
|
||||||
|
# Determine compliance
|
||||||
|
$allPoliciesRestricted = $nonCompliantPolicies.Count -eq 0
|
||||||
|
|
||||||
|
# Prepare failure reasons and details based on compliance
|
||||||
|
$failureReasons = if ($allPoliciesRestricted) {
|
||||||
|
"N/A"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
"One or more OwaMailbox policies allow AdditionalStorageProvidersAvailable."
|
||||||
|
}
|
||||||
|
|
||||||
|
$details = if ($allPoliciesRestricted) {
|
||||||
|
"All OwaMailbox policies restrict AdditionalStorageProvidersAvailable"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
"Non-compliant OwaMailbox policies: $($nonCompliantPolicies.Name -join ', ')"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Create and populate the CISAuditResult object
|
||||||
|
$auditResult = [CISAuditResult]::new()
|
||||||
|
$auditResult.Status = if ($allPoliciesRestricted) { "Pass" } else { "Fail" }
|
||||||
|
$auditResult.ELevel = "E3" # Based on your environment
|
||||||
|
$auditResult.ProfileLevel = "L2"
|
||||||
|
$auditResult.Rec = "6.5.3"
|
||||||
|
$auditResult.RecDescription = "Ensure additional storage providers are restricted in Outlook on the web"
|
||||||
$auditResult.CISControlVer = "v8"
|
$auditResult.CISControlVer = "v8"
|
||||||
$auditResult.CISControl = "3.3"
|
$auditResult.CISControl = "3.3"
|
||||||
$auditResult.CISDescription = "Configure Data Access Control Lists"
|
$auditResult.CISDescription = "Configure Data Access Control Lists"
|
||||||
$auditResult.Rec = "6.5.3"
|
|
||||||
$auditResult.ELevel = "E3" # Based on your environment
|
|
||||||
$auditResult.ProfileLevel = "L2"
|
|
||||||
$auditResult.IG1 = $true
|
$auditResult.IG1 = $true
|
||||||
$auditResult.IG2 = $true
|
$auditResult.IG2 = $true
|
||||||
$auditResult.IG3 = $true
|
$auditResult.IG3 = $true
|
||||||
$auditResult.RecDescription = "Ensure additional storage providers are restricted in Outlook on the web"
|
|
||||||
$auditResult.Result = $allPoliciesRestricted
|
$auditResult.Result = $allPoliciesRestricted
|
||||||
$auditResult.Details = if($allPoliciesRestricted) {
|
$auditResult.Details = $details
|
||||||
"All OwaMailbox policies restrict AdditionalStorageProvidersAvailable"
|
$auditResult.FailureReason = $failureReasons
|
||||||
} else {
|
|
||||||
$nonCompliantPolicies = $owaPolicies | Where-Object { $_.AdditionalStorageProvidersAvailable } | Select-Object -ExpandProperty Name
|
|
||||||
"Non-compliant OwaMailbox policies: $($nonCompliantPolicies -join ', ')"
|
|
||||||
}
|
|
||||||
$auditResult.FailureReason = if(-not $allPoliciesRestricted) { "One or more OwaMailbox policies allow AdditionalStorageProvidersAvailable." } else { "N/A" }
|
|
||||||
$auditResult.Status = if($allPoliciesRestricted) { "Pass" } else { "Fail" }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
end {
|
end {
|
||||||
# Return auditResult
|
# Return the audit result
|
||||||
return $auditResult
|
return $auditResult
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Additional helper functions (if any)
|
# Additional helper functions (if any)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user