gpt4 book ai didi

Apache + Perl + NTLM/LDAP == 单点登录?

转载 作者:行者123 更新时间:2023-12-02 00:32:46 51 4
gpt4 key购买 nike

我们有一个 Perl 应用程序,它使用 CGI::Application 在 Solaris 上的 Apache 下运行。这一切都运行良好。我们想访问 IE 浏览器传递的 USER_ID 变量,并进行一些数据库查询和 LDAP 查询。

我查看了 Apache 文档,但我不知道如何实现这一点。我们无法从 solaris 服务器访问互联网(这是一个内部网),因此我们需要自己编译所有内容。

有没有人有 Apache 需要什么(模块/插件)来实现这一目标的 list (或教程),以及应该如何配置它?

最佳答案

NTLM 绑定(bind)

我在我们的服务器上使用模块 auth_ntlm_winbind_module (mod_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();

请注意,IE 仅将用户身份验证数据发送到受信任的站点。

Here's a website有关该模块的更多信息。


通过 LDAP 直接验证

另一种方法是使用模块authnz_ldap_module (mod_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.

关于Apache + Perl + NTLM/LDAP == 单点登录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6014405/

51 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com