Accessing Foreign Security Principals

醉酒当歌 提交于 2019-12-04 01:49:00

问题


Searching for the user michael@mycontoso.com with the objectSid S-1-5-21-1234567890-123465789-123456789-123456, I only find a Foreign Security Principal CN=S-1-5-21-1234567890-123465789-123456789-123456,CN=ForeignSecurityPrincipals,DC=contoso,DC=com. That foreign security principal does not contain the properties I have to read, so I guess I have to access the "Home AD" of that FSP.

Does a FSP have a property that always contains the LDAP path of the user object? Is there a standardized/recommended way how to access the Home AD?


回答1:


Sadly FSP don't contain the LDAP path of the referenced object. (if it contain one, then it needs to be replicated once the object is rename/moved)

There seems no easy way to get back the containing AD using the SID from foreign forest. If in local forest you may do it by binding to LDAP://<SID=S-1-xxxxx>.

A not-so-easy way is to build a domain SID to domain map.
Walk through each domain in trusted forests and build the map using the script here (the "The Script Solution" section).

http://blogs.technet.com/b/ashleymcglone/archive/2011/10/12/powershell-sid-walker-texas-ranger-part-3-getting-domain-sids-and-trusts.aspx

SID of security principals are in the form of <domain SID>-<RID>.
e.g. domain SID of S-1-5-21-1234567890-123465789-123456789-123456 is S-1-5-21-1234567890-123465789-123456789.

By extracting the domain SID (if in .NET you can do it by using SecurityIdentifier class and the AccountDomainSid property) and the map then you can find out the containing domain.




回答2:


You may try to retrieve the msDS-PrincipalName:

ldapsearch <options> -b "CN=ForeignSecurityPrincipals,DC=contoso,DC=com" "CN=S-1-5-21-1234567890-123465789-123456789-123456" msDS-PrincipalName

FOO\michael@mycontoso.com


Otherwise, the approach is as https://stackoverflow.com/a/27038494/10408280 describes:

  1. Retrieve Domain identifier from first part of SID
  2. Perform a lookup against that domain for the SID of the user or by sAMAccountName


来源:https://stackoverflow.com/questions/27011350/accessing-foreign-security-principals

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!