简体   繁体   English

LDAP与ADSI在操作Active Directory用户方面的比较

[英]LDAP vs. ADSI in manipulation of Active Directory Users

I have been requested to expose a web service for managing Active Directory Users via an intranet. 已要求我公开用于通过Intranet管理Active Directory用户的Web服务。 I have been advised that LDAP is viewed as a security vulnerability and is not to be used. 我被告知LDAP被视为安全漏洞,不被使用。

Given this constraint, I have managed to connect via ADSI with a DirectoryEntry object like this: 鉴于此限制,我设法通过ADSI与DirectoryEntry对象进行连接,如下所示:

DirectoryEntry de = new DirectoryEntry();
de.Path = "WinNT://TheDomain.local";
de.Username = "NTUser1";
de.Password = "pwdpwdpwd2";

I can loop through the children of this DirectoryEntry get the ones that are users. 我可以遍历此DirectoryEntry的子级来获得用户。 On the Users, I can see these basic properties: UserFlags, MaxStorage, PasswordAge, PasswordExpired, LoginHours, FullName, Description, BadPasswordAttempts, LastLogin, HomeDirectory, LoginScript, Profile, HomeDirDrive, Parameters, PrimaryGroupID, Name, MinPasswordLength, MaxPasswordAge, MinPasswordAge, PasswordHistoryLength, AutoUnlockInterval, LockoutObservationInterval, MaxBadPasswordsAllowed, objectSid. 在用户上,我可以看到以下基本属性:UserFlags,MaxStorage,PasswordAge,PasswordExpired,LoginHours,FullName,Description,BadPasswordAttempts,LastLogin,HomeDirectory,LoginScript,Profile,HomeDirDrive,Parameters,PrimaryGroupID,名称,MinPasswordLength,MaxPasswordAge,MinPasswordAge,PasswordHistoryLength ,AutoUnlockInterval,LockoutObservationInterval,MaxBadPasswordsAllowed,objectSid。

There are a number of User properties that are visible in the Active Directory MMC that are not accessible from the DirectoryEntry object including: LastName, NameSuffix, Department, etc... Active Directory MMC中有许多用户属性,这些属性无法从DirectoryEntry对象访问,包括:LastName,NameSuffix,Department等。

These other properties are all documented in msdn as being exposed by IADsUser ( http://msdn.microsoft.com/en-us/library/aa746340%28VS.85%29.aspx ). 这些其他属性都在msdn中记录为由IADsUser公开( http://msdn.microsoft.com/zh-cn/library/aa746340%28VS.85%29.aspx )。

1) Is LDAP actually a vulnerable protocol? 1)LDAP实际上是易受攻击的协议吗? More so than the ADSI (WinNT) connection shown above? 不仅仅是上面显示的ADSI(WinNT)连接? LDAP seems to be pretty common for this purpose. 为此目的,LDAP似乎很常见。

2) How can I retrieve/set these other properties of the User? 2)如何检索/设置用户的这些其他属性?

TIA TIA

1- LDAP packet transmission is performed as plaintext, so somebody can capture your data. 1- LDAP数据包传输以纯文本格式执行,因此有人可以捕获您的数据。 If you use LDAPS protocol or TLS-enable your LDAP connection, it is safe. 如果您使用LDAPS协议或启用TLS的LDAP连接,则这是安全的。 ADSI is just an implementation of LDAP client by Microsoft, and it supports both LDAP and LDAPS connections. ADSI只是Microsoft的LDAP客户端的实现,它同时支持LDAP和LDAPS连接。 When you use ADSI against your corporate Active Directory, it primarily tries to start a LDAPS connection. 当您对公司的Active Directory使用ADSI时,它主要尝试启动LDAPS连接。 So you are safe of you use ADSI; 因此,您可以放心使用ADSI。 or you can use any other client or programming library as well if you use secure connection. 或者,如果使用安全连接,也可以使用任何其他客户端或编程库。 the default port for LDAPS is 636. LDAPS的默认端口为636。

2- To get more information about directory objects, you can use the GetInfoEx method, it loads exactly the attributes you want. 2-要获取有关目录对象的更多信息,可以使用GetInfoEx方法,该方法将完全加载所需的属性。 Below you can see an example: http://msdn.microsoft.com/en-us/library/aa746411%28v=vs.85%29.aspx 在下面您可以看到一个示例: http : //msdn.microsoft.com/zh-cn/library/aa746411%28v=vs.85%29.aspx

But some of the properties that you look for, are stored in the Active Directory by attribute names different from the MMC console. 但是,您要查找的某些属性是通过与MMC控制台不同的属性名称存储在Active Directory中的。 eg First name is stored as 'givenName' and Last name is stored as 'sn'. 例如,名字存储为“ givenName”,姓氏存储为“ sn”。 Look here to find names of attributes you need; 在这里查找所需属性的名称;

You can find more information here . 您可以在此处找到更多信息。

http://www.techgalaxy.net/Docs/Dev/Using_ADSI_and_LDAP_with_AD.htm explains the difference between LDAP and ADSI: http://technet.microsoft.com/en-us/library/cc755809(v=ws.10).aspx includes illustrations. http://www.techgalaxy.net/Docs/Dev/Using_ADSI_and_LDAP_with_AD.htm解释了LDAP和ADSI之间的区别: http : //technet.microsoft.com/zh-cn/library/cc755809( v =ws.10)。 aspx包括插图。

In short, ADSI is a simplified wrapper around LDAP. 简而言之,ADSI是LDAP的简化包装。 If there's any insecurity to it, it's in the binding, which here appears to be SIMPLE (unencrypted plaintext username and password). 如果有任何不安全之处,则在绑定中,这里似乎是SIMPLE(未加密的纯文本用户名和密码)。 If you bind the LDAP connection using any other method (or over an SSL connection), it should be secure. 如果使用任何其他方法(或通过SSL连接)绑定LDAP连接,则它应该是安全的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM