Skip to content

Commit

Permalink
Merge pull request cammurray#296 from cammurray/294-apply-a-preset-po…
Browse files Browse the repository at this point in the history
…licy-with-no-exemptions

wont apply
  • Loading branch information
cammurray authored Dec 3, 2023
2 parents 039be2d + ac5e88a commit c963b3d
Show file tree
Hide file tree
Showing 48 changed files with 444 additions and 127 deletions.
4 changes: 2 additions & 2 deletions Checks/check-ORCA100.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ class ORCA100 : ORCACheck
{
ForEach($Policy in $Config["HostedContentFilterPolicy"])
{
$IsPolicyDisabled = !$Config["PolicyStates"][$Policy.Guid.ToString()].Applies
$BulkThreshold = $($Policy.BulkThreshold)

# Check objects
$ConfigObject = [ORCACheckConfig]::new()
$ConfigObject.ConfigItem=$Config["PolicyStates"][$Policy.Guid.ToString()].Name
$ConfigObject.ConfigData=$BulkThreshold
$ConfigObject.ConfigDisabled = $IsPolicyDisabled
$ConfigObject.ConfigDisabled = $Config["PolicyStates"][$Policy.Guid.ToString()].Disabled
$ConfigObject.ConfigWontApply = !$Config["PolicyStates"][$Policy.Guid.ToString()].Applies
$ConfigObject.ConfigReadonly = $Policy.IsPreset
$ConfigObject.ConfigPolicyGuid=$Policy.Guid.ToString()

Expand Down
4 changes: 2 additions & 2 deletions Checks/check-ORCA101.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ class ORCA101 : ORCACheck
$CountOfPolicies = ($global:HostedContentPolicyStatus| Where-Object {$_.IsEnabled -eq $True}).Count
ForEach($Policy in $Config["HostedContentFilterPolicy"])
{
$IsPolicyDisabled = !$Config["PolicyStates"][$Policy.Guid.ToString()].Applies

$MarkAsSpamBulkMail = $($Policy.MarkAsSpamBulkMail)

# Check objects
$ConfigObject = [ORCACheckConfig]::new()
$ConfigObject.ConfigItem=$Config["PolicyStates"][$Policy.Guid.ToString()].Name
$ConfigObject.ConfigData=$MarkAsSpamBulkMail
$ConfigObject.ConfigDisabled=$IsPolicyDisabled
$ConfigObject.ConfigDisabled = $Config["PolicyStates"][$Policy.Guid.ToString()].Disabled
$ConfigObject.ConfigWontApply = !$Config["PolicyStates"][$Policy.Guid.ToString()].Applies
$ConfigObject.ConfigReadonly=$Policy.IsPreset
$ConfigObject.ConfigPolicyGuid=$Policy.Guid.ToString()

Expand Down
21 changes: 19 additions & 2 deletions Checks/check-ORCA102.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ class ORCA102 : ORCACheck
$CountOfPolicies = ($global:HostedContentPolicyStatus| Where-Object {$_.IsEnabled -eq $True}).Count
ForEach($Policy in $Config["HostedContentFilterPolicy"]) {

$IsPolicyDisabled = !$Config["PolicyStates"][$Policy.Guid.ToString()].Applies
$IsPolicyDisabled = $Config["PolicyStates"][$Policy.Guid.ToString()].Disabled
$ConfigWontApply = !$Config["PolicyStates"][$Policy.Guid.ToString()].Applies

$IncreaseScoreWithImageLinks = $($Policy.IncreaseScoreWithImageLinks)
$IncreaseScoreWithNumericIps = $($Policy.IncreaseScoreWithNumericIps)
Expand Down Expand Up @@ -72,6 +73,7 @@ class ORCA102 : ORCACheck
$ConfigObject.ConfigData=$IncreaseScoreWithImageLinks
$ConfigObject.ConfigDisabled=$IsPolicyDisabled
$ConfigObject.ConfigReadonly=$Policy.IsPreset
$ConfigObject.ConfigWontApply=$ConfigWontApply
$ConfigObject.ConfigPolicyGuid=$Policy.Guid.ToString()

$ConfigObject.SetResult([ORCAConfigLevel]::Standard,"Fail")
Expand All @@ -88,6 +90,7 @@ class ORCA102 : ORCACheck
$ConfigObject.ConfigItem="IncreaseScoreWithNumericIps"
$ConfigObject.ConfigData=$IncreaseScoreWithNumericIps
$ConfigObject.ConfigDisabled=$IsPolicyDisabled
$ConfigObject.ConfigWontApply=$ConfigWontApply
$ConfigObject.ConfigReadonly=$Policy.IsPreset
$ConfigObject.ConfigPolicyGuid=$Policy.Guid.ToString()

Expand All @@ -105,6 +108,7 @@ class ORCA102 : ORCACheck
$ConfigObject.ConfigItem="IncreaseScoreWithRedirectToOtherPort"
$ConfigObject.ConfigData=$IncreaseScoreWithRedirectToOtherPort
$ConfigObject.ConfigDisabled=$IsPolicyDisabled
$ConfigObject.ConfigWontApply=$ConfigWontApply
$ConfigObject.ConfigReadonly=$Policy.IsPreset
$ConfigObject.ConfigPolicyGuid=$Policy.Guid.ToString()

Expand All @@ -122,7 +126,8 @@ class ORCA102 : ORCACheck
$ConfigObject.ConfigItem="IncreaseScoreWithBizOrInfoUrls"
$ConfigObject.ConfigData=$IncreaseScoreWithBizOrInfoUrls
$ConfigObject.ConfigPolicyGuid=$Policy.Guid.ToString()

$ConfigObject.ConfigDisabled=$IsPolicyDisabled
$ConfigObject.ConfigWontApply=$ConfigWontApply
$ConfigObject.SetResult([ORCAConfigLevel]::Standard,"Fail")

$this.AddConfig($ConfigObject)
Expand All @@ -137,6 +142,7 @@ class ORCA102 : ORCACheck
$ConfigObject.ConfigItem="MarkAsSpamEmptyMessages"
$ConfigObject.ConfigData=$MarkAsSpamEmptyMessages
$ConfigObject.ConfigDisabled=$IsPolicyDisabled
$ConfigObject.ConfigWontApply=$ConfigWontApply
$ConfigObject.ConfigReadonly=$Policy.IsPreset
$ConfigObject.ConfigPolicyGuid=$Policy.Guid.ToString()

Expand All @@ -154,6 +160,7 @@ class ORCA102 : ORCACheck
$ConfigObject.ConfigItem="MarkAsSpamJavaScriptInHtml"
$ConfigObject.ConfigData=$MarkAsSpamJavaScriptInHtml
$ConfigObject.ConfigDisabled=$IsPolicyDisabled
$ConfigObject.ConfigWontApply=$ConfigWontApply
$ConfigObject.ConfigReadonly=$Policy.IsPreset
$ConfigObject.ConfigPolicyGuid=$Policy.Guid.ToString()

Expand All @@ -170,6 +177,7 @@ class ORCA102 : ORCACheck
$ConfigObject.ConfigItem="MarkAsSpamFramesInHtml"
$ConfigObject.ConfigData=$MarkAsSpamFramesInHtml
$ConfigObject.ConfigDisabled=$IsPolicyDisabled
$ConfigObject.ConfigWontApply=$ConfigWontApply
$ConfigObject.ConfigReadonly=$Policy.IsPreset
$ConfigObject.ConfigPolicyGuid=$Policy.Guid.ToString()

Expand All @@ -187,6 +195,7 @@ class ORCA102 : ORCACheck
$ConfigObject.ConfigItem="MarkAsSpamObjectTagsInHtml"
$ConfigObject.ConfigData=$MarkAsSpamObjectTagsInHtml
$ConfigObject.ConfigDisabled=$IsPolicyDisabled
$ConfigObject.ConfigWontApply=$ConfigWontApply
$ConfigObject.ConfigReadonly=$Policy.IsPreset
$ConfigObject.ConfigPolicyGuid=$Policy.Guid.ToString()

Expand All @@ -204,6 +213,7 @@ class ORCA102 : ORCACheck
$ConfigObject.ConfigItem="MarkAsSpamEmbedTagsInHtml"
$ConfigObject.ConfigData=$MarkAsSpamEmbedTagsInHtml
$ConfigObject.ConfigDisabled=$IsPolicyDisabled
$ConfigObject.ConfigWontApply=$ConfigWontApply
$ConfigObject.ConfigReadonly=$Policy.IsPreset
$ConfigObject.ConfigPolicyGuid=$Policy.Guid.ToString()

Expand All @@ -221,6 +231,7 @@ class ORCA102 : ORCACheck
$ConfigObject.ConfigItem="MarkAsSpamFormTagsInHtml"
$ConfigObject.ConfigData=$MarkAsSpamFormTagsInHtml
$ConfigObject.ConfigDisabled=$IsPolicyDisabled
$ConfigObject.ConfigWontApply=$ConfigWontApply
$ConfigObject.ConfigReadonly=$Policy.IsPreset
$ConfigObject.ConfigPolicyGuid=$Policy.Guid.ToString()

Expand All @@ -238,6 +249,7 @@ class ORCA102 : ORCACheck
$ConfigObject.ConfigItem="MarkAsSpamWebBugsInHtml"
$ConfigObject.ConfigData=$MarkAsSpamWebBugsInHtml
$ConfigObject.ConfigDisabled=$IsPolicyDisabled
$ConfigObject.ConfigWontApply=$ConfigWontApply
$ConfigObject.ConfigReadonly=$Policy.IsPreset
$ConfigObject.ConfigPolicyGuid=$Policy.Guid.ToString()

Expand All @@ -255,6 +267,7 @@ class ORCA102 : ORCACheck
$ConfigObject.ConfigItem="MarkAsSpamSensitiveWordList"
$ConfigObject.ConfigData=$MarkAsSpamSensitiveWordList
$ConfigObject.ConfigDisabled=$IsPolicyDisabled
$ConfigObject.ConfigWontApply=$ConfigWontApply
$ConfigObject.ConfigReadonly=$Policy.IsPreset
$ConfigObject.ConfigPolicyGuid=$Policy.Guid.ToString()

Expand All @@ -272,6 +285,7 @@ class ORCA102 : ORCACheck
$ConfigObject.ConfigItem="MarkAsSpamFromAddressAuthFail"
$ConfigObject.ConfigData=$MarkAsSpamFromAddressAuthFail
$ConfigObject.ConfigDisabled=$IsPolicyDisabled
$ConfigObject.ConfigWontApply=$ConfigWontApply
$ConfigObject.ConfigReadonly=$Policy.IsPreset
$ConfigObject.ConfigPolicyGuid=$Policy.Guid.ToString()

Expand All @@ -289,6 +303,7 @@ class ORCA102 : ORCACheck
$ConfigObject.ConfigItem="MarkAsSpamNdrBackscatter"
$ConfigObject.ConfigData=$MarkAsSpamNdrBackscatter
$ConfigObject.ConfigDisabled=$IsPolicyDisabled
$ConfigObject.ConfigWontApply=$ConfigWontApply
$ConfigObject.ConfigReadonly=$Policy.IsPreset
$ConfigObject.ConfigPolicyGuid=$Policy.Guid.ToString()

Expand All @@ -306,6 +321,7 @@ class ORCA102 : ORCACheck
$ConfigObject.ConfigItem="MarkAsSpamSpfRecordHardFail"
$ConfigObject.ConfigData=$MarkAsSpamSpfRecordHardFail
$ConfigObject.ConfigDisabled=$IsPolicyDisabled
$ConfigObject.ConfigWontApply=$ConfigWontApply
$ConfigObject.ConfigReadonly=$Policy.IsPreset
$ConfigObject.ConfigPolicyGuid=$Policy.Guid.ToString()

Expand All @@ -325,6 +341,7 @@ class ORCA102 : ORCACheck
$ConfigObject.ConfigItem="ASF Options"
$ConfigObject.ConfigData="Disabled"
$ConfigObject.ConfigDisabled=$IsPolicyDisabled
$ConfigObject.ConfigWontApply=$ConfigWontApply
$ConfigObject.ConfigReadonly=$Policy.IsPreset
$ConfigObject.ConfigPolicyGuid=$Policy.Guid.ToString()

Expand Down
12 changes: 8 additions & 4 deletions Checks/check-ORCA103.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ class ORCA103 : ORCACheck
$ConfigObject.Object=$policyname
$ConfigObject.ConfigItem="RecipientLimitExternalPerHour"
$ConfigObject.ConfigData=$RecipientLimitExternalPerHour
$ConfigObject.ConfigDisabled=!$Config["PolicyStates"][$Policy.Guid.ToString()].Applies
$ConfigObject.ConfigDisabled = $Config["PolicyStates"][$Policy.Guid.ToString()].Disabled
$ConfigObject.ConfigWontApply = !$Config["PolicyStates"][$Policy.Guid.ToString()].Applies
$ConfigObject.ConfigReadonly=$Policy.IsPreset
$ConfigObject.ConfigPolicyGuid=$Policy.Guid.ToString()

Expand Down Expand Up @@ -93,7 +94,8 @@ class ORCA103 : ORCACheck
$ConfigObject.Object=$policyname
$ConfigObject.ConfigItem="RecipientLimitInternalPerHour"
$ConfigObject.ConfigData=$($RecipientLimitInternalPerHour)
$ConfigObject.ConfigDisabled=!$Config["PolicyStates"][$Policy.Guid.ToString()].Applies
$ConfigObject.ConfigDisabled = $Config["PolicyStates"][$Policy.Guid.ToString()].Disabled
$ConfigObject.ConfigWontApply = !$Config["PolicyStates"][$Policy.Guid.ToString()].Applies
$ConfigObject.ConfigReadonly=$Policy.IsPreset

If($RecipientLimitInternalPerHour -eq 1000)
Expand Down Expand Up @@ -127,7 +129,8 @@ class ORCA103 : ORCACheck
$ConfigObject.Object=$policyname
$ConfigObject.ConfigItem="RecipientLimitPerDay"
$ConfigObject.ConfigData=$($RecipientLimitPerDay)
$ConfigObject.ConfigDisabled=!$Config["PolicyStates"][$Policy.Guid.ToString()].Applies
$ConfigObject.ConfigDisabled = $Config["PolicyStates"][$Policy.Guid.ToString()].Disabled
$ConfigObject.ConfigWontApply = !$Config["PolicyStates"][$Policy.Guid.ToString()].Applies
$ConfigObject.ConfigReadonly=$Policy.IsPreset

If($RecipientLimitPerDay -eq 1000)
Expand Down Expand Up @@ -155,7 +158,8 @@ class ORCA103 : ORCACheck
$ConfigObject.Object=$policyname
$ConfigObject.ConfigItem="ActionWhenThresholdReached"
$ConfigObject.ConfigData=$($ActionWhenThresholdReached)
$ConfigObject.ConfigDisabled=!$Config["PolicyStates"][$Policy.Guid.ToString()].Applies
$ConfigObject.ConfigDisabled = $Config["PolicyStates"][$Policy.Guid.ToString()].Disabled
$ConfigObject.ConfigWontApply = !$Config["PolicyStates"][$Policy.Guid.ToString()].Applies
$ConfigObject.ConfigReadonly=$Policy.IsPreset

If($ActionWhenThresholdReached -like "BlockUser")
Expand Down
3 changes: 2 additions & 1 deletion Checks/check-ORCA104.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ class ORCA104 : ORCACheck
$ConfigObject = [ORCACheckConfig]::new()
$ConfigObject.ConfigItem=$policyname
$ConfigObject.ConfigData=$HighConfidencePhishAction
$ConfigObject.ConfigDisabled=$IsPolicyDisabled
$ConfigObject.ConfigDisabled = $Config["PolicyStates"][$Policy.Guid.ToString()].Disabled
$ConfigObject.ConfigWontApply = !$Config["PolicyStates"][$Policy.Guid.ToString()].Applies
$ConfigObject.ConfigReadonly=$Policy.IsPreset
$ConfigObject.ConfigPolicyGuid=$Policy.Guid.ToString()

Expand Down
6 changes: 4 additions & 2 deletions Checks/check-ORCA105.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ class ORCA105 : ORCACheck
$ConfigObject.Object= $policyname
$ConfigObject.ConfigItem="DeliverMessageAfterScan"
$ConfigObject.ConfigData=$DeliverMessageAfterScan
$ConfigObject.ConfigDisabled=$IsPolicyDisabled
$ConfigObject.ConfigDisabled = $Config["PolicyStates"][$Policy.Guid.ToString()].Disabled
$ConfigObject.ConfigWontApply = !$Config["PolicyStates"][$Policy.Guid.ToString()].Applies
$ConfigObject.ConfigReadonly=$Policy.IsPreset
$ConfigObject.ConfigPolicyGuid=$Policy.Guid.ToString()

Expand Down Expand Up @@ -99,7 +100,8 @@ class ORCA105 : ORCACheck
$ConfigObject.Object= $policyname
$ConfigObject.ConfigItem="ScanUrls"
$ConfigObject.ConfigData=$ScanUrls
$ConfigObject.ConfigDisabled=$IsPolicyDisabled
$ConfigObject.ConfigDisabled = $Config["PolicyStates"][$Policy.Guid.ToString()].Disabled
$ConfigObject.ConfigWontApply = !$Config["PolicyStates"][$Policy.Guid.ToString()].Applies
$ConfigObject.ConfigReadonly=$Policy.IsPreset
$ConfigObject.ConfigPolicyGuid=$Policy.Guid.ToString()

Expand Down
3 changes: 2 additions & 1 deletion Checks/check-ORCA106.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ class ORCA106 : ORCACheck
$ConfigObject = [ORCACheckConfig]::new()
$ConfigObject.ConfigItem=$Config["PolicyStates"][$Policy.Guid.ToString()].Name
$ConfigObject.ConfigData=$QuarantineRetentionPeriod
$ConfigObject.ConfigDisabled=$IsPolicyDisabled
$ConfigObject.ConfigDisabled = $Config["PolicyStates"][$Policy.Guid.ToString()].Disabled
$ConfigObject.ConfigWontApply = !$Config["PolicyStates"][$Policy.Guid.ToString()].Applies
$ConfigObject.ConfigReadonly=$Policy.IsPreset
$ConfigObject.ConfigPolicyGuid=$Policy.Guid.ToString()

Expand Down
3 changes: 2 additions & 1 deletion Checks/check-ORCA109.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ class ORCA109 : ORCACheck
}

$ConfigObject.ConfigData = $AllowedSenders
$ConfigObject.ConfigDisabled=$IsPolicyDisabled
$ConfigObject.ConfigDisabled = $Config["PolicyStates"][$Policy.Guid.ToString()].Disabled
$ConfigObject.ConfigWontApply = !$Config["PolicyStates"][$Policy.Guid.ToString()].Applies

<#
Expand Down
3 changes: 2 additions & 1 deletion Checks/check-ORCA110.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ class ORCA110 : ORCACheck
$ConfigObject = [ORCACheckConfig]::new()
$ConfigObject.ConfigItem=$policyname
$ConfigObject.ConfigData=$EnableInternalSenderNotifications
$ConfigObject.ConfigDisabled=$IsPolicyDisabled
$ConfigObject.ConfigDisabled = $Config["PolicyStates"][$Policy.Guid.ToString()].Disabled
$ConfigObject.ConfigWontApply = !$Config["PolicyStates"][$Policy.Guid.ToString()].Applies
$ConfigObject.ConfigReadonly=$Policy.IsPreset
$ConfigObject.ConfigPolicyGuid=$Policy.Guid.ToString()

Expand Down
3 changes: 2 additions & 1 deletion Checks/check-ORCA111.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ class ORCA111 : ORCACheck
$ConfigObject.Object=$policyname
$ConfigObject.ConfigItem="EnableUnauthenticatedSender"
$ConfigObject.ConfigData=$EnableUnauthenticatedSender
$ConfigObject.ConfigDisabled=$IsPolicyDisabled
$ConfigObject.ConfigDisabled = $Config["PolicyStates"][$Policy.Guid.ToString()].Disabled
$ConfigObject.ConfigWontApply = !$Config["PolicyStates"][$Policy.Guid.ToString()].Applies
$ConfigObject.ConfigReadonly=$Policy.IsPreset
$ConfigObject.ConfigPolicyGuid=$Policy.Guid.ToString()

Expand Down
3 changes: 2 additions & 1 deletion Checks/check-ORCA112.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ class ORCA112 : ORCACheck
$ConfigObject.Object=$policyname
$ConfigObject.ConfigItem="AuthenticationFailAction"
$ConfigObject.ConfigData=$AuthenticationFailAction
$ConfigObject.ConfigDisabled=$IsPolicyDisabled
$ConfigObject.ConfigDisabled = $Config["PolicyStates"][$Policy.Guid.ToString()].Disabled
$ConfigObject.ConfigWontApply = !$Config["PolicyStates"][$Policy.Guid.ToString()].Applies
$ConfigObject.ConfigReadonly=$Policy.IsPreset
$ConfigObject.ConfigPolicyGuid=$Policy.Guid.ToString()

Expand Down
3 changes: 2 additions & 1 deletion Checks/check-ORCA113.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ class ORCA113 : ORCACheck
$ConfigObject.Object=$Config["PolicyStates"][$Policy.Guid.ToString()].Name
$ConfigObject.ConfigItem="AllowClickThrough"
$ConfigObject.ConfigData=$AllowClickThrough
$ConfigObject.ConfigDisabled=$IsPolicyDisabled
$ConfigObject.ConfigDisabled = $Config["PolicyStates"][$Policy.Guid.ToString()].Disabled
$ConfigObject.ConfigWontApply = !$Config["PolicyStates"][$Policy.Guid.ToString()].Applies
$ConfigObject.ConfigReadonly=$Policy.IsPreset
$ConfigObject.ConfigPolicyGuid=$Policy.Guid.ToString()

Expand Down
6 changes: 4 additions & 2 deletions Checks/check-ORCA114.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ class ORCA114 : ORCACheck
$ConfigObject.ConfigItem=$policyname
$ConfigObject.ConfigData=$IPAddr
$ConfigObject.ConfigPolicyGuid=$HostedConnectionFilterPolicy.Guid.ToString()
$ConfigObject.ConfigDisabled = !$Config["PolicyStates"][$HostedConnectionFilterPolicy.Guid.ToString()].Applies
$ConfigObject.ConfigDisabled = $Config["PolicyStates"][$HostedConnectionFilterPolicy.Guid.ToString()].Disabled
$ConfigObject.ConfigWontApply = !$Config["PolicyStates"][$HostedConnectionFilterPolicy.Guid.ToString()].Applies
$ConfigObject.SetResult([ORCAConfigLevel]::Standard,"Fail")
$this.AddConfig($ConfigObject)
}
Expand All @@ -72,7 +73,8 @@ class ORCA114 : ORCACheck
$ConfigObject.ConfigItem=$policyname
$ConfigObject.ConfigData="No IP detected"
$ConfigObject.ConfigPolicyGuid=$HostedConnectionFilterPolicy.Guid.ToString()
$ConfigObject.ConfigDisabled = !$Config["PolicyStates"][$HostedConnectionFilterPolicy.Guid.ToString()].Applies
$ConfigObject.ConfigDisabled = $Config["PolicyStates"][$HostedConnectionFilterPolicy.Guid.ToString()].Disabled
$ConfigObject.ConfigWontApply = !$Config["PolicyStates"][$HostedConnectionFilterPolicy.Guid.ToString()].Applies
$ConfigObject.SetResult([ORCAConfigLevel]::Standard,"Pass")

$this.AddConfig($ConfigObject)
Expand Down
Loading

0 comments on commit c963b3d

Please sign in to comment.