📄 mod_authnz_ldap.html
字号:
</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>和<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>和<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="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>和<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"
AuthzLDAPAuthoritative off
AuthGroupFile <em>mygroupfile</em>
require group <em>mygroupfile</em>
</pre></div>
<p><code class="directive"><a href="#authzldapauthoritative">AuthzLDAPAuthoritative</a></code>
must be off to allow <code class="module"><a href="../mod/mod_authnz_ldap.html">mod_authnz_ldap</a></code> to decline group
authentication so that Apache will fall back to file
authentication for checking group membership. This allows the
FrontPage-managed group file to be used.</p>
<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>和<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>或<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">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>Optional DN to use in binding to the LDAP server</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>AuthLDAPBindDN <em>distinguished-name</em></code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>directory, .htaccess</td></tr>
<tr><th><a href="directive-dict.html#Override">覆盖项</a></th><td>AuthConfig</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>扩展(E)</td></tr>
<tr><th><a href="directive-dict.html#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">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>Password used in conjuction with the bind DN</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>AuthLDAPBindPassword <em>password</em></code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>directory, .htaccess</td></tr>
<tr><th><a href="directive-dict.html#Override">覆盖项</a></th><td>AuthConfig</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>扩展(E)</td></tr>
<tr><th><a href="directive-dict.html#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>和<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">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>Language to charset conversion configuration file</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>AuthLDAPCharsetConfig <em>file-path</em></code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>server config</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>扩展(E)</td></tr>
<tr><th><a href="directive-dict.html#Module">模块</a></th><td>mod_authnz_ldap</td></tr>
</table>
<p><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">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>Use the LDAP server to compare the DNs</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>AuthLDAPCompareDNOnServer on|off</code></td></tr>
<tr><th><a href="directive-dict.html#Default">默认值</a></th><td><code>AuthLDAPCompareDNOnServer on</code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>directory, .htaccess</td></tr>
<tr><th><a href="directive-dict.html#Override">覆盖项</a></th><td>AuthConfig</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>扩展(E)</td></tr>
<tr><th><a href="directive-dict.html#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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -