LDAP over TLS: Lightweight Directory Access Protocol (v3): Extension for Transport Layer Security
The operation that turns an ordinary LDAP connection into an encrypted one.
Hodges, J., Morgan, R., and M. Wahl, "Lightweight Directory Access Protocol (v3): Extension for Transport Layer Security", RFC 2830, DOI 10.17487/RFC2830, May 2000, <https://www.rfc-editor.org/info/rfc2830>.
@misc{rfc2830,
series = {Request for Comments},
number = 2830,
howpublished = {RFC 2830},
publisher = {RFC Editor},
doi = {10.17487/RFC2830},
url = {https://www.rfc-editor.org/info/rfc2830},
author = {J. Hodges and R. Morgan and M. Wahl},
title = {{Lightweight Directory Access Protocol (v3): Extension for Transport Layer Security}},
pagetotal = 12,
year = 2000,
month = may,
} RFC text
Contents
Network Working Group J. Hodges
Request for Comments: 2830 Oblix Inc.
Category: Standards Track R. Morgan
Univ of Washington
M. Wahl
Sun Microsystems, Inc.
May 2000
Lightweight Directory Access Protocol (v3):
Extension for Transport Layer Security
Status of this Memo
This document specifies an Internet standards track protocol for the
Internet community, and requests discussion and suggestions for
improvements. Please refer to the current edition of the "Internet
Official Protocol Standards" (STD 1) for the standardization state
and status of this protocol. Distribution of this memo is unlimited.
Copyright Notice
Copyright (C) The Internet Society (2000). All Rights Reserved.
Abstract
This document defines the "Start Transport Layer Security (TLS)
Operation" for LDAP [LDAPv3, TLS]. This operation provides for TLS
establishment in an LDAP association and is defined in terms of an
LDAP extended request.
1. Conventions Used in this Document
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in [ReqsKeywords].
2. The Start TLS Request
This section describes the Start TLS extended request and extended
response themselves: how to form the request, the form of the
response, and enumerates the various result codes the client MUST be
prepared to handle.
The section following this one then describes how to sequence an
overall Start TLS Operation.
2.1. Requesting TLS Establishment
A client may perform a Start TLS operation by transmitting an LDAP
PDU containing an ExtendedRequest [LDAPv3] specifying the OID for the
Start TLS operation:
1.3.6.1.4.1.1466.20037
An LDAP ExtendedRequest is defined as follows:
ExtendedRequest ::= [APPLICATION 23] SEQUENCE {
requestName [0] LDAPOID,
requestValue [1] OCTET STRING OPTIONAL }
A Start TLS extended request is formed by setting the requestName
field to the OID string given above. The requestValue field is
absent. The client MUST NOT send any PDUs on this connection
following this request until it receives a Start TLS extended
response.
When a Start TLS extended request is made, the server MUST return an
LDAP PDU containing a Start TLS extended response. An LDAP
ExtendedResponse is defined as follows:
ExtendedResponse ::= [APPLICATION 24] SEQUENCE {
COMPONENTS OF LDAPResult,
responseName [10] LDAPOID OPTIONAL,
response [11] OCTET STRING OPTIONAL }
A Start TLS extended response MUST contain a responseName field which
MUST be set to the same string as that in the responseName field
present in the Start TLS extended request. The response field is
absent. The server MUST set the resultCode field to either success or
one of the other values outlined in section 2.3.
2.2. "Success" Response
If the ExtendedResponse contains a resultCode of success, this
indicates that the server is willing and able to negotiate TLS. Refer
to section 3, below, for details.
2.3. Response other than "success"
If the ExtendedResponse contains a resultCode other than success,
this indicates that the server is unwilling or unable to negotiate
TLS.
If the Start TLS extended request was not successful, the resultCode
will be one of:
operationsError (operations sequencing incorrect; e.g. TLS already
established)
protocolError (TLS not supported or incorrect PDU structure)
referral (this server doesn't do TLS, try this one)
unavailable (e.g. some major problem with TLS, or server is
shutting down)
The server MUST return operationsError if the client violates any of
the Start TLS extended operation sequencing requirements described in
section 3, below.
If the server does not support TLS (whether by design or by current
configuration), it MUST set the resultCode to protocolError (see
section 4.1.1 of [LDAPv3]), or to referral. The server MUST include
an actual referral value in the LDAP Result if it returns a
resultCode of referral. The client's current session is unaffected if
the server does not support TLS. The client MAY proceed with any LDAP
operation, or it MAY close the connection.
The server MUST return unavailable if it supports TLS but cannot
establish a TLS connection for some reason, e.g. the certificate
server not responding, it cannot contact its TLS implementation, or
if the server is in process of shutting down. The client MAY retry
the StartTLS operation, or it MAY proceed with any other LDAP
operation, or it MAY close the connection.
3. Sequencing of the Start TLS Operation
This section describes the overall procedures clients and servers
MUST follow for TLS establishment. These procedures take into
consideration various aspects of the overall security of the LDAP
association including discovery of resultant security level and
assertion of the client's authorization identity.
Note that the precise effects, on a client's authorization identity,
of establishing TLS on an LDAP association are described in detail in
section 5.
3.1. Requesting to Start TLS on an LDAP Association
The client MAY send the Start TLS extended request at any time after
establishing an LDAP association, except that in the following cases
the client MUST NOT send a Start TLS extended request:
- if TLS is currently established on the connection, or
- during a multi-stage SASL negotiation, or
- if there are any LDAP operations outstanding on the connection.
The result of violating any of these requirements is a resultCode of
operationsError, as described above in section 2.3.
The client MAY have already performed a Bind operation when it sends
a Start TLS request, or the client might have not yet bound.
If the client did not establish a TLS connection before sending any
other requests, and the server requires the client to establish a TLS
connection before performing a particular request, the server MUST
reject that request with a confidentialityRequired or
strongAuthRequired result. The client MAY send a Start TLS extended
request, or it MAY choose to close the connection.
3.2. Starting TLS
The server will return an extended response with the resultCode of
success if it is willing and able to negotiate TLS. It will return
other resultCodes, documented above, if it is unable.
In the successful case, the client, which has ceased to transfer LDAP
requests on the connection, MUST either begin a TLS negotiation or
close the connection. The client will send PDUs in the TLS Record
Protocol directly over the underlying transport connection to the
server to initiate TLS negotiation [TLS].
3.3. TLS Version Negotiation
Negotiating the version of TLS or SSL to be used is a part of the TLS
Handshake Protocol, as documented in [TLS]. Please refer to that
document for details.
3.4. Discovery of Resultant Security Level
After a TLS connection is established on an LDAP association, both
parties MUST individually decide whether or not to continue based on
the privacy level achieved. Ascertaining the TLS connection's privacy
level is implementation dependent, and accomplished by communicating
with one's respective local TLS implementation.
If the client or server decides that the level of authentication or
privacy is not high enough for it to continue, it SHOULD gracefully
close the TLS connection immediately after the TLS negotiation has
completed (see sections 4.1 and 5.2, below).
The client MAY attempt to Start TLS again, or MAY send an unbind
request, or send any other LDAP request.
3.5. Assertion of Client's Authorization Identity
The client MAY, upon receipt of a Start TLS extended response
indicating success, assert that a specific authorization identity be
utilized in determining the client's authorization status. The client
accomplishes this via an LDAP Bind request specifying a SASL
mechanism of "EXTERNAL" [SASL]. See section 5.1.2, below.
3.6. Server Identity Check
The client MUST check its understanding of the server's hostname
against the server's identity as presented in the server's
Certificate message, in order to prevent man-in-the-middle attacks.
Matching is performed according to these rules:
- The client MUST use the server hostname it used to open the LDAP
connection as the value to compare against the server name as
expressed in the server's certificate. The client MUST NOT use the
server's canonical DNS name or any other derived form of name.
- If a subjectAltName extension of type dNSName is present in the
certificate, it SHOULD be used as the source of the server's
identity.
- Matching is case-insensitive.
- The "*" wildcard character is allowed. If present, it applies only
to the left-most name component.
E.g. *.bar.com would match a.bar.com, b.bar.com, etc. but not
bar.com. If more than one identity of a given type is present in the
certificate (e.g. more than one dNSName name), a match in any one of
the set is considered acceptable.
If the hostname does not match the dNSName-based identity in the
certificate per the above check, user-oriented clients SHOULD either
notify the user (clients MAY give the user the opportunity to
continue with the connection in any case) or terminate the connection
and indicate that the server's identity is suspect. Automated clients
SHOULD close the connection, returning and/or logging an error
indicating that the server's identity is suspect.
Beyond the server identity checks described in this section, clients
SHOULD be prepared to do further checking to ensure that the server
is authorized to provide the service it is observed to provide. The
client MAY need to make use of local policy information.
3.7. Refresh of Server Capabilities Information
The client MUST refresh any cached server capabilities information
(e.g. from the server's root DSE; see section 3.4 of [LDAPv3]) upon
TLS session establishment. This is necessary to protect against
active-intermediary attacks which may have altered any server
capabilities information retrieved prior to TLS establishment. The
server MAY advertise different capabilities after TLS establishment.
4. Closing a TLS Connection
4.1. Graceful Closure
Either the client or server MAY terminate the TLS connection on an
LDAP association by sending a TLS closure alert. This will leave the
LDAP association intact.
Before closing a TLS connection, the client MUST either wait for any
outstanding LDAP operations to complete, or explicitly abandon them
[LDAPv3].
After the initiator of a close has sent a closure alert, it MUST
discard any TLS messages until it has received an alert from the
other party. It will cease to send TLS Record Protocol PDUs, and
following the receipt of the alert, MAY send and receive LDAP PDUs.
The other party, if it receives a closure alert, MUST immediately
transmit a TLS closure alert. It will subsequently cease to send TLS
Record Protocol PDUs, and MAY send and receive LDAP PDUs.
4.2. Abrupt Closure
Either the client or server MAY abruptly close the entire LDAP
association and any TLS connection established on it by dropping the
underlying TCP connection. A server MAY beforehand send the client a
Notice of Disconnection [LDAPv3] in this case.
5. Effects of TLS on a Client's Authorization Identity
This section describes the effects on a client's authorization
identity brought about by establishing TLS on an LDAP association.
The default effects are described first, and next the facilities for
client assertion of authorization identity are discussed including
error conditions. Lastly, the effects of closing the TLS connection
are described.
Authorization identities and related concepts are defined in
[AuthMeth].
5.1. TLS Connection Establishment Effects
5.1.1. Default Effects
Upon establishment of the TLS connection onto the LDAP association,
any previously established authentication and authorization
identities MUST remain in force, including anonymous state. This
holds even in the case where the server requests client
authentication via TLS -- e.g. requests the client to supply its
certificate during TLS negotiation (see [TLS]).
5.1.2. Client Assertion of Authorization Identity
A client MAY either implicitly request that its LDAP authorization
identity be derived from its authenticated TLS credentials or it MAY
explicitly provide an authorization identity and assert that it be
used in combination with its authenticated TLS credentials. The
former is known as an implicit assertion, and the latter as an
explicit assertion.
5.1.2.1. Implicit Assertion
An implicit authorization identity assertion is accomplished after
TLS establishment by invoking a Bind request of the SASL form using
the "EXTERNAL" mechanism name [SASL, LDAPv3] that SHALL NOT include
the optional credentials octet string (found within the
SaslCredentials sequence in the Bind Request). The server will derive
the client's authorization identity from the authentication identity
supplied in the client's TLS credentials (typically a public key
certificate) according to local policy. The underlying mechanics of
how this is accomplished are implementation specific.
5.1.2.2. Explicit Assertion
An explicit authorization identity assertion is accomplished after
TLS establishment by invoking a Bind request of the SASL form using
the "EXTERNAL" mechanism name [SASL, LDAPv3] that SHALL include the
credentials octet string. This string MUST be constructed as
documented in section 9 of [AuthMeth].
5.1.2.3. Error Conditions
For either form of assertion, the server MUST verify that the
client's authentication identity as supplied in its TLS credentials
is permitted to be mapped to the asserted authorization identity. The
server MUST reject the Bind operation with an invalidCredentials
resultCode in the Bind response if the client is not so authorized.
Additionally, with either form of assertion, if a TLS session has not
been established between the client and server prior to making the
SASL EXTERNAL Bind request and there is no other external source of
authentication credentials (e.g. IP-level security [IPSEC]), or if,
during the process of establishing the TLS session, the server did
not request the client's authentication credentials, the SASL
EXTERNAL bind MUST fail with a result code of
inappropriateAuthentication.
After the above Bind operation failures, any client authentication
and authorization state of the LDAP association is lost, so the LDAP
association is in an anonymous state after the failure. TLS
connection state is unaffected, though a server MAY end the TLS
connection, via a TLS close_notify message, based on the Bind failure
(as it MAY at any time).
5.2. TLS Connection Closure Effects
Closure of the TLS connection MUST cause the LDAP association to move
to an anonymous authentication and authorization state regardless of
the state established over TLS and regardless of the authentication
and authorization state prior to TLS connection establishment.
6. Security Considerations
The goals of using the TLS protocol with LDAP are to ensure
connection confidentiality and integrity, and to optionally provide
for authentication. TLS expressly provides these capabilities, as
described in [TLS].
All security gained via use of the Start TLS operation is gained by
the use of TLS itself. The Start TLS operation, on its own, does not
provide any additional security.
The use of TLS does not provide or ensure for confidentiality and/or
non-repudiation of the data housed by an LDAP-based directory server.
Nor does it secure the data from inspection by the server
administrators. Once established, TLS only provides for and ensures
confidentiality and integrity of the operations and data in transit
over the LDAP association, and only if the implementations on the
client and server support and negotiate it.
The level of security provided though the use of TLS depends directly
on both the quality of the TLS implementation used and the style of
usage of that implementation. Additionally, an active-intermediary
attacker can remove the Start TLS extended operation from the
supportedExtension attribute of the root DSE. Therefore, both parties
SHOULD independently ascertain and consent to the security level
achieved once TLS is established and before beginning use of the TLS
connection. For example, the security level of the TLS connection
might have been negotiated down to plaintext.
Clients SHOULD either warn the user when the security level achieved
does not provide confidentiality and/or integrity protection, or be
configurable to refuse to proceed without an acceptable level of
security.
Client and server implementors SHOULD take measures to ensure proper
protection of credentials and other confidential data where such
measures are not otherwise provided by the TLS implementation.
Server implementors SHOULD allow for server administrators to elect
whether and when connection confidentiality and/or integrity is
required, as well as elect whether and when client authentication via
TLS is required.
7. Acknowledgements
The authors thank Tim Howes, Paul Hoffman, John Kristian, Shirish
Rai, Jonathan Trostle, Harald Alvestrand, and Marcus Leech for their
contributions to this document.
8. References
[AuthMeth] Wahl, M., Alvestrand, H., Hodges, J. and R. Morgan,
"Authentication Methods for LDAP", RFC 2829, May 2000.
[IPSEC] Kent, S. and R. Atkinson, "Security Architecture for
the Internet Protocol", RFC 2401, November 1998.
[LDAPv3] Wahl, M., Kille S. and T. Howes, "Lightweight
Directory Access Protocol (v3)", RFC 2251, December
1997.
[ReqsKeywords] Bradner, S., "Key Words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, March 1997.
[SASL] Myers, J., "Simple Authentication and Security Layer
(SASL)", RFC 2222, October 1997.
[TLS] Dierks, T. and C. Allen. "The TLS Protocol Version
1.0", RFC 2246, January 1999.
9. Authors' Addresses
Jeff Hodges
Oblix, Inc.
18922 Forge Drive
Cupertino, CA 95014
USA
Phone: +1-408-861-6656
EMail: JHodges@oblix.com
RL "Bob" Morgan
Computing and Communications
University of Washington
Seattle, WA
USA
Phone: +1-206-221-3307
EMail: rlmorgan@washington.edu
Mark Wahl
Sun Microsystems, Inc.
8911 Capital of Texas Hwy #4140
Austin TX 78759
USA
EMail: M.Wahl@innosoft.com
10. Intellectual Property Rights Notices
The IETF takes no position regarding the validity or scope of any
intellectual property or other rights that might be claimed to
pertain to the implementation or use of the technology described in
this document or the extent to which any license under such rights
might or might not be available; neither does it represent that it
has made any effort to identify any such rights. Information on the
IETF's procedures with respect to rights in standards-track and
standards-related documentation can be found in BCP-11. Copies of
claims of rights made available for publication and any assurances of
licenses to be made available, or the result of an attempt made to
obtain a general license or permission for the use of such
proprietary rights by implementors or users of this specification can
be obtained from the IETF Secretariat.
The IETF invites any interested party to bring to its attention any
copyrights, patents or patent applications, or other proprietary
rights which may cover technology that may be required to practice
this standard. Please address the information to the IETF Executive
Director.
11. Full Copyright Statement
Copyright (C) The Internet Society (2000). All Rights Reserved.
This document and translations of it may be copied and furnished to
others, and derivative works that comment on or otherwise explain it
or assist in its implementation may be prepared, copied, published
and distributed, in whole or in part, without restriction of any
kind, provided that the above copyright notice and this paragraph are
included on all such copies and derivative works. However, this
document itself may not be modified in any way, such as by removing
the copyright notice or references to the Internet Society or other
Internet organizations, except as needed for the purpose of
developing Internet standards in which case the procedures for
copyrights defined in the Internet Standards process must be
followed, or as required to translate it into languages other than
English.
The limited permissions granted above are perpetual and will not be
revoked by the Internet Society or its successors or assigns.
This document and the information contained herein is provided on an
"AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
Acknowledgement
Funding for the RFC Editor function is currently provided by the
Internet Society.
ISO Plain Language
On this page
§1What the Start TLS Operation Does
This RFC defines the Start Transport Layer Security operation for LDAP. The operation provides for TLS to be established within an LDAP association, and is defined in terms of an LDAP extended request. It is the LDAP equivalent of the way other protocols upgrade a plain connection in place.
Two points follow from the design. The first is that the operation is negotiated, so the client learns whether the server is willing before it commits anything. The second is that it happens on an existing connection, so the client may already have bound, or may not have bound at all, and the server may already have asked for a certificate. The RFC spells out the effect on the client's authorization identity in a separate section, because establishing TLS does not by itself change who the client is.
The RFC is careful to note what the operation does not do. It adds no security of its own: everything gained comes from TLS itself. It does not protect the data held by the directory server, and it does not protect the data from the server's own administrators. Once established, TLS provides confidentiality and integrity for the operations and data in transit over the LDAP association, and only if both implementations support it and negotiate it.
The operation is a request and an answer, followed by an ordinary TLS handshake. It does not itself encrypt anything; all the security comes from TLS.
§2The Start TLS Request and Response
A client performs the operation by transmitting an LDAP protocol data unit containing an extended request whose request name is the object identifier 1.3.6.1.4.1.1466.20037. The extended request is defined as an application 23 structure with a request name field and an optional request value field. The request value field is absent for a Start TLS request. The client must not send any further protocol data units on that connection until it receives the extended response.
The server must answer with an extended response, which is an application 24 structure holding the components of an LDAP result, an optional response name and an optional response field. The response name must be set to the same string as in the request, and the response field is absent. The server must set the result code to either success or one of the other values the RFC lists.
If the result code is success, the server is willing and able to negotiate TLS. The RFC separates this from the other case deliberately: the client learns that the handshake may begin, and then the client, having stopped transferring LDAP requests, must either begin a TLS negotiation or close the connection. From that point the client sends records of the TLS record protocol directly over the underlying transport connection to start the negotiation.
The request carries a fixed number that says what it is, and no data of its own. The reply carries the same number back and a status. After a success the message traffic stops and the two sides speak TLS instead.
§3Sequencing the Operation
The client may send the Start TLS extended request at any time after establishing an LDAP association, with three exceptions. It must not send it if TLS is currently established on the connection, if a multi-stage SASL negotiation is in progress, or if there are any LDAP operations outstanding. Breaking any of these rules gives a result code of operationsError. The client may have performed a bind before sending the request, or may not have bound yet.
If the client did not establish TLS before sending other requests, and the server requires TLS for a particular request, the server must reject that request with a confidentialityRequired or strongAuthRequired result. The client may then send a Start TLS request or close the connection.
After a successful extended response, the client, which has ceased transferring LDAP requests, must either begin a TLS negotiation or close the connection. The TLS version is negotiated as part of the TLS handshake protocol, which is outside this document. Once the TLS connection is established, both parties must individually decide whether to continue, based on the privacy level achieved; ascertaining it is implementation-dependent and is done by talking to the local TLS implementation. If either side decides the level of authentication or privacy is not high enough, it should close the TLS connection gracefully as soon as the negotiation completes.
The client may then assert a specific authorization identity by sending a bind request that names the EXTERNAL SASL mechanism. It must also check the server's identity: the client must compare the hostname it used to open the connection against the name in the server's certificate, and must not use the server's canonical DNS name or any other derived form of name. If a subjectAltName extension of type dNSName is present it should be used as the source of the identity, matching is case-insensitive, and the wildcard character is allowed but applies only to the left-most name component. If the hostname does not match, a user-oriented client should either notify the user or terminate the connection and report the server's identity as suspect; an automated client should close the connection and log an error.
Finally, the client must refresh any cached server capabilities information, such as what it read from the server's root DSE, once TLS is established. That protects against an active intermediary that altered the capabilities before TLS began. The server may advertise different capabilities afterwards.
There are rules about when the request may be sent, and rules about what the client must do once TLS is up: check that the certificate really names the host it asked for, and throw away anything it learned before the connection was protected.
- Extended request, Start TLS OIDThe client must send nothing else until the reply arrives.
- Extended response, same OID, result code
- TLS handshake on the same connectionThe client must then either start TLS or close the connection.
- Server certificateThe client checks it against the hostname it used to connect.
- Bind with the EXTERNAL mechanismOptional: this is how the client asks for an authorization identity.
§2.3Failure Codes and Closing the Connection
When the extended request does not succeed, the result code says why. operationsError means the client broke one of the sequencing rules, for example asking for TLS when it is already established, and the server must return it in that case. protocolError means TLS is not supported or the message structure was wrong; a server that does not support TLS, whether by design or by current configuration, must set this code or referral, and if it returns a referral it must include an actual referral value. The client's session is unaffected, and it may proceed with any LDAP operation or close the connection. unavailable means the server supports TLS but cannot establish it, for example because the certificate server is not responding, it cannot reach its TLS implementation, or it is shutting down; the client may retry, proceed with another operation, or close the connection.
Either side may terminate the TLS connection by sending a closure alert, which leaves the LDAP association intact. Before closing, the client must either wait for outstanding LDAP operations to complete or explicitly abandon them. After sending a closure alert the initiator must discard any TLS messages until it receives an alert from the other party, and afterwards it may send and receive LDAP messages again. The other party, on receiving a closure alert, must immediately transmit one in reply. Either side may also close everything abruptly by dropping the underlying TCP connection, and a server may first send a notice of disconnection.
When the server says no, the code says whether it does not support TLS, is busy, or the client broke the rules. Either side can also end the encrypted part while keeping the LDAP connection open.
- successSuccess — The server is willing and able to negotiate TLS. The client must then begin the negotiation or close the connection.
- operationsErrorOperations error — The client violated one of the sequencing rules, for example asking again while TLS is already established. The server must return this code in that case.
- protocolErrorProtocol error — TLS is not supported, or the PDU structure was incorrect.
- referralReferral — This server does not do TLS; the result must carry an actual referral value. The client may proceed with any LDAP operation or close the connection.
- unavailableUnavailable — The server supports TLS but cannot establish it, for example because its certificate server is not responding or it is shutting down.
§5What Establishing TLS Does to the Client's Identity
Establishing TLS does not by itself change who the client is. Any previously established authentication and authorization identities must remain in force, including anonymous state, and this holds even when the server asks the client for a certificate during the TLS negotiation.
A client may nevertheless ask for a different identity to be used. It can do so implicitly, by sending a bind request that names the EXTERNAL SASL mechanism and leaves out the optional credentials string; the server then derives the authorization identity from the identity in the client's TLS credentials according to local policy. Or it can do so explicitly, by including a credentials string built as RFC 2829 describes, which is how a proxy asks for the privileges of the identity it is acting for.
In either case the server must check that the client's authentication identity from its TLS credentials is permitted to be mapped to the asserted authorization identity, and must reject the bind with an invalidCredentials result if it is not. If no TLS session was established, or no other external source of credentials exists, or the server did not request the client's credentials during the TLS session, the EXTERNAL bind must fail with an inappropriateAuthentication result. After such a failure the association loses its authentication and authorization state and becomes anonymous, although the TLS connection itself is unaffected and the server may end it.
Closing the TLS connection must move the LDAP association to an anonymous authentication and authorization state, whatever state was established over TLS and whatever state existed before it.
Turning on encryption does not log you in. To claim an identity from a certificate, the client has to say so with a bind, and the server has to agree that the certificate may stand for that identity.
- Identity unchangedAny identity already established stays in force, including anonymous state, even if the server asked for a certificate.
- Assert an identityA bind with the EXTERNAL mechanism lets the client ask the server to use the identity from its TLS credentials.
- Check the serverThe client must compare the hostname it used with the name in the server's certificate, case-insensitively, with a wildcard only in the left-most label.
- Refresh capabilitiesCached server capabilities must be fetched again once TLS is established, because an attacker may have altered them earlier.
§6Security Considerations
The goals of using TLS with LDAP are to ensure connection confidentiality and integrity, and optionally to provide authentication. All the security gained through the Start TLS operation is gained by the use of TLS itself; the operation on its own provides nothing extra.
The use of TLS does not provide or ensure confidentiality or non-repudiation for the data held by an LDAP directory server, and it does not protect the data from inspection by the server's administrators. The level of security depends directly on the quality of the TLS implementation and on the style of its use.
There is one trap the RFC points out. An active-intermediary attacker can remove the Start TLS operation from the supportedExtension attribute of the root DSE, so a client that believes TLS is available never tries it. Both parties should therefore independently ascertain and agree the security level achieved once TLS is established and before using the connection, because the level might have been negotiated down to plaintext. Clients should either warn the user when the level achieved does not give confidentiality or integrity, or be configurable to refuse to proceed without an acceptable level.
The RFC also says that implementors should protect credentials and other confidential data where the TLS implementation does not already do so, and that server implementors should let administrators choose whether and when connection confidentiality, integrity or client authentication through TLS are required.
The big risk is that an attacker in the middle convinces the client that TLS is not even available, so the client never asks for it. Both ends therefore have to check what they actually got, and the client has to be able to refuse to carry on if it is not good enough.