[PATCH] A script to compare the differences in
ntSecurityDescriptor between 2 hosts
nadezhda.ivanova at postpath.com
Fri May 29 07:48:42 GMT 2009
I see you fixed it and it was applied, thanks!
From: Andrew Kroeger [mailto:andrew at id10ts.net]
Sent: Friday, May 29, 2009 7:36 AM
To: Nadezhda Ivanova
Cc: samba-technical at samba.org
Subject: Re: [PATCH] A script to compare the differences in ntSecurityDescriptor between 2 hosts
As an addendum to my earlier reply, I think that current Git (as of
commit 554923ce1b1a3ab3a05bed14c0a2795e0c13febd) should have things
working as expected in your script.
I wrote a couple of patches that update the list of 2-letter SDDL
aliases to include a number of aliases that were not present before.
Looking at the SDDL now generated by your script, it appears that all
security descriptors that have a domain-specific SID are now properly
converted to their 2-letter aliases.
Nadezhda Ivanova wrote:
> Hi Andrew,
> I took a second look and I think the comparison should in principle be correct. When we provide a domain sid to as_sddl(), we get the short SID Form, that is the Well knows security principals are replaced with their SDDL aliases, and since we are comparing fresh installations there should be no new security principals. This means that the local and remote short form SDDL strings should be equal and sddl != sddl_local will work.
> However, it is still great that you made me go back to it, because it turns out that for schema entries the SID is not replaced with SA, and that would cause trouble. Perhaps it's a bug...
> Thanks again!
> -----Original Message-----
> From: Andrew Kroeger [mailto:andrew at id10ts.net]
> Sent: Thursday, May 28, 2009 2:49 PM
> To: Nadezhda Ivanova
> Cc: samba-technical at samba.org
> Subject: Re: [PATCH] A script to compare the differences in ntSecurityDescriptor between 2 hosts
> I like the good work you've done with this script. Keep it up!
> I worked a little with the original script version you sent as well as
> taking a look at the new version, and I have a few comments:
> 1) There are some lines with trailing whitespace that cause git warnings
> when importing the patch using git-am. These should be cleaned up
> before submitting the final patch.
> 2) After creating the credentials parser ("credopts"), it should be
> added as a parser option group ("parser.add_option_group(credopts)") so
> the authentication options are displayed when the script is given the
> "--help" argument.
> 3) As written, the script does not properly convert the domain SID in
> the descriptor from the remote machine into the proper domain SID for
> the local (S4) machine. This can be seen by printing the original
> remote SDDL ("sddl") and then printing the SDDL from the new security
> descriptor ("descr") with "print descr.as_sddl()" before calling
> self.add_to_ldif(). I believe the security descriptor from the remote
> machine should be converted to use the local SID before the "if sddl !=
> sddl_local:" comparison anyway, otherwise two descriptors that differ
> solely in domain SID will be considered different and generate an
> unnecessary LDIF modify entry.
> I tried to use string replacement to change the domain SID's
> ("sddl_new=descr.as_sddl().replace(self.remote_sid, self.local_sid)"),
> but python throws a "TypeError: expected a character buffer object"
> exception. I took a quick look at the existing SDDL functions, and I do
> not see anything (either in C or in python) that appears to be build to
> handle this conversion. I only looked for a few minutes though - there
> may be something I missed.
> Again, good job with the script. I look forward to seeing all of your
> security descriptor work come together.
> Andrew Kroeger
More information about the samba-technical