Apache HTTPD整合AD身份认证 — Apache HTTPD authentication against Active Directory
以前使用过php_LDAP来实现网页登录认证,但是apache本身也有LDAP认证模块,自httpd-2.2以后更名为mod_authz_ldap,实现与LDAP/Active Directory服务器联合认证。本次操作实现于CentOS 5.3,默认安装Apache HTTPD组件,mod_authz_ldap模块需要手动安装:
顺利安装后,/etc/httpd/conf.d/目录下会有authz_ldap.conf配置文件,使用vi编辑器打开后,可以看到mod_authz_ldap已经加载
准备Active Directory认证所需要的设置信息:
首先需要确定登录用户所在的节点位置(OU),可以使用LDAP Browser等工具获得,例如:
另外,需要一个AD验证账号,实现LDAP Bind,不需要域管理员权限,这里设置为ldap,密码为ABCabc123
编辑authz_ldap.conf文件,对需要进行认证访问的目录做相关设置如下:
AuthzLDAPMethod ldap
AuthzLDAPAuthoritative on
AuthzLDAPServer ldap.wardking.com:389
AuthzLDAPUserBase “OU=users,OU=Studio,DC=wardking,DC=com”
AuthzLDAPUserKey sAMAccountName
AuthzLDAPUserScope subtree
AuthzLDAPBindDN “ldap@wardking.com”
AuthzLDAPBindPassword “ABCabc123″
AuthType Basic
AuthName “Wardking Studio”
require valid-user
最后重启 httpd服务检测设置是否通过,遇到错误时先查看/var/log/httpd/error