2011-05-16 57 views
3

我们有一个Perl应用程序,它使用CGI :: Application在Solaris上的Apache下运行。这一切都运行良好。我们希望访问由IE浏览器传递的USER_ID变量,并执行一些数据库查询和LDAP查询。Apache + Perl + NTLM/LDAP ==单点登录?

我看了Apache文档,我无法弄清楚如何实现这一点。我们没有从solaris服务器访问互联网(这是一个内联网),所以我们需要自己编译一切。

有没有人有一个检查列表(或教程)的Apache需要什么(模块/插件),以实现这一点,以及它应该如何配置?

+0

为了给适当的反应,你可能要包括你想用的USER_ID做一些细节? – rasjani 2011-06-20 17:54:34

+1

这将如何帮助? – Louis 2011-06-27 23:42:33

回答

0

Apache可以使用mod_ntlm和mod_ldap插件进行身份验证。

在你的情况,我假设你实际上想要使用mod_ntlm和ldap或“活动目录”只是它的后端?

这里有教程,涵盖了建立阶段:在本教程http://sivel.net/2007/05/sso-apache-ad-1/

编译阶段的目的是为基于RPM的Linux平台虽然但TWiki的大约有一种编译的Solaris10这里一些更多的信息:http://twiki.org/cgi-bin/view/Codev/NtlmForSolaris10#How_to_build_your_own_mod_ntlm_b

+0

是的,绝对。换句话说,您首先必须配置Apache以针对Active Directory对用户进行身份验证。只有在完成之后,用户ID才能被Perl使用。 – Ben 2011-06-21 09:21:50

3

NTLM Winbind

我在我们的服务器上使用模块auth_ntlm_winbind_modulemod_auth_ntlm_winbind.so)。您需要安装Samba和winbind,并正确配置并运行。

您可以从Samba项目树下载模块:

git clone git://git.samba.org/jerry/mod_auth_ntlm_winbind.git 

为了通过NTLM身份验证的用户,您有以下指令添加到您的目录设置:

<Directory /srv/http> 
     Allow from all 
     AuthName "NTLM Authentication thingy" 
     NTLMAuth on 
     NTLMAuthHelper "/usr/bin/ntlm_auth --helper-protocol=squid-2.5-ntlmssp" 
     NTLMBasicAuthoritative on 
     AuthType NTLM 
     require valid-user 
     AllowOverride all 
</Directory> 

当然您也需要加载该模块:

LoadModule auth_ntlm_winbind_module /usr/lib/httpd/modules/mod_auth_ntlm_winbind.so 

Windows用户帐户是传递到应用程序的REMOTE_USER:

#!/usr/bin/perl 

use CGI; 
my $query = new CGI; 
# get the windows account from the header 
my $windows_account = $query->remote_user(); 

注意,也就是说,只有用户身份验证数据发送到受信任的站点。

Here's a website与模块上的一些信息。经由LDAP

另一种方法


直接认证是使用模块authnz_ldap_modulemod_authnz_ldap.so)。这可能已经默认加载了。请注意,这不是真实的单用户提示输入密码。

LoadModule authnz_ldap_module modules/mod_authnz_ldap.so 

添加到您的目录定义:

<Directory /srv/http> 
    AuthName "Authentication required" 
    AuthType Basic 
    AuthzLDAPAuthoritative off 
    AuthBasicProvider ldap 

    # "protocol://hostname:port/base?attribute?scope?filter" NONE 
    # NONE indicates that an unsecure connection should be used for LDAP, i.e. port 389 
    AuthLDAPURL "ldap://your.ldap.server.net:389/OU=the,OU=search,OU=node,DC=domain,DC=net?sAMAccountName?sub?(objectClass=*)" NONE 


    # This is only needed if your LDAP server doesn't allow anonymous binds 
    AuthLDAPBindDN "CN=AD Bind User,OU=the,OU=bind,OU=node,DC=domain,DC=net" 
    AuthLDAPBindPassword super-secret 

    Require valid-user 
    AllowOverride all 
</Directory> 

More info about the module.