0037.html 4.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <!DOCTYPE html>
  2. <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <title>Setting Up LDAP Authenticated Directory in Apache HTTPD</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6. <meta charset="UTF-8">
  7. <meta name="keywords" content="Web Server,Apache Httpd,Apache,Web Developer,System Administrator,PHP,Active Directory,LDAP,Home Lab,Lightweight Directory Access Protocol,Browser Based,Install Guide,Self-Hosted,Web Based,Administration,Apache HTTPD,Apache HTTPD Administration,Windows,Web Server Administration,Web Server Customization,PHP LDAP Authentication,PHP LDAP,PHP Active Directory Authentication,PHP Active Directory Access,Microsoft Windows">
  8. <meta name="author" content="i12bretro">
  9. <meta name="description" content="Setting Up LDAP Authenticated Directory in Apache HTTPD">
  10. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  11. <meta name="revised" content="03/26/2022 09:37:12 AM" />
  12. <link rel="icon" type="image/x-icon" href="includes/favicon.ico">
  13. <script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
  14. <script type="text/javascript" src="includes/js/steps.js"></script>
  15. <link href="css/steps.css" rel="stylesheet" type="text/css" />
  16. </head>
  17. <body>
  18. <div id="gridContainer">
  19. <div class="topMargin"></div>
  20. <div id="listName" class="topMargin">
  21. <h1>Setting Up LDAP Authenticated Directory in Apache HTTPD</h1>
  22. </div>
  23. <div></div>
  24. <div id="content">
  25. <p>In this quick video learn how to setup LDAP/Active Directory authentication on an Apache webserver to secure web based applications.</p>
  26. <h2>Active Directory Setup</h2>
  27. <ol>
  28. <li>Open Active Directory Users and Computers</li>
  29. <li>Expand the domain &gt; Users</li>
  30. <li>Right Click Users &gt; New &gt; User</li>
  31. <li>Create a read only account to use for LDAP binding<br />
  32. First Name: Read<br />
  33. Last Name: Only<br />
  34. User logon name: readonly_svc</li>
  35. <li>Click Next</li>
  36. <li>Set the user&#39;s password and confirm it</li>
  37. <li>Uncheck User must change password on next logon</li>
  38. <li>Check User cannot change password</li>
  39. <li>Check Password never expires</li>
  40. <li>Click Next</li>
  41. <li>Click Finish</li>
  42. <li>Right Click Users &gt; New &gt; Group</li>
  43. <li>Give the group a name and click OK</li>
  44. <li>Right Click the newly created group &gt; Properties</li>
  45. <li>Select the Members tab &gt; Click Add...</li>
  46. <li>Add users that will be allowed access to the web application</li>
  47. <li>Click OK</li>
  48. </ol>
  49. <h2>Configuring Apache HTTPD for LDAP</h2>
  50. <ol>
  51. <li>Navigate to the Apache install directory/conf in Explorer</li>
  52. <li>Edit httpd.conf in a text editor</li>
  53. <li>Find the authnz_ldap_module and make sure it is enabled by removing the # at the start of the line
  54. <p>LoadModule authnz_ldap_module modules/mod_authnz_ldap.so</p>
  55. </li>
  56. <li>Find the ldap_module and make sure it is enabled by removing the # at the start of the line
  57. <p>LoadModule ldap_module modules/mod_ldap.so</p>
  58. </li>
  59. <li>Create a Location block to enable LDAP authentication for the specified directory
  60. <p>&lt;location /ldaptest&gt;<br />
  61. # Basic authentication with LDAP against MS AD<br />
  62. AuthType Basic<br />
  63. AuthBasicProvider ldap<br />
  64. <br />
  65. # AuthLDAPURL specifies the LDAP server IP, port, base DN, scope and filter<br />
  66. # using this format: ldap://host:port/basedn?attribute?scope?filter<br />
  67. AuthLDAPURL &quot;ldap://i12bretro.local:389/DC=i12bretro,DC=local?sAMAccountName?sub?(objectClass=user)&quot; NONE<br />
  68. <br />
  69. # The LDAP bind username and password<br />
  70. AuthLDAPBindDN &quot;readonly_svc@i12bretro.local&quot;<br />
  71. AuthLDAPBindPassword &quot;Read0nly!!&quot;<br />
  72. LDAPReferrals Off<br />
  73. AuthUserFile /dev/null<br />
  74. <br />
  75. AuthName &quot;Restricted Area [i12bretro.local]&quot;<br />
  76. # to authenticate a domain group, specify the full DN<br />
  77. AuthLDAPGroupAttributeIsDN on<br />
  78. require ldap-group CN=WebAuthAccess,CN=Users,DC=i12bretro,DC=local<br />
  79. &lt;/location&gt;</p>
  80. </li>
  81. <li>Save httpd.conf</li>
  82. <li>Restart the Apache service</li>
  83. <li>Open a browser and navigate to the LDAP authenticated URL</li>
  84. <li>An authentication prompt should appear, allowing only users in the AD group specified access</li>
  85. </ol>
  86. </div>
  87. </div>
  88. </body>
  89. </html>