SecurityPolicyDsc icon indicating copy to clipboard operation
SecurityPolicyDsc copied to clipboard

UserRightsAssignment: Allow unresolvable SIDs found in local security policy

Open ShawnHardwick opened this issue 4 years ago • 15 comments

Pull Request (PR) description

Do not attempt to translate identities returned by local security policy when setting the resource. If the identity returned is an unresolvable SID (usually due to deleted/orphaned AD objects), then the resource will throw a translation error.

I also thought of changing the ConvertTo-NTAccount function to never throw but instead log verbosely for all scope types, but felt that the implementation in this PR was more precise.

https://github.com/dsccommunity/SecurityPolicyDsc/blob/b29bdf824d91f72375de7851e20c8adf526501cd/source/Modules/SecurityPolicyResourceHelper/SecurityPolicyResourceHelper.psm1#L369-L377

The resource will still translate any identities given to the resource by the user.

Neither secedit nor Windows care about the presence of unresolved SIDs in a security policy. During a configure operation (secedit.exe /configure), secedit will happily accept either style in the .inf file. It will also accept and de-duplicate security principals that are specified as an account name and SID in the same line item under the [Privileges] section.

First attempt at using Pester unit testing before. I don't have a way to test locally due to permission restrictions.

This Pull Request (PR) fixes the following issues

  • Fixes #78
  • Fixes #87
  • Fixes #158

Task list

  • [x] Added an entry to the change log under the Unreleased section of the file CHANGELOG.md. Entry should say what was changed and how that affects users (if applicable), and reference the issue being resolved (if applicable).
  • [ ] Resource documentation added/updated in README.md.
  • [ ] Resource parameter descriptions added/updated in README.md, schema.mof and comment-based help.
  • [x] Comment-based help added/updated.
  • [ ] Localization strings added/updated in all localization files as appropriate.
  • [ ] Examples appropriately added/updated.
  • [x] Unit tests added/updated. See DSC Community Testing Guidelines.
  • [ ] Integration tests added/updated (where possible). See DSC Community Testing Guidelines.
  • [x] New/changed code adheres to DSC Community Style Guidelines.

This change is Reviewable

ShawnHardwick avatar Mar 30 '21 22:03 ShawnHardwick

Codecov Report

Merging #161 (620a4ef) into master (44acc25) will increase coverage by 0%. The diff coverage is 66%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #161   +/-   ##
=====================================
  Coverage      89%    89%           
=====================================
  Files           5      5           
  Lines         577    579    +2     
=====================================
+ Hits          517    520    +3     
+ Misses         60     59    -1     

codecov[bot] avatar Mar 31 '21 00:03 codecov[bot]

I believe this PR is ready for review. It is my understanding that the currently failing CI tests are not related to my PR.

ShawnHardwick avatar Apr 05 '21 16:04 ShawnHardwick

Is there anything missing that I need to address to have this reviewed?

ShawnHardwick avatar Apr 26 '21 15:04 ShawnHardwick

Can this be reviewed for merge? I would like to utilize this. Thanks!

jdwhited avatar May 19 '21 18:05 jdwhited

I've just kicked another build to check, but please make sure all the test pass for starter. I think some High Quality Resource Modules were not passing.

gaelcolas avatar May 20 '21 21:05 gaelcolas

Ok they're passing. @bcwilhite could you check this PR please and review the proposal please?

gaelcolas avatar May 20 '21 21:05 gaelcolas

Still looking to get this reviewed. :)

ShawnHardwick avatar Jun 21 '21 16:06 ShawnHardwick

Can this be reviewed please?

jdwhited avatar Jul 09 '21 15:07 jdwhited

Bump.... Would really like to see this merged.

jdwhited avatar Aug 24 '21 18:08 jdwhited

Bump for release.

japatton avatar Dec 02 '21 15:12 japatton

Still looking for someone to review this lol. We've forked this internally, but would see benefit in having this merged.

ShawnHardwick avatar Jun 20 '22 21:06 ShawnHardwick

Will bump this in the #DSC channel of the PowerShell slack/discord

gaelcolas avatar Jun 21 '22 09:06 gaelcolas

Hi there. Any updates on this? Facing the same problem.

ghost avatar Feb 14 '23 13:02 ghost

We're hitting the same problem also, would be good to get a fix

ic248 avatar Feb 23 '23 14:02 ic248