2011-05-16 52 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.