fix: 2.1.9 simplified output and added object comment-release
This commit is contained in:
@@ -4,6 +4,7 @@ function Test-EnableDKIM {
|
|||||||
param (
|
param (
|
||||||
# Aligned
|
# Aligned
|
||||||
# Parameters can be added if needed
|
# Parameters can be added if needed
|
||||||
|
[string]$DomainName
|
||||||
)
|
)
|
||||||
|
|
||||||
begin {
|
begin {
|
||||||
@@ -37,9 +38,16 @@ function Test-EnableDKIM {
|
|||||||
|
|
||||||
# Retrieve DKIM configuration for all domains
|
# Retrieve DKIM configuration for all domains
|
||||||
$dkimConfig = Get-CISExoOutput -Rec $recnum
|
$dkimConfig = Get-CISExoOutput -Rec $recnum
|
||||||
|
if (-not $DomainName) {
|
||||||
$dkimResult = ($dkimConfig | ForEach-Object { $_.Enabled }) -notcontains $false
|
$dkimResult = ($dkimConfig | ForEach-Object { $_.Enabled }) -notcontains $false
|
||||||
$dkimFailedDomains = $dkimConfig | Where-Object { -not $_.Enabled } | ForEach-Object { $_.Domain }
|
$dkimFailedDomains = $dkimConfig | Where-Object { -not $_.Enabled } | ForEach-Object { $_.Domain }
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$dkimResult = ($dkimConfig | Where-Object { $_.Domain -eq $DomainName }).Enabled
|
||||||
|
if ($dkimResult -eq $false) {
|
||||||
|
$dkimFailedDomains = $dkimConfig | Where-Object { $_.Domain -eq $DomainName } | ForEach-Object { $_.Domain }
|
||||||
|
}
|
||||||
|
}
|
||||||
# Prepare failure reasons and details based on compliance
|
# Prepare failure reasons and details based on compliance
|
||||||
$failureReasons = if (-not $dkimResult) {
|
$failureReasons = if (-not $dkimResult) {
|
||||||
"DKIM is not enabled for some domains" # Condition A fail
|
"DKIM is not enabled for some domains" # Condition A fail
|
||||||
@@ -47,14 +55,18 @@ function Test-EnableDKIM {
|
|||||||
else {
|
else {
|
||||||
"N/A"
|
"N/A"
|
||||||
}
|
}
|
||||||
|
$basedetails = "All domains have DKIM enabled"
|
||||||
$details = if ($dkimResult) {
|
$details = if ($dkimResult) {
|
||||||
"All domains have DKIM enabled" # Condition A pass
|
if ($DomainName) {
|
||||||
|
"Domain: $DomainName; $basedetails"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$basedetails
|
||||||
|
} # Condition A pass
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
"DKIM not enabled for: $($dkimFailedDomains -join ', ')" # Condition B fail
|
"DKIM not enabled for: $($dkimFailedDomains -join ', ')" # Condition B fail
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create and populate the CISAuditResult object
|
# Create and populate the CISAuditResult object
|
||||||
$params = @{
|
$params = @{
|
||||||
Rec = $recnum
|
Rec = $recnum
|
||||||
|
Reference in New Issue
Block a user