尝试使用AD验证Apache-内部服务器错误

dzjeubhm  于 7个月前  发布在  Apache
关注(0)|答案(1)|浏览(67)

我希望我的用户通过Active Directory登录到我的Apache网站。我得到一个登录提示,但随后我得到内部服务器错误:
服务器遇到内部错误或配置错误,无法完成您的请求。出现此错误的根本原因取决于处理该错误的是哪一个模块以及出现此错误时工作进程中出现了何种情况。有关此错误的详细信息,请参阅服务器错误日志。
这是我的设置。

"Red Hat Enterprise Linux"
VERSION="9.2 (Plow)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="9.2"

httpd -v
Server version: Apache/2.4.53 (Red Hat Enterprise Linux)
Server built:   Apr 28 2023 00:00:00

使用LDAP和Apache HTTPD进行HTTP基本身份验证(https://access.redhat.com/solutions/20284
它说把这个添加到httpd.conf

<Directory /directory/ldap_auth_needed>
        Options Indexes FollowSymLinks
        AllowOverride None
        order allow,deny
        allow from all
        AuthType Basic
        AuthName Internal
        AuthBasicAuthoritative off
        AuthBasicProvider ldap
        AuthzLDAPAuthoritative off
        # AuthLDAPURL ldap://<ldap server ip>/<base DN>
        AuthLDAPURL ldap://ldap.example.com/dc=example,dc=com   
        require valid-user
        AuthLDAPBindDN cn=Manager,dc=example,dc=com
        AuthLDAPBindPassword secret
    </Directory>

它还指出,在httpd 2.4.x中,已删除了AuthzLDAP Authoritative、AuthzDBDAuthoritative、AuthzDBMAuthoritative、AuthzGroupFileAuthoritative、AuthzUserAuthoritative和AuthzOwnerAuthoritative指令
因此,对于我的域acme.corp,我将使用帐户bindAcc,我实际上在Rundeck服务器上使用该帐户进行AD身份验证。另外,我想先用/var/www/html/private进行测试,它包含一个文件,new.html
下面是我添加到httpd.conf中的内容

<Directory /var/www/html/private>
        Options Indexes FollowSymLinks
        AllowOverride None
        order allow,deny
        allow from all
        AuthType Basic
        AuthName "private"
        AuthBasicAuthoritative off
        AuthBasicProvider ldap
        AuthLDAPURL ldap://server:389/OU=Users,OU=Management,dc=acme,dc=corp?sAMAccountName?sub?(objectClass=*)
        require valid-user
        AuthLDAPBindDN "CN=bindACC,OU=Service Accounts,OU=Management,DC=acme,DC=corp"
        AuthLDAPBindPassword password##!!
    </Directory>

对于“require”,我已经尝试了“ldap-user =Users,admin =Management,DC=acme,DC=corp”,但没有成功。
Apache Linux服务器加入到域中。
我去http://mywebsite/private/new.html.在日志里看到这个
/var/log/httpd/access_log .
10.120.10.189 - bindACC [06/Oct/2023:11:55:35 -0400]“GET/private/new.html HTTP/1.1”500 527“-”“Mozilla/5.0(Windows NT 10.0; Win64; x64)AppleWebKit/537.36(KHTML,like Gecko)Chrome/117.0.0.0 Safari/537.36”
/var/log/httpd/error_log .
Fri Oct 06 11:55:35.326078 2023] [authn_core:error] [pid 177338:tid 177378] [client 10.120.10.189:57483] AH01796:AuthType Basic配置没有对应模块
我试着把它添加到httpd. conf。

LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
    LoadModule ldap_module modules/mod_ldap.so

但在httpd重启错误日志显示

[so:warn] [pid 176628:tid 176628] AH01574: module authnz_ldap_module is already loaded, skipping.
    [so:warn] [pid 176628:tid 176628] AH01574: module ldap_module is already loaded, skipping.

httpd的输出显示模块已加载。

httpd.
    [Fri Oct 06 12:01:04.971547 2023] [so:warn] [pid 180550:tid 180550] AH01574: module authnz_ldap_module is already loaded, skipping.
    [Fri Oct 06 12:01:04.971620 2023] [so:warn] [pid 180550:tid 180550] AH01574: module ldap_module is already loaded, skipping.
    httpd (pid 176628) already running.

我做错了什么?谢谢

xfyts7mz

xfyts7mz1#

我暂时修好了。

<Directory /var/www/html/private>
    allow from all
    AuthType Basic
    AuthName "Internal"
    AuthBasicAuthoritative off
    AuthBasicProvider ldap
    AuthLDAPURL "ldap://server:389/OU=Users,OU=Management,dc=acme,dc=corp?sAMAccountName?sub?(objectClass=*)"
    Require valid-user
    AuthLDAPBindDN [email protected]
    AuthLDAPBindPassword XXXXXXXXXX
</Directory>

相关问题