-
-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AccessRules - BugFix + Validation/warning on setting access rules #82
Open
AndiBellstedt
wants to merge
5
commits into
ActiveDirectoryManagementFramework:development
Choose a base branch
from
AndiBellstedt:development
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
54cb1ff
Bugfix for "NoFixConfig" option within AccessRules
AndiBellstedt 244436f
Add validation + Warning Message on Processing AccessRules when rule …
AndiBellstedt 3b1531c
add changelog documentation
AndiBellstedt df150f1
add changelog documentation
AndiBellstedt b903357
Allow empty strings on user registration, due to UPN is allowed to be…
AndiBellstedt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
<# | ||
.SYNOPSIS | ||
Validates the targeted domain's Access Rule configuration. | ||
|
||
.DESCRIPTION | ||
Validates the targeted domain's Access Rule configuration. | ||
This is done by comparing each relevant object's non-inherited permissions with the Schema-given default permissions for its object type. | ||
|
@@ -19,13 +19,13 @@ | |
- Have at least one path based rule. | ||
- Are considered as "under management", as defined using Set-DMContentMode | ||
It uses a definitive approach - any access rule not defined will be flagged for deletion! | ||
|
||
.PARAMETER Server | ||
The server / domain to work with. | ||
|
||
.PARAMETER Credential | ||
The credentials to use for this operation. | ||
|
||
.EXAMPLE | ||
PS C:\> Test-DMAccessRule -Server fabrikam.com | ||
|
||
|
@@ -39,11 +39,11 @@ | |
param ( | ||
[PSFComputer] | ||
$Server, | ||
|
||
[PSCredential] | ||
$Credential | ||
) | ||
|
||
begin { | ||
#region Utility Functions | ||
function Convert-AccessRule { | ||
|
@@ -95,6 +95,7 @@ | |
ObjectTypeName = $objectTypeName | ||
PropagationFlags = $ruleObject.PropagationFlags | ||
Present = $ruleObject.Present | ||
NoFixConfig = $ruleObject.NoFixConfig | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for catching that one |
||
} | ||
} | ||
} | ||
|
@@ -150,7 +151,7 @@ | |
} | ||
|
||
$adObject = Get-ADObject @parameters -Identity $resolvedPath -Properties adminCount | ||
|
||
if ($adObject.adminCount) { | ||
$defaultPermissions = @() | ||
$desiredPermissions = Get-AdminSDHolderRules @parameters | ||
|
@@ -173,53 +174,53 @@ | |
#region Process Non-Configured AD Objects - Serial | ||
if (-not $doParallelize) { | ||
$resolvedConfiguredObjects = $script:accessRules.Keys | Resolve-String | ||
|
||
$foundADObjects = foreach ($searchBase in (Resolve-ContentSearchBase @parameters -NoContainer)) { | ||
Get-ADObject @parameters -LDAPFilter '(objectCategory=*)' -SearchBase $searchBase.SearchBase -SearchScope $searchBase.SearchScope -Properties adminCount | ||
} | ||
|
||
$resultDefaults = @{ | ||
Server = $Server | ||
ObjectType = 'AccessRule' | ||
} | ||
|
||
$convertCmdName = { Convert-DMSchemaGuid @parameters -OutType Name }.GetSteppablePipeline() | ||
$convertCmdName.Begin($true) | ||
$convertCmdGuid = { Convert-DMSchemaGuid @parameters -OutType Guid }.GetSteppablePipeline() | ||
$convertCmdGuid.Begin($true) | ||
|
||
$processed = @{ } | ||
foreach ($foundADObject in $foundADObjects) { | ||
# Prevent duplicate processing | ||
if ($processed[$foundADObject.DistinguishedName]) { continue } | ||
$processed[$foundADObject.DistinguishedName] = $true | ||
|
||
# Skip items that were defined in configuration, they were already processed | ||
if ($foundADObject.DistinguishedName -in $resolvedConfiguredObjects) { continue } | ||
|
||
$adAclObject = Get-AdsAcl @parameters -Path $foundADObject.DistinguishedName | ||
$compareParam = @{ | ||
ADRules = $adAclObject.Access | Convert-AccessRuleIdentity @parameters | ||
DefaultRules = Get-DMObjectDefaultPermission @parameters -ObjectClass $foundADObject.ObjectClass | ||
ConfiguredRules = Get-CategoryBasedRules -ADObject $foundADObject @parameters -ConvertNameCommand $convertCmdName -ConvertGuidCommand $convertCmdGuid | ||
ADObject = $foundADObject | ||
} | ||
|
||
# Protected Objects | ||
if ($foundADObject.AdminCount) { | ||
$compareParam.DefaultRules = @() | ||
$compareParam.ConfiguredRules = Get-AdminSDHolderRules @parameters | ||
} | ||
|
||
$compareParam += $parameters | ||
$delta = Compare-AccessRules @compareParam | ||
|
||
if ($delta) { | ||
New-TestResult @resultDefaults -Type Update -Changed $delta -ADObject $adAclObject -Identity $foundADObject.DistinguishedName | ||
continue | ||
} | ||
} | ||
|
||
$convertCmdName.End() | ||
$convertCmdGuid.End() | ||
|
||
|
@@ -345,7 +346,7 @@ | |
$null = $workflow | Add-PSFRunspaceWorker @param | ||
|
||
$resolvedConfiguredObjects = $script:accessRules.Keys | Resolve-String | ||
|
||
$foundADObjects = foreach ($searchBase in (Resolve-ContentSearchBase @parameters -NoContainer)) { | ||
Get-ADObject @parameters -LDAPFilter '(objectCategory=*)' -SearchBase $searchBase.SearchBase -SearchScope $searchBase.SearchScope -Properties adminCount | ||
} | ||
|
@@ -370,7 +371,7 @@ | |
foreach ($fail in $fails) { | ||
Write-PSFMessage -Level Warning -String 'Test-DMAccessRule.Parallel.Error' -StringValues $fail.ADObject -ErrorRecord $fail.Error -Target $fail | ||
} | ||
|
||
$results = Read-PSFRunspaceQueue -InputObject $workflow -Name results -All | ||
# Fix String Presentation for objects from a background runspace | ||
$results | Add-Member -MemberType ScriptMethod -Name ToString -Value { $this.Identity } -Force | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was there a particular problem you added those for or was that more of a "Oh. there's a TODO marker there, lets add that while I'm on it"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I was digging around with the AccessRules and did some testing. As far as I remember -and it was a while ago, so my mind is a bit blurry on the exact situation- I did consider that as a bug.
ADMF did not throw information on NoFix-Items and on edge-case-scenarios.
Something like a ACE is not present on the object but defined on schema default ACL. Something like this, but as said, I did not remember exactly.
...and in the end... in fact it was marked as ToDo and did make sense to me.