简体   繁体   中英

Apache 2.4 and LDAP

I had a server running RHEL 6.5 with httpd 2.2, and I had LDAP authentication for web pages working perfectly with this:

<Directory /var/www/html/restricted>
  AuthType Basic
  AuthName "Restricted files"
  AuthBasicProvider file ldap
  AuthUserFile /etc/httpd/local_users
  AuthGroupFile /etc/httpd/local_groups

  AuthLDAPBindDN CN=bind,OU=Generic-Logon,OU=Generic,DC=example,DC=com
  AuthLDAPBindPassword lamepassword
  AuthLDAPURL ldaps://ldap.example.com:636/dc=example,dc=com?sAMAccountName?sub

  AuthzLDAPAuthoritative off

  require group restricted
  require ldap-group CN=ug-employees,OU=Dept,OU=Dept-Groups,DC=example,DC=com
  require ldap-group CN=ug-others,OU=Dept,OU=Dept-Groups,DC=example,DC=com
</Directory>

Users were getting excessive 500 errors accessing the restricted pages, and some Googling tells me that going from httpd 2.2 to 2.4 could solve this. I installed a fresh server with RHEL 7 and httpd 2.4, and that exact same line. But now...

[~]$ sudo apachectl configtest
AH00526: Syntax error on line 426 of /etc/httpd/conf/httpd.conf:
Unknown Authn provider: ldap

What's going on here? The RHEL 7 manual says that LDAP authentication is baked into httpd 2.4, and AFAICT, I'm following the instructions from apache.org. FWIW, I can't any LDAP modules in yum or installed in my /etc/httpd/modules.

Thoughts? I know I'm missing something tiny.

Thanks!

According to Redhat's support site you should run

# subscription-manager repos --enable rhel-7-server-optional-rpms
# yum install mod_ldap -y

See: https://access.redhat.com/solutions/977573

如果您使用的是 Centos 7 或 RHEL 7,这应该可以解决问题:

sudo yum install -y mod_ldap

如果是 Oracle Linux 7,这应该可以帮助您:

yum --enablerepo=ol7_optional_latest   install mod_ldap

These instructions on the Red Hat website explain how to enable the appropriate yum repositories to expose mod_ldap , as well as other packages on which it might depend or that may be useful in your situation.

Also, in short, this is what I had to do to get it working on RHEL 7:

---- Displays which repos are enabled/disabled
$ sudo yum repolist all

---- Enable these two repos to get mod_ldap and other things...
$ sudo yum-config-manager --enable rhel-server-rhscl-7-rpms
$ sudo yum-config-manager --enable rhel-7-server-optional-rpms

If you're using Debian / Ubuntu and came to this page because you're getting the error:

Unknown Authn provider: ldap

then this command should fix it (prefix with sudo if not running as root):

a2enmod authnz_ldap

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM