fix: 6.2.3 aligned with test-template
This commit is contained in:
@@ -1,24 +1,35 @@
|
|||||||
function Test-IdentifyExternalEmail {
|
function Test-IdentifyExternalEmail {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param (
|
param (
|
||||||
|
# Aligned
|
||||||
# Parameters can be defined here if needed
|
# Parameters can be defined here if needed
|
||||||
)
|
)
|
||||||
|
|
||||||
begin {
|
begin {
|
||||||
# Dot source the class script
|
# Dot source the class script if necessary
|
||||||
|
#. .\source\Classes\CISAuditResult.ps1
|
||||||
|
|
||||||
$auditResults = @()
|
# Initialization code, if needed
|
||||||
}
|
}
|
||||||
|
|
||||||
process {
|
process {
|
||||||
# 6.2.3 (L1) Ensure email from external senders is identified
|
# 6.2.3 (L1) Ensure email from external senders is identified
|
||||||
# Requirement is to have external sender tagging enabled
|
|
||||||
# Review
|
|
||||||
|
|
||||||
|
# Retrieve external sender tagging configuration
|
||||||
$externalInOutlook = Get-ExternalInOutlook
|
$externalInOutlook = Get-ExternalInOutlook
|
||||||
$externalTaggingEnabled = ($externalInOutlook | ForEach-Object { $_.Enabled }) -contains $true
|
$externalTaggingEnabled = ($externalInOutlook | ForEach-Object { $_.Enabled }) -contains $true
|
||||||
|
|
||||||
# Create an instance of CISAuditResult and populate it
|
# Prepare failure reasons and details based on compliance
|
||||||
|
$failureReasons = if (-not $externalTaggingEnabled) {
|
||||||
|
"External sender tagging is disabled"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
"N/A"
|
||||||
|
}
|
||||||
|
|
||||||
|
$details = "Enabled: $($externalTaggingEnabled); AllowList: $($externalInOutlook.AllowList)"
|
||||||
|
|
||||||
|
# Create and populate the CISAuditResult object
|
||||||
$auditResult = [CISAuditResult]::new()
|
$auditResult = [CISAuditResult]::new()
|
||||||
$auditResult.Status = if ($externalTaggingEnabled) { "Pass" } else { "Fail" }
|
$auditResult.Status = if ($externalTaggingEnabled) { "Pass" } else { "Fail" }
|
||||||
$auditResult.ELevel = "E3"
|
$auditResult.ELevel = "E3"
|
||||||
@@ -26,20 +37,18 @@ function Test-IdentifyExternalEmail {
|
|||||||
$auditResult.Rec = "6.2.3"
|
$auditResult.Rec = "6.2.3"
|
||||||
$auditResult.RecDescription = "Ensure email from external senders is identified"
|
$auditResult.RecDescription = "Ensure email from external senders is identified"
|
||||||
$auditResult.CISControlVer = "v8"
|
$auditResult.CISControlVer = "v8"
|
||||||
$auditResult.CISControl = "0.0"
|
$auditResult.CISControl = "0.0" # Explicitly Not Mapped
|
||||||
$auditResult.CISDescription = "Explicitly Not Mapped"
|
$auditResult.CISDescription = "Explicitly Not Mapped"
|
||||||
$auditResult.IG1 = $false
|
$auditResult.IG1 = $false
|
||||||
$auditResult.IG2 = $false
|
$auditResult.IG2 = $false
|
||||||
$auditResult.IG3 = $false
|
$auditResult.IG3 = $false
|
||||||
$auditResult.Result = $externalTaggingEnabled
|
$auditResult.Result = $externalTaggingEnabled
|
||||||
$auditResult.Details = "Enabled: $($externalTaggingEnabled); AllowList: $($externalInOutlook.AllowList)"
|
$auditResult.Details = $details
|
||||||
$auditResult.FailureReason = if (-not $externalTaggingEnabled) { "External sender tagging is disabled" } else { "N/A" }
|
$auditResult.FailureReason = $failureReasons
|
||||||
|
|
||||||
$auditResults += $auditResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
end {
|
end {
|
||||||
# Return auditResults
|
# Return the audit result
|
||||||
return $auditResults
|
return $auditResult
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user