0037.html 4.0 KB

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