将Active Directory与第三方LDAP集成

时间:2011-11-29 21:16:38

标签: windows active-directory ldap embedded-linux

我们生产这些基于Linux的设备,我们希望与Active Directory集成。

我想知道以下工作流程是否可行:

客户端安装我们的设备,在网络上获取它。 Windows SysAdmin使用其标准工具集中的某些内容将我们的设备添加为具有关于权限和权限的自定义抽象的资源。

从设备的角度来看;通过SysAdmin配置AD服务器(从而连接到它),Linux设备将能够将该服务器用作身份验证代理,而Windows SysAdmin不必直接连接或配置设备。

所以基本上,它是一个插件解决方案,可以通过AD服务器以某种方式连接和验证它来添加特定于我们技术的新抽象。

我没有为公司IT管理和配置AD的实际经验,所以我不知道这是否可能。谢谢你的帮助!

1 个答案:

答案 0 :(得分:1)

几乎不存在适用于所有AD情况的插件解决方案!它通常需要一些系统管理员工作才能实现。

您的设备需要询问许多字段,例如服务器地址,服务器端口,使用SSL,代理代理(应用名称和应用DN),代理密码,基本DN和代理模式。

然后您的设备应用程序,Java或PHP或其他任何东西,需要实现LDAP协议,只需进行身份验证检查。

我已经将企业LDAP与Wordpress和Mediawiki集成在一起(在他们有插件之前),它非常简单,只是不是即插即用。

我在PHP中使用了两个文件 - 一个带有设置,另一个带有auth功能。在任何PHP应用程序中包含这两个,只需传递输入的用户名和密码,然后返回经过身份验证的用户信息,如姓名,电子邮件等......

这是我第一次使用它时创建的测试页。

<html><body>
<?php

# Matt Hart - PHP-based authentication against active directory
# Tested on Fedora Core 4 with Apache 2.0.54, PHP 4.3.11, OpenLDAP
# OpenSSL, php-ldap
# Working on RHEL4

echo "<br>Attempting Secure LDAP Connection<br>";

// $mh_ldaphost = "ldaps://directory.yoursite.com:636";
$mh_ldaphost = "ldaps://ldap.yoursite.com:636";
$mh_ldapconn = ldap_connect($mh_ldaphost) or die ("Failed");
echo "<br>Succeeded ... Testing app binding<br>";

# Bind using app credentials
$mh_appid = "yourappid"; // ****** Use your application id
$mh_dn = "uid=" . $mh_appid . ",ou=Apps,o=Yoursite.com";
$mh_bind = ldap_bind($mh_ldapconn, $mh_dn) or die("Failed");
echo "<br>Succeeded ... Get user corp ID</br>";

# Get the user's corporate ID
$mh_search = "ou=employees,ou=people,o=yoursite.com";
$mh_userid = "johnny"; // ****** User ID to find
$mh_filter = "(uid=" . $mh_userid . ")";
$mh_search = ldap_search($mh_ldapconn, $mh_search, $mh_filter) or die ("Failed");
echo "<br>Succeeded: ";
$mh_entries = ldap_get_entries($mh_ldapconn, $mh_search);
$mh_corpid = $mh_entries[0]["corpidfield"][0];
echo "CorpID=" . $mh_corpid;

# Authenticate the user
echo "<br><br>Authenticating...<br>";

$mh_authdn = "corpidfield=" . $mh_corpid . ",ou=employees,ou=people,o=yoursite.com";
$mh_authpass = "Depp1"; // ****** User password
$mh_authbind = ldap_bind($mh_ldapconn, $mh_authdn, $mh_authpass) or die("Failed");
die("Success");

?>
</body></html>

您还可以打印整个条目[]数组,以查看可以返回的内容。

相关问题