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

问题描述 投票:0回答:1

我希望我的用户通过 Active Directory 登录我的 Apache 网站。我收到登录提示,但随后收到内部服务器错误:

服务器内部错误 服务器遇到内部错误或配置错误,无法完成您的请求。 请通过 root@localhost 联系服务器管理员,告知他们此错误发生的时间以及您在出现此错误之前执行的操作。 有关此错误的更多信息可能会在服务器错误日志中提供。

这是我的设置。

"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

我按照 Red Hat 文章使用 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中,指令AuthzLDAPAuthoritative、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>

对于“要求”,我尝试过“ldap-user OU = Users,OU = Management,DC = acme,DC = corp” 那不起作用。

Apache linux 服务器已通过 Realm 加入域。

我访问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,如 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.

我做错了什么? 谢谢

apache ldap redhat
1个回答
0
投票

我现在可以使用了。

<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>
© www.soinside.com 2019 - 2024. All rights reserved.