NTLM Authentication

由 ifly3years@drup... 于 周四, 2006-11-23 01:34 提交。

NTLM Authentication

NTLM认证

NTLM is a proprietary (and not so good) protocol for deploying Single Sign On in predominantly Windows oriented networks (our company network also). NTLM sits on top of HTTP, so users who are logged on to the Windows Active Directory network can transparently log-on to web services using their Microsoft Windows credentials (and thereby having Single Sign On). Getting IIS servers working with NTLM is easy (it should be), but traditionaly Apache servers have had problems in doing this.
NTLM是一种在windows导向的网络(也是我们公司的网络)中使用的单一签名独占(不一定很好)的协议。NTLM在HTTP的最顶端,登录到windows活动目录的用户可以传输

这篇文档说明了如何在LINUX+apache 的drupal中通过NTLM认证

有几种方式在Apache中可以通过NTLM认证。

• Mod_ntlm-是一个可以添加NTLM支持的apache模块。该模块并不常用,并且,在不同的版本的apache中编译和运行是一个非常困难的工作。要使用他,编译可能会弹出很多警告信息,使人感到很不方便。
• mod_ntlm_winbind-为有winbind的box设置的。这个模块可以为apache提供NTLM认证。然而,这个模块还在继续开发并且没有得到很好的测试。

总之,为了帮助在这样不友好的情况下工作的人们,有一个出色的perl 模块可以提供对NTLM的很好的支持。

按照下面的步骤来实现NTLM认证

1. 在apache下安装/配置 mod_perl,并使之正常工作。
2. 下载下面的文件(英文)
Fedora 核心的系统 下载的模块
http://search.cpan.org/~speeves/Apache2-AuthenNTLM-0.02/AuthenNTLM.pm
Debian linux系统 需要下载
http://search.cpan.org/~speeves/Apache-AuthenNTLM-2.10
3 安装下载的模块
tar xvfz Apache*AuthenNTLM*.tgz
cd Apache*AuthenNTLM*
perl Makefile.PL
make
make test
make install

4. Edit the Apache configuration and enable KeepAlive
5. 编辑apache的配置文件,启用keepalive。
KeepAlive On

重启动apache服务

6. 配置apache能进行认证。在.htaccess中添加

# Enable the Authentication module
             PerlAuthenHandler Apache2::AuthenNTLM
            
             # Do NTLM and basic authentication
             AuthType ntlm,basic
            
             # The name that should be displayed in the Auth box, if NTLM fails
             AuthName OurCompany
            
             # Ask for a valid user.
             require valid-user
            
             #                    domain      pdc         bdc
             # Domain : Your windows domain
             # pdc : Primary Domain Controller
             # bdc : Backup Domain controller.
             #
             # Note : Multiple domains can be specified.
            
             PerlAddVar ntdomain  "OURDOMAIN  domainpdc domainsdc"
            
             # What should be the default domain
             PerlSetVar defaultdomain OURDOMAIN
            
             # The user names are in the form "OURDOMAIN\user_name". Let us split it.
             PerlSetVar splitdomainprefix 1
            
             # Set the debug variables
             PerlSetVar ntlmdebug 0
             PerlSetVar ntlmauthoritative off
            

可以在tarballlink中的readme文件中看到更多的文档信息。

一旦这些做完了,域用户将作为在apache服务器中设置为REMOTE_USER变量,可以被用来进行验证

7. 现在,我们需要启用drupl来检查用户ID和自动创建用户。一旦我们启用了NTLM验证,用户ID将作为REMOTE_USER。Webserver auth模块可以使用这个变量来自动登录用户。

下载,安装,启用和配置webserver auth 模块。你就可以把drupal嵌入一个基于windows的活动目录的网络中了。