fix: 8.6.1 aligned with test-template
This commit is contained in:
@@ -1,21 +1,20 @@
|
|||||||
function Test-ReportSecurityInTeams {
|
function Test-ReportSecurityInTeams {
|
||||||
[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 {
|
||||||
# 8.6.1 (L1) Ensure users can report security concerns in Teams
|
# 8.6.1 (L1) Ensure users can report security concerns in Teams
|
||||||
|
|
||||||
# Connect to Teams PowerShell using Connect-MicrosoftTeams
|
# Retrieve the necessary settings for Teams and Exchange Online
|
||||||
# Connect to Exchange Online PowerShell using Connect-ExchangeOnline
|
|
||||||
|
|
||||||
$CsTeamsMessagingPolicy = Get-CsTeamsMessagingPolicy -Identity Global | Select-Object -Property AllowSecurityEndUserReporting
|
$CsTeamsMessagingPolicy = Get-CsTeamsMessagingPolicy -Identity Global | Select-Object -Property AllowSecurityEndUserReporting
|
||||||
$ReportSubmissionPolicy = Get-ReportSubmissionPolicy | Select-Object -Property ReportJunkToCustomizedAddress, ReportNotJunkToCustomizedAddress, ReportPhishToCustomizedAddress, ReportChatMessageToCustomizedAddressEnabled
|
$ReportSubmissionPolicy = Get-ReportSubmissionPolicy | Select-Object -Property ReportJunkToCustomizedAddress, ReportNotJunkToCustomizedAddress, ReportPhishToCustomizedAddress, ReportChatMessageToCustomizedAddressEnabled
|
||||||
|
|
||||||
@@ -25,32 +24,40 @@ function Test-ReportSecurityInTeams {
|
|||||||
$ReportSubmissionPolicy.ReportPhishToCustomizedAddress -and
|
$ReportSubmissionPolicy.ReportPhishToCustomizedAddress -and
|
||||||
$ReportSubmissionPolicy.ReportChatMessageToCustomizedAddressEnabled
|
$ReportSubmissionPolicy.ReportChatMessageToCustomizedAddressEnabled
|
||||||
|
|
||||||
# Create an instance of CISAuditResult and populate it
|
# Prepare failure reasons and details based on compliance
|
||||||
$auditResult = [CISAuditResult]::new()
|
$failureReasons = if (-not $securityReportEnabled) {
|
||||||
$auditResult.CISControlVer = "v8"
|
"Users cannot report security concerns in Teams due to one or more incorrect settings"
|
||||||
$auditResult.CISControl = "0.0" # Explicitly Not Mapped as per the image provided
|
}
|
||||||
$auditResult.CISDescription = "Explicitly Not Mapped"
|
else {
|
||||||
$auditResult.Rec = "8.6.1"
|
"N/A"
|
||||||
$auditResult.ELevel = "E3"
|
}
|
||||||
$auditResult.ProfileLevel = "L1"
|
|
||||||
$auditResult.IG1 = $false # Set based on the CIS Controls image
|
$details = "AllowSecurityEndUserReporting: $($CsTeamsMessagingPolicy.AllowSecurityEndUserReporting); " +
|
||||||
$auditResult.IG2 = $false # Set based on the CIS Controls image
|
|
||||||
$auditResult.IG3 = $false # Set based on the CIS Controls image
|
|
||||||
$auditResult.RecDescription = "Ensure users can report security concerns in Teams"
|
|
||||||
$auditResult.Result = $securityReportEnabled
|
|
||||||
$auditResult.Details = "AllowSecurityEndUserReporting: $($CsTeamsMessagingPolicy.AllowSecurityEndUserReporting); " +
|
|
||||||
"ReportJunkToCustomizedAddress: $($ReportSubmissionPolicy.ReportJunkToCustomizedAddress); " +
|
"ReportJunkToCustomizedAddress: $($ReportSubmissionPolicy.ReportJunkToCustomizedAddress); " +
|
||||||
"ReportNotJunkToCustomizedAddress: $($ReportSubmissionPolicy.ReportNotJunkToCustomizedAddress); " +
|
"ReportNotJunkToCustomizedAddress: $($ReportSubmissionPolicy.ReportNotJunkToCustomizedAddress); " +
|
||||||
"ReportPhishToCustomizedAddress: $($ReportSubmissionPolicy.ReportPhishToCustomizedAddress); " +
|
"ReportPhishToCustomizedAddress: $($ReportSubmissionPolicy.ReportPhishToCustomizedAddress); " +
|
||||||
"ReportChatMessageToCustomizedAddressEnabled: $($ReportSubmissionPolicy.ReportChatMessageToCustomizedAddressEnabled)"
|
"ReportChatMessageToCustomizedAddressEnabled: $($ReportSubmissionPolicy.ReportChatMessageToCustomizedAddressEnabled)"
|
||||||
$auditResult.FailureReason = if (-not $securityReportEnabled) { "Users cannot report security concerns in Teams due to one or more incorrect settings" } else { "N/A" }
|
|
||||||
$auditResult.Status = if ($securityReportEnabled) { "Pass" } else { "Fail" }
|
|
||||||
|
|
||||||
$auditResults += $auditResult
|
# Create and populate the CISAuditResult object
|
||||||
|
$auditResult = [CISAuditResult]::new()
|
||||||
|
$auditResult.Status = if ($securityReportEnabled) { "Pass" } else { "Fail" }
|
||||||
|
$auditResult.ELevel = "E3"
|
||||||
|
$auditResult.ProfileLevel = "L1"
|
||||||
|
$auditResult.Rec = "8.6.1"
|
||||||
|
$auditResult.RecDescription = "Ensure users can report security concerns in Teams"
|
||||||
|
$auditResult.CISControlVer = "v8"
|
||||||
|
$auditResult.CISControl = "0.0"
|
||||||
|
$auditResult.CISDescription = "Explicitly Not Mapped"
|
||||||
|
$auditResult.IG1 = $false
|
||||||
|
$auditResult.IG2 = $false
|
||||||
|
$auditResult.IG3 = $false
|
||||||
|
$auditResult.Result = $securityReportEnabled
|
||||||
|
$auditResult.Details = $details
|
||||||
|
$auditResult.FailureReason = $failureReasons
|
||||||
}
|
}
|
||||||
|
|
||||||
end {
|
end {
|
||||||
# Return auditResults
|
# Return auditResult
|
||||||
return $auditResults
|
return $auditResult
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user