📄 mod_authnz_ldap.html.en
字号:
users must authenticate using their UID. <div class="example"><p><code>AuthLDAPURL ldap://ldap.airius.com/o=Airius?uid<br />Require ldap-group cn=Administrators, o=Airius</code></p></div> </li> <li> The next example assumes that everyone at Airius who carries an alphanumeric pager will have an LDAP attribute of <code>qpagePagerID</code>. The example will grant access only to people (authenticated via their UID) who have alphanumeric pagers: <div class="example"><p><code>AuthLDAPURL ldap://ldap.airius.com/o=Airius?uid??(qpagePagerID=*)<br />Require valid-user</code></p></div> </li> <li> <p>The next example demonstrates the power of using filters to accomplish complicated administrative requirements. Without filters, it would have been necessary to create a new LDAP group and ensure that the group's members remain synchronized with the pager users. This becomes trivial with filters. The goal is to grant access to anyone who has a pager, plus grant access to Joe Manager, who doesn't have a pager, but does need to access the same resource:</p><div class="example"><p><code>AuthLDAPURL ldap://ldap.airius.com/o=Airius?uid??(|(qpagePagerID=*)(uid=jmanager))<br />Require valid-user</code></p></div> <p>This last may look confusing at first, so it helps to evaluate what the search filter will look like based on who connects, as shown below. If Fred User connects as <code>fuser</code>, the filter would look like</p> <div class="example"><p><code>(&(|(qpagePagerID=*)(uid=jmanager))(uid=fuser))</code></p></div> <p>The above search will only succeed if <em>fuser</em> has a pager. When Joe Manager connects as <em>jmanager</em>, the filter looks like</p> <div class="example"><p><code>(&(|(qpagePagerID=*)(uid=jmanager))(uid=jmanager))</code></p></div> <p>The above search will succeed whether <em>jmanager</em> has a pager or not.</p> </li> </ul></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="section"><h2><a name="usingtls" id="usingtls">Using TLS</a></h2> <p>To use TLS, see the <code class="module"><a href="../mod/mod_ldap.html">mod_ldap</a></code> directives <code class="directive"><a href="../mod/mod_ldap.html#ldaptrustedclientcert">LDAPTrustedClientCert</a></code>, <code class="directive"><a href="../mod/mod_ldap.html#ldaptrustedglobalcert">LDAPTrustedGlobalCert</a></code> and <code class="directive"><a href="../mod/mod_ldap.html#ldaptrustedmode">LDAPTrustedMode</a></code>.</p> <p>An optional second parameter can be added to the <code class="directive"><a href="#authldapurl">AuthLDAPURL</a></code> to override the default connection type set by <code class="directive"><a href="../mod/mod_ldap.html#ldaptrustedmode">LDAPTrustedMode</a></code>. This will allow the connection established by an <em>ldap://</em> Url to be upgraded to a secure connection on the same port.</p></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="section"><h2><a name="usingssl" id="usingssl">Using SSL</a></h2> <p>To use SSL, see the <code class="module"><a href="../mod/mod_ldap.html">mod_ldap</a></code> directives <code class="directive"><a href="../mod/mod_ldap.html#ldaptrustedclientcert">LDAPTrustedClientCert</a></code>, <code class="directive"><a href="../mod/mod_ldap.html#ldaptrustedglobalcert">LDAPTrustedGlobalCert</a></code> and <code class="directive"><a href="../mod/mod_ldap.html#ldaptrustedmode">LDAPTrustedMode</a></code>.</p> <p>To specify a secure LDAP server, use <em>ldaps://</em> in the <code class="directive"><a href="#authldapurl">AuthLDAPURL</a></code> directive, instead of <em>ldap://</em>.</p></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="section"><h2><a name="exposed" id="exposed">Exposing Login Information</a></h2> <p>When this module performs authentication, LDAP attributes specified in the <code class="directive"><a href="#authldapurl">AuthLDAPUrl</a></code> directive are placed in environment variables with the prefix "AUTHENTICATE_".</p> <p>If the attribute field contains the username, common name and telephone number of a user, a CGI program will have access to this information without the need to make a second independent LDAP query to gather this additional information.</p> <p>This has the potential to dramatically simplify the coding and configuration required in some web applications.</p></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="section"><h2><a name="frontpage" id="frontpage">Using Microsoft FrontPage with mod_authnz_ldap</a></h2> <p>Normally, FrontPage uses FrontPage-web-specific user/group files (i.e., the <code class="module"><a href="../mod/mod_authn_file.html">mod_authn_file</a></code> and <code class="module"><a href="../mod/mod_authz_groupfile.html">mod_authz_groupfile</a></code> modules) to handle all authentication. Unfortunately, it is not possible to just change to LDAP authentication by adding the proper directives, because it will break the <em>Permissions</em> forms in the FrontPage client, which attempt to modify the standard text-based authorization files.</p> <p>Once a FrontPage web has been created, adding LDAP authentication to it is a matter of adding the following directives to <em>every</em> <code>.htaccess</code> file that gets created in the web</p><div class="example"><pre>AuthLDAPURL "the url"AuthGroupFile <em>mygroupfile</em>Require group <em>mygroupfile</em></pre></div><h3><a name="howitworks" id="howitworks">How It Works</a></h3> <p>FrontPage restricts access to a web by adding the <code>Require valid-user</code> directive to the <code>.htaccess</code> files. The <code>Require valid-user</code> directive will succeed for any user who is valid <em>as far as LDAP is concerned</em>. This means that anybody who has an entry in the LDAP directory is considered a valid user, whereas FrontPage considers only those people in the local user file to be valid. By substituting the ldap-group with group file authorization, Apache is allowed to consult the local user file (which is managed by FrontPage) - instead of LDAP - when handling authorizing the user.</p> <p>Once directives have been added as specified above, FrontPage users will be able to perform all management operations from the FrontPage client.</p><h3><a name="fpcaveats" id="fpcaveats">Caveats</a></h3> <ul> <li>When choosing the LDAP URL, the attribute to use for authentication should be something that will also be valid for putting into a <code class="module"><a href="../mod/mod_authn_file.html">mod_authn_file</a></code> user file. The user ID is ideal for this.</li> <li>When adding users via FrontPage, FrontPage administrators should choose usernames that already exist in the LDAP directory (for obvious reasons). Also, the password that the administrator enters into the form is ignored, since Apache will actually be authenticating against the password in the LDAP database, and not against the password in the local user file. This could cause confusion for web administrators.</li> <li>Apache must be compiled with <code class="module"><a href="../mod/mod_auth_basic.html">mod_auth_basic</a></code>, <code class="module"><a href="../mod/mod_authn_file.html">mod_authn_file</a></code> and <code class="module"><a href="../mod/mod_authz_groupfile.html">mod_authz_groupfile</a></code> in order to use FrontPage support. This is because Apache will still use the <code class="module"><a href="../mod/mod_authz_groupfile.html">mod_authz_groupfile</a></code> group file for determine the extent of a user's access to the FrontPage web.</li> <li>The directives must be put in the <code>.htaccess</code> files. Attempting to put them inside <code class="directive"><a href="../mod/core.html#location"><Location></a></code> or <code class="directive"><a href="../mod/core.html#directory"><Directory></a></code> directives won't work. This is because <code class="module"><a href="../mod/mod_authnz_ldap.html">mod_authnz_ldap</a></code> has to be able to grab the <code class="directive"><a href="../mod/mod_authn_file.html#authgroupfile">AuthGroupFile</a></code> directive that is found in FrontPage <code>.htaccess</code> files so that it knows where to look for the valid user list. If the <code class="module"><a href="../mod/mod_authnz_ldap.html">mod_authnz_ldap</a></code> directives aren't in the same <code>.htaccess</code> file as the FrontPage directives, then the hack won't work, because <code class="module"><a href="../mod/mod_authnz_ldap.html">mod_authnz_ldap</a></code> will never get a chance to process the <code>.htaccess</code> file, and won't be able to find the FrontPage-managed user file.</li> </ul></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="AuthLDAPBindDN" id="AuthLDAPBindDN">AuthLDAPBindDN</a> <a name="authldapbinddn" id="authldapbinddn">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Optional DN to use in binding to the LDAP server</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthLDAPBindDN <em>distinguished-name</em></code></td></tr><tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr><tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig</td></tr><tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr><tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_authnz_ldap</td></tr></table> <p>An optional DN used to bind to the server when searching for entries. If not provided, <code class="module"><a href="../mod/mod_authnz_ldap.html">mod_authnz_ldap</a></code> will use an anonymous bind.</p></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="AuthLDAPBindPassword" id="AuthLDAPBindPassword">AuthLDAPBindPassword</a> <a name="authldapbindpassword" id="authldapbindpassword">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Password used in conjuction with the bind DN</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthLDAPBindPassword <em>password</em></code></td></tr><tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr><tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig</td></tr><tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr><tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_authnz_ldap</td></tr></table> <p>A bind password to use in conjunction with the bind DN. Note that the bind password is probably sensitive data, and should be properly protected. You should only use the <code class="directive"><a href="#authldapbinddn">AuthLDAPBindDN</a></code> and <code class="directive"><a href="#authldapbindpassword">AuthLDAPBindPassword</a></code> if you absolutely need them to search the directory.</p> </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="AuthLDAPCharsetConfig" id="AuthLDAPCharsetConfig">AuthLDAPCharsetConfig</a> <a name="authldapcharsetconfig" id="authldapcharsetconfig">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Language to charset conversion configuration file</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthLDAPCharsetConfig <em>file-path</em></code></td></tr><tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr><tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr><tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_authnz_ldap</td></tr></table> <p>The <code class="directive">AuthLDAPCharsetConfig</code> directive sets the location of the language to charset conversion configuration file. <var>File-path</var> is relative to the <code class="directive"><a href="../mod/core.html#serverroot">ServerRoot</a></code>. This file specifies the list of language extensions to character sets. Most administrators use the provided <code>charset.conv</code> file, which associates common language extensions to character sets.</p> <p>The file contains lines in the following format:</p> <div class="example"><p><code> <var>Language-Extension</var> <var>charset</var> [<var>Language-String</var>] ... </code></p></div> <p>The case of the extension does not matter. Blank lines, and lines beginning with a hash character (<code>#</code>) are ignored.</p></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="AuthLDAPCompareDNOnServer" id="AuthLDAPCompareDNOnServer">AuthLDAPCompareDNOnServer</a> <a name="authldapcomparednonserver" id="authldapcomparednonserver">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Use the LDAP server to compare the DNs</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthLDAPCompareDNOnServer on|off</code></td></tr><tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AuthLDAPCompareDNOnServer on</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr><tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig</td></tr><tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr><tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_authnz_ldap</td></tr></table> <p>When set, <code class="module"><a href="../mod/mod_authnz_ldap.html">mod_authnz_ldap</a></code> will use the LDAP server to compare the DNs. This is the only foolproof way to compare DNs. <code class="module"><a href="../mod/mod_authnz_ldap.html">mod_authnz_ldap</a></code> will search the directory for the DN specified with the <a href="#reqdn"><code>Require dn</code></a> directive, then, retrieve the DN and compare it with the DN retrieved from the user entry. If this directive is not set, <code class="module"><a href="../mod/mod_authnz_ldap.html">mod_authnz_ldap</a></code> simply does a string comparison. It is possible to get false negatives with this approach, but it is much faster. Note the <code class="module"><a href="../mod/mod_ldap.html">mod_ldap</a></code> cache can speed up DN comparison in most situations.</p></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -