|
What
still confuses me is how IIFP is more complex than what you'd have to write
yourself. I can understand if PSynch is not compatible but otherwise it
seems like it's as complex as it needs to be. Therefore, you'd end up
writing the same thing (pretty much). If that's the case, I'm not sure I'd spend
the time writing the code. I prefer to write the code, but not sure it's
justified in this case.
Just
throwing that out there.
As for
the gathering and stamping objectsid on the user proxy objects, I think this is
an example that would work (I haven't tested it; it comes from: http://www.microsoft.com/italy/windowsserver2003/adam/adamfaq.mspx although
I don't read Italian either. :)
Const SE_SACL_PROTECTED = &H2000 Const ADS_SECURITY_INFO_OWNER = &H1 Const ADS_SECURITY_INFO_GROUP = &H2 Const ADS_OPTION_SECURITY_MASK =&H3 Const ADS_SECURITY_INFO_DACL = &H4 Const ADS_SECURITY_INFO_SACL = &H8 Const ADS_ACETYPE_SYSTEM_AUDIT = &H2 Const ADS_ACETYPE_SYSTEM_AUDIT_OBJECT = &H7 Const ADS_RIGHT_DELETE = &H10000 Const ADS_ACEFLAG_FAILED_ACCESS = &h80 Const ADS_ACEFLAG_SUCCESS_ACCESS = &H40 Const ADS_ACEFLAG_NO_PROPAGATE_INHERIT_ACE = &H4 ADS_SID_HEXSTRING = ADS_SID_RAW + 1 ADS_SID_SAM = ADS_SID_HEXSTRING + 1 ADS_SID_UPN = ADS_SID_SAM + 1 ADS_SID_SDDL = ADS_SID_UPN + 1 ADS_SID_WINNT_PATH = ADS_SID_SDDL + 1 ADS_SID_ACTIVE_DIRECTORY_PATH = ADS_SID_WINNT_PATH + 1 ADS_SID_SID_BINDING = ADS_SID_ACTIVE_DIRECTORY_PATH + 1 '------------------------- Main Script ---------------------------- dim oPrv set oPrv = GetObject("LDAP:")
'This section identifies the object that you want to audit.
set oObj = GetObject("LDAP://kwchild:50000/CN=Testuser6,cn=Testcontainer,cn=testrep,dc=com")
'This section identifies the group or user you want to audit when they access the 'object.
set oGRP = oPrv.OpenDsObject("LDAP://kwchild:50000/CN=Users,cn=Roles,cn=testrep,dc=com", "domain\user", "secret", 1)
oObj.SetOption ADS_OPTION_SECURITY_MASK, ADS_SECURITY_INFO_SACL
dim oSD set oSD = oOBJ.Get("ntSecurityDescriptor") dim oSACL set oSACL = oSD.SystemACL
' This section creates a SACL if a SACL does not already exist.
if (oSACL is nothing )then 'make a new sacl set oSACL = createobject("Accesscontrollist") oSACL.aclrevision = 4 end if
' This section converts the dis to SDDL format.
bSID = oObj.Get("objectSID") set oSID = CreateObject("ADsSID") oSID.SetAs ADS_SID_RAW, oGRP.Get("objectSID") strSDDL = oSID.GetAs(ADS_SID_SDDL)
'WScript.Echo "Group SDDL SID: " & strSDDL
dim oAuditACE
'This section constructs the new ACE.
set oAuditAce = CreateObject("AccessControlEntry")
oAuditAce.Trustee = strSDDL
' system audit ace oAuditAce.AceType = 2
' delete audit oAuditAce.AccessMask = ADS_RIGHT_DELETE
'Const ADS_ACEFLAG_FAILED_ACCESS = &h80 'Const ADS_ACEFLAG_SUCCESS_ACCESS = &H40
oAuditAce.AceFlags = ADS_ACEFLAG_SUCCESS_ACCESS or ADS_ACEFLAG_FAILED_ACCESS '&hC0
oAuditAce.Flags = 0
oSACL.AddAce oAuditAce
oSD.SystemACL = oSACL
oOBj.Put "NtSecurityDescriptor", oSD oObj.SetInfo
wscript.echo "done"
|
Title: Message
