Active directory 将LDAP查询的范围扩大到Active Directory

Active directory 将LDAP查询的范围扩大到Active Directory,active-directory,ldap,Active Directory,Ldap,我正在尝试使用LDAP对公司Active Directory进行身份验证。ADExplorer向我展示了目录的设置方式: Active Directory Explorer -- MyCompany.com +- DC=MyCompany, DC=com +- OU=Domain Controllers +- OU=MyCompany Locations +- OU=BR +- OU=CA +- OU=DE |+- OU=Munich |+- OU=MyT

我正在尝试使用LDAP对公司Active Directory进行身份验证。ADExplorer向我展示了目录的设置方式:

Active Directory Explorer
-- MyCompany.com
 +- DC=MyCompany, DC=com
  +- OU=Domain Controllers
  +- OU=MyCompany Locations
   +- OU=BR
   +- OU=CA
   +- OU=DE
   |+- OU=Munich
   |+- OU=MyTown
   ||+- OU=Users & Computers
   |||+- OU=Users
   ||||+- CN=Firstname1 Lastname1
   ||||+- CN=Firstname2 Lastname2
当我选择一个特定的用户时,例如我自己,我看到广告路径如下表所示

OU=用户,OU=用户和计算机,OU=MyTown,OU=DE,OU=MyCompany 地点,DC=MyCompany,DC=com

我在应用程序的config.php中设置了LDAP选项,如下所示:

$ldap_base_dn_ar[0]['attribute_name'] = 'ou';
$ldap_base_dn_ar[0]['attribute_value'] = 'Users';

$ldap_base_dn_ar[1]['attribute_name'] = 'ou';
$ldap_base_dn_ar[1]['attribute_value'] = 'Users & Computers';

$ldap_base_dn_ar[2]['attribute_name'] = 'ou';
$ldap_base_dn_ar[2]['attribute_value'] = 'MyTown';

$ldap_base_dn_ar[3]['attribute_name'] = 'ou';
$ldap_base_dn_ar[3]['attribute_value'] = 'DE';

$ldap_base_dn_ar[4]['attribute_name'] = 'ou';
$ldap_base_dn_ar[4]['attribute_value'] = 'MyCompany Locations';

$ldap_base_dn_ar[5]['attribute_name'] = 'dc';
$ldap_base_dn_ar[5]['attribute_value'] = 'MyCompany';

$ldap_base_dn_ar[6]['attribute_name'] = 'dc';
$ldap_base_dn_ar[6]['attribute_value'] = 'com';
这是可行的,但我怀疑它只适用于我所在城市和国家的用户

我将如何更改它以允许来自任何国家/地区的任何城镇的LDAP身份验证


根据Gabriel Luci的评论:

你说“我怀疑”-你测试过吗?也许它已经按照你想要的方式工作了

我目前没有外国登录名。我会设置一个或找人测试它

但您只需指定OU=MyCompany位置,因为所有内容都在该位置下


如果我如上图所示减少LDAP选项,身份验证将失败。

你说“我怀疑”-你测试过吗?也许它已经按照你想要的方式工作了。但是你应该只需要指定
OU=MyCompany Locations
,因为所有的东西都在下面。谢谢,@GabrielLuci。请参阅更新。您的应用程序如何进行身份验证?用户在登录屏幕上输入用户名/密码,应用程序使用该用户名/密码组合发出LDAP请求。这是一个带有Ioncube加密的商业PHP应用程序(低代码web应用程序生成器),因此我怀疑我是否能弄清楚它在做什么。搜索LDAP时,可以指定一个“范围”,可以将其设置为“一个级别”以仅搜索一个级别,或指定“子树”以搜索下面的所有级别。它是否为您提供了设置范围的选项?
$ldap_base_dn_ar[0]['attribute_name'] = 'ou';
$ldap_base_dn_ar[0]['attribute_value'] = 'MyCompany Locations';

$ldap_base_dn_ar[1]['attribute_name'] = 'dc';
$ldap_base_dn_ar[1]['attribute_value'] = 'MyCompany';

$ldap_base_dn_ar[2]['attribute_name'] = 'dc';
$ldap_base_dn_ar[2]['attribute_value'] = 'com';