📄 mod_ldap.html.en
字号:
<h2><a name="usingssltls" id="usingssltls">Using SSL/TLS</a></h2>
<p>The ability to create an SSL and TLS connections to an LDAP server
is defined by the directives <code class="directive"><a href="# ldaptrustedglobalcert">
LDAPTrustedGlobalCert</a></code>, <code class="directive"><a href="# ldaptrustedclientcert">
LDAPTrustedClientCert</a></code> and <code class="directive"><a href="# ldaptrustedmode">
LDAPTrustedMode</a></code>. These directives specify the CA and
optional client certificates to be used, as well as the type of
encryption to be used on the connection (none, SSL or TLS/STARTTLS).</p>
<div class="example"><p><code>
# Establish an SSL LDAP connection on port 636. Requires that <br />
# mod_ldap and mod_authnz_ldap be loaded. Change the <br />
# "yourdomain.example.com" to match your domain.<br />
<br />
LDAPTrustedGlobalCert CA_DER /certs/certfile.der<br />
<br />
<Location /ldap-status><br />
<span class="indent">
SetHandler ldap-status<br />
Order deny,allow<br />
Deny from all<br />
Allow from yourdomain.example.com<br />
AuthLDAPURL ldaps://127.0.0.1/dc=example,dc=com?uid?one<br />
AuthzLDAPAuthoritative off<br />
require valid-user<br />
</span>
</Location>
</code></p></div>
<div class="example"><p><code>
# Establish a TLS LDAP connection on port 389. Requires that <br />
# mod_ldap and mod_authnz_ldap be loaded. Change the <br />
# "yourdomain.example.com" to match your domain.<br />
<br />
LDAPTrustedGlobalCert CA_DER /certs/certfile.der<br />
<br />
<Location /ldap-status><br />
<span class="indent">
SetHandler ldap-status<br />
Order deny,allow<br />
Deny from all<br />
Allow from yourdomain.example.com<br />
AuthLDAPURL ldap://127.0.0.1/dc=example,dc=com?uid?one TLS<br />
AuthzLDAPAuthoritative off<br />
require valid-user<br />
</span>
</Location>
</code></p></div>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="settingcerts" id="settingcerts">SSL/TLS Certificates</a></h2>
<p>The different LDAP SDKs have widely different methods of setting
and handling both CA and client side certificates.</p>
<p>If you intend to use SSL or TLS, read this section CAREFULLY so as to
understand the differences between configurations on the different LDAP
toolkits supported.</p>
<h3><a name="settingcerts-netscape" id="settingcerts-netscape">Netscape/Mozilla/iPlanet SDK</a></h3>
<p>CA certificates are specified within a file called cert7.db.
The SDK will not talk to any LDAP server whose certificate was
not signed by a CA specified in this file. If
client certificates are required, an optional key3.db file may
be specified with an optional password. The secmod file can be
specified if required. These files are in the same format as
used by the Netscape Communicator or Mozilla web browsers. The easiest
way to obtain these files is to grab them from your browser
installation.</p>
<p>Client certificates are specified per connection using the
LDAPTrustedClientCert directive by referring
to the certificate "nickname". An optional password may be
specified to unlock the certificate's private key.</p>
<p>The SDK supports SSL only. An attempt to use STARTTLS will cause
an error when an attempt is made to contact the LDAP server at
runtime.</p>
<div class="example"><p><code>
# Specify a Netscape CA certificate file<br />
LDAPTrustedGlobalCert CA_CERT7_DB /certs/cert7.db<br />
# Specify an optional key3.db file for client certificate support<br />
LDAPTrustedGlobalCert CERT_KEY3_DB /certs/key3.db<br />
# Specify the secmod file if required<br />
LDAPTrustedGlobalCert CA_SECMOD /certs/secmod<br />
<Location /ldap-status><br />
<span class="indent">
SetHandler ldap-status<br />
Order deny,allow<br />
Deny from all<br />
Allow from yourdomain.example.com<br />
LDAPTrustedClientCert CERT_NICKNAME <nickname> [password]<br />
AuthLDAPURL ldaps://127.0.0.1/dc=example,dc=com?uid?one<br />
AuthzLDAPAuthoritative off<br />
require valid-user<br />
</span>
</Location>
</code></p></div>
<h3><a name="settingcerts-novell" id="settingcerts-novell">Novell SDK</a></h3>
<p>One or more CA certificates must be specified for the Novell
SDK to work correctly. These certificates can be specified as
binary DER or Base64 (PEM) encoded files.</p>
<p>Note: Client certificates are specified globally rather than per
connection, and so must be specified with the LDAPTrustedGlobalCert
directive as below. Trying to set client certificates via the
LDAPTrustedClientCert directive will cause an error to be logged
when an attempt is made to connect to the LDAP server..</p>
<p>The SDK supports both SSL and STARTTLS, set using the
LDAPTrustedMode parameter. If an ldaps:// URL is specified,
SSL mode is forced, override this directive.</p>
<div class="example"><p><code>
# Specify two CA certificate files<br />
LDAPTrustedGlobalCert CA_DER /certs/cacert1.der<br />
LDAPTrustedGlobalCert CA_BASE64 /certs/cacert2.pem<br />
# Specify a client certificate file and key<br />
LDAPTrustedGlobalCert CERT_BASE64 /certs/cert1.pem<br />
LDAPTrustedGlobalCert KEY_BASE64 /certs/key1.pem [password]<br />
# Do not use this directive, as it will throw an error<br />
#LDAPTrustedClientCert CERT_BASE64 /certs/cert1.pem<br />
</code></p></div>
<h3><a name="settingcerts-openldap" id="settingcerts-openldap">OpenLDAP SDK</a></h3>
<p>One or more CA certificates must be specified for the OpenLDAP
SDK to work correctly. These certificates can be specified as
binary DER or Base64 (PEM) encoded files.</p>
<p>Client certificates are specified per connection using the
LDAPTrustedClientCert directive.</p>
<p>The documentation for the SDK claims to support both SSL and
STARTTLS, however STARTTLS does not seem to work on all versions
of the SDK. The SSL/TLS mode can be set using the
LDAPTrustedMode parameter. If an ldaps:// URL is specified,
SSL mode is forced. The OpenLDAP documentation notes that SSL
(ldaps://) support has been deprecated to be replaced with TLS,
although the SSL functionality still works.</p>
<div class="example"><p><code>
# Specify two CA certificate files<br />
LDAPTrustedGlobalCert CA_DER /certs/cacert1.der<br />
LDAPTrustedGlobalCert CA_BASE64 /certs/cacert2.pem<br />
<Location /ldap-status><br />
<span class="indent">
SetHandler ldap-status<br />
Order deny,allow<br />
Deny from all<br />
Allow from yourdomain.example.com<br />
LDAPTrustedClientCert CERT_BASE64 /certs/cert1.pem<br />
LDAPTrustedClientCert KEY_BASE64 /certs/key1.pem<br />
AuthLDAPURL ldaps://127.0.0.1/dc=example,dc=com?uid?one<br />
AuthzLDAPAuthoritative off<br />
require valid-user<br />
</span>
</Location>
</code></p></div>
<h3><a name="settingcerts-solaris" id="settingcerts-solaris">Solaris SDK</a></h3>
<p>SSL/TLS for the native Solaris LDAP libraries is not yet
supported. If required, install and use the OpenLDAP libraries
instead.</p>
<h3><a name="settingcerts-microsoft" id="settingcerts-microsoft">Microsoft SDK</a></h3>
<p>SSL/TLS certificate configuration for the native Microsoft
LDAP libraries is done inside the system registry, and no
configuration directives are required.</p>
<p>Both SSL and TLS are supported by using the ldaps:// URL
format, or by using the LDAPTrustedMode directive accordingly.</p>
<p>Note: The status of support for client certificates is not yet known
for this toolkit.</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="LDAPCacheEntries" id="LDAPCacheEntries">LDAPCacheEntries</a> <a name="ldapcacheentries" id="ldapcacheentries">Directive</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum number of entries in the primary LDAP cache</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LDAPCacheEntries <var>number</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LDAPCacheEntries 1024</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_ldap</td></tr>
</table>
<p>Specifies the maximum size of the primary LDAP cache. This
cache contains successful search/binds. Set it to 0 to turn off
search/bind caching. The default size is 1024 cached
searches.</p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -