fix: 7.2.3 aligned with test-template
This commit is contained in:
@@ -1,37 +1,49 @@
|
|||||||
function Test-RestrictExternalSharing {
|
function Test-RestrictExternalSharing {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param (
|
param (
|
||||||
|
# Aligned
|
||||||
# Define your parameters here
|
# Define your parameters here
|
||||||
)
|
)
|
||||||
|
|
||||||
begin {
|
begin {
|
||||||
# Initialization code
|
# Dot source the class script if necessary
|
||||||
|
#. .\source\Classes\CISAuditResult.ps1
|
||||||
$auditResult = [CISAuditResult]::new()
|
# Initialization code, if needed
|
||||||
}
|
}
|
||||||
|
|
||||||
process {
|
process {
|
||||||
# 7.2.3 (L1) Ensure external content sharing is restricted
|
# 7.2.3 (L1) Ensure external content sharing is restricted
|
||||||
|
|
||||||
|
# Retrieve the SharingCapability setting for the SharePoint tenant
|
||||||
$SPOTenantSharingCapability = Get-SPOTenant | Select-Object SharingCapability
|
$SPOTenantSharingCapability = Get-SPOTenant | Select-Object SharingCapability
|
||||||
$isRestricted = $SPOTenantSharingCapability.SharingCapability -in @('ExternalUserSharingOnly', 'ExistingExternalUserSharingOnly', 'Disabled')
|
$isRestricted = $SPOTenantSharingCapability.SharingCapability -in @('ExternalUserSharingOnly', 'ExistingExternalUserSharingOnly', 'Disabled')
|
||||||
|
|
||||||
# Populate the auditResult object with the required properties
|
# Prepare failure reasons and details based on compliance
|
||||||
|
$failureReasons = if (-not $isRestricted) {
|
||||||
|
"External content sharing is not adequately restricted. Current setting: $($SPOTenantSharingCapability.SharingCapability)"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
"N/A"
|
||||||
|
}
|
||||||
|
|
||||||
|
$details = "SharingCapability: $($SPOTenantSharingCapability.SharingCapability)"
|
||||||
|
|
||||||
|
# Create and populate the CISAuditResult object
|
||||||
|
$auditResult = [CISAuditResult]::new()
|
||||||
|
$auditResult.Status = if ($isRestricted) { "Pass" } else { "Fail" }
|
||||||
|
$auditResult.ELevel = "E3"
|
||||||
|
$auditResult.ProfileLevel = "L1"
|
||||||
|
$auditResult.Rec = "7.2.3"
|
||||||
|
$auditResult.RecDescription = "Ensure external content sharing is restricted"
|
||||||
$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 = "7.2.3"
|
|
||||||
$auditResult.ELevel = "E3"
|
|
||||||
$auditResult.ProfileLevel = "L1"
|
|
||||||
$auditResult.IG1 = $true
|
$auditResult.IG1 = $true
|
||||||
$auditResult.IG2 = $true
|
$auditResult.IG2 = $true
|
||||||
$auditResult.IG3 = $true
|
$auditResult.IG3 = $true
|
||||||
$auditResult.RecDescription = "Ensure external content sharing is restricted"
|
|
||||||
|
|
||||||
$auditResult.Result = $isRestricted
|
$auditResult.Result = $isRestricted
|
||||||
$auditResult.Details = "SharingCapability: $($SPOTenantSharingCapability.SharingCapability)"
|
$auditResult.Details = $details
|
||||||
$auditResult.FailureReason = if (-not $isRestricted) { "External content sharing is not adequately restricted. Current setting: $($SPOTenantSharingCapability.SharingCapability)" } else { "N/A" }
|
$auditResult.FailureReason = $failureReasons
|
||||||
$auditResult.Status = if ($isRestricted) { "Pass" } else { "Fail" }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
end {
|
end {
|
||||||
|
Reference in New Issue
Block a user