Setting Up LDAP Authenticated Directory in Apache HTTPD
i12bretro
#PHP #ApacheHTTPD #ActiveDirectory
Full steps can be found at https://i12bretro.github.io/tutorials/0037.html
In this quick video learn how to setup LDAP Active Directory authentication on an Apache webserver to secure web based applications.
Active Directory Setup
- Open Active Directory Users and Computers
- Expand the domain - Users
- Right Click Users - New - User
- Create a read only account to use for LDAP binding First Name: Read Last Name: Only User logon name: readonly_svc
- Click Next
- Set the user's password and confirm it
- Uncheck User must change password on next logon
- Check User cannot change password
- Check Password never expires
- Click Next
- Click Finish
- Right Click Users - New - Group
- Give the group a name and click OK
- Right Click the newly created group - Properties
- Select the Members tab - Click Add...
- Add users that will be allowed access to the web application
- Click OK
Configuring Apache HTTPD for LDAP
Navigate to the Apache install directory/conf in Explorer
Edit httpd.conf in a text editor
Find the authnz_ldap_module and make sure it is enabled by removing the # at the start of the line LoadModuleauthnz_ldap_modulemodules/mod_authnz_ldap.so
Find the ldap_module and make sure it is enabled by removing the # at the start of the line LoadModuleldap_modulemodules/mod_ldap.so
Create a Location block to enable LDAP authentication for the specified directory
#BasicauthenticationwithLDAPagainstMSAD AuthTypeBasic AuthBasicProviderldap
#AuthLDAPURLspecifiestheLDAPserverIP,port,baseDN,scopeandfilter #usingthisformat:ldap://host:port/basedn?attribute?scope?filter AuthLDAPURL"ldap://i12bretro.local:389/DC=i12bretro,DC=local?sAMAccountName?sub?(objectClass=user)"NONE
#TheLDAPbindusernameandpassword AuthLDAPBindDN"readonly_svc@i12bretro.local" AuthLDAPBindPassword"Read0nly!!" LDAPReferralsOff AuthUserFile/dev/null
AuthName"RestrictedArea[i12bretro.local]" #toauthenticateadomaingroup,specifythefullDN AuthLDAPGroupAttributeIsDNon requireldap-groupCN=WebAuthAccess,CN=Users,DC=i12bretro,DC=local
Save httpd.conf
Restart the Apache service
Open a browser and navigate to the LDAP authenticated URL
An authentication prompt should appear, allowing only users in the A ... https://www.youtube.com/watch?v=ysqKUzgCCi4
19527172 Bytes