Ad Code

Responsive Advertisement

Ticker

6/recent/ticker-posts

Apache2 使用LDAP進行Windows AD帳號認證

  • Copy "/etc/apache2/mods-available/authnz_ldap.load" to the "/etc/apache2/mods-enabled/"
  • Add the following code to the "/etc/apache2/apache2.conf"

Alias /sam "/home/sammmmmm/sam"
<Directory "/home/sammmmmm/sam">
Options Indexes FollowSymLinks
Allowoverride authconfig
Order allow,deny
Allow from all
AuthName "test"
AuthType basic
AuthBasicProvider ldap
#AuthLDAPAuthoritative on
#AuthLDAPEnabled on
AuthLDAPURL "ldap://10.178.187.78:389/DC=delta,DC=corp?sAMAccountName?sub?(objectClass=*)"
AuthLDAPBindDN "ad.account"
AuthLDAPBindPassword PassW@orD
require valid-user
</Directory>


  • Add .htaccess file to /home/sammmmmm/sam folder, And add the following code to the ".htaccess" file  
<RequireAny>
Require ldap-group CN=ITClientAll,OU=Groups,OU=TW1,OU=TW,OU=Sam,DC=sam,DC=corp
Require ldap-group CN=ITClient,OU=Groups,OU=TW1,OU=TW,OU=Sam,DC=sam.,DC=corp
</RequireAny>


Unknown Authn provider: ldap

Dec 25 03:14:55 TWCL5TMS01 apachectl[10229]: AH00526: Syntax error on line 183 of /etc/apache2/apache2.conf:

Dec 25 03:14:55 TWCL5TMS01 apachectl[10229]: Unknown Authn provider: ldap

sudo a2enmod ldap
sudo a2enmod authnz_ldap


  • Reference :
    1. Securing Apache HTTPD with Microsoft Active Directory
    2. 利用ldap進行windows ad賬號認證(2)