xref: /netbsd-src/external/bsd/openldap/dist/doc/guide/admin/tls.sdf (revision 6a493d6bc668897c91594964a732d38505b70cbb)
1# OpenLDAP: pkg/openldap-guide/admin/tls.sdf,v 1.13.2.10 2010/04/13 20:22:35 kurt Exp
2# Copyright 1999-2010 The OpenLDAP Foundation, All Rights Reserved.
3# COPYING RESTRICTIONS APPLY, see COPYRIGHT.
4
5H1: Using TLS
6
7OpenLDAP clients and servers are capable of using the
8{{TERM[expand]TLS}} ({{TERM:TLS}}) framework to provide
9integrity and confidentiality protections and to support
10LDAP authentication using the {{TERM:SASL}} {{TERM:EXTERNAL}} mechanism.
11TLS is defined in {{REF:RFC4346}}.
12
13Note: For generating certifcates, please reference {{URL:http://www.openldap.org/faq/data/cache/185.html}}
14
15H2: TLS Certificates
16
17TLS uses {{TERM:X.509}} certificates to carry client and server
18identities.  All servers are required to have valid certificates,
19whereas client certificates are optional.  Clients must have a
20valid certificate in order to authenticate via SASL EXTERNAL.
21For more information on creating and managing certificates,
22see the {{PRD:OpenSSL}} documentation.
23
24H3: Server Certificates
25
26The {{TERM:DN}} of a server certificate must use the {{EX:CN}}
27attribute to name the server, and the {{EX:CN}} must carry the
28server's fully qualified domain name. Additional alias names and
29wildcards may be present in the {{EX:subjectAltName}} certificate
30extension.  More details on server certificate names are in
31{{REF:RFC4513}}.
32
33H3: Client Certificates
34
35The DN of a client certificate can be used directly as an
36authentication DN.
37Since X.509 is a part of the {{TERM:X.500}} standard and LDAP
38is also based on X.500, both use the same DN formats and
39generally the DN in a user's X.509 certificate should be
40identical to the DN of their LDAP entry. However, sometimes
41the DNs may not be exactly the same, and so the mapping
42facility described in
43{{SECT:Mapping Authentication Identities}}
44can be applied to these DNs as well.
45
46H2: TLS Configuration
47
48After obtaining the required certificates, a number of options must
49be configured on both the client and the server to enable TLS and
50make use of the certificates.  At a minimum, the clients must be
51configured with the name of the file containing all of the
52{{TERM[expand]CA}} (CA) certificates it will trust. The server must
53be configured with the {{TERM:CA}} certificates and also its own
54server certificate and private key.
55
56Typically a single CA will have issued the server certificate
57and all of the trusted client certificates, so the server only
58needs to trust that one signing CA. However, a client may wish
59to connect to a variety of secure servers managed by different
60organizations, with server certificates generated by many
61different CAs. As such, a client is likely to need a list of
62many different trusted CAs in its configuration.
63
64H3: Server Configuration
65
66The configuration directives for slapd belong in the global directives
67section of {{slapd.conf}}(5).
68
69H4: TLSCACertificateFile <filename>
70
71This directive specifies the {{TERM:PEM}}-format file containing
72certificates for the CA's that slapd will trust. The certificate for
73the CA that signed the server certificate must be included among
74these certificates. If the signing CA was not a top-level (root) CA,
75certificates for the entire sequence of CA's from the signing CA to
76the top-level CA should be present. Multiple certificates are simply
77appended to the file; the order is not significant.
78
79H4: TLSCACertificatePath <path>
80
81This directive specifies the path of a directory that contains
82individual {{TERM:CA}} certificates in separate files.  In addition,
83this directory must be specially managed using the OpenSSL {{c_rehash}}
84utility. When using this feature, the OpenSSL library will attempt to
85locate certificate files based on a hash of their name and serial number.
86The {{c_rehash}} utility is used to generate symbolic links with the
87hashed names that point to the actual certificate files. As such,
88this option can only be used with a filesystem that actually supports
89symbolic links. In general, it is simpler to use the
90{{EX:TLSCACertificateFile}} directive instead.
91
92H4: TLSCertificateFile <filename>
93
94This directive specifies the file that contains the slapd server
95certificate. Certificates are generally public information and
96require no special protection.
97
98H4: TLSCertificateKeyFile <filename>
99
100This directive specifies the file that contains the private key
101that matches the certificate stored in the {{EX:TLSCertificateFile}}
102file. Private keys themselves are sensitive data and are usually
103password encrypted for protection. However, the current implementation
104doesn't support encrypted keys so the key must not be encrypted
105and the file itself must be protected carefully.
106
107H4: TLSCipherSuite <cipher-suite-spec>
108
109This directive configures what ciphers will be accepted and the
110preference order. {{EX:<cipher-suite-spec>}} should be a cipher
111specification for OpenSSL. You can use the command
112
113>	openssl ciphers -v ALL
114
115to obtain a verbose list of available cipher specifications.
116
117To obtain the list of ciphers in GNUtls use:
118
119>	gnutls-cli -l
120
121Besides the individual cipher names, the specifiers {{EX:HIGH}},
122{{EX:MEDIUM}}, {{EX:LOW}}, {{EX:EXPORT}}, and {{EX:EXPORT40}}
123may be helpful, along with {{EX:TLSv1}}, {{EX:SSLv3}},
124and {{EX:SSLv2}}.
125
126H4: TLSRandFile <filename>
127
128This directive specifies the file to obtain random bits from when
129{{FILE:/dev/urandom}} is not available. If the system provides
130{{FILE:/dev/urandom}} then this option is not needed, otherwise a
131source of random data must be configured.  Some systems (e.g. Linux)
132provide {{FILE:/dev/urandom}} by default, while others (e.g. Solaris)
133require the installation of a patch to provide it, and others may
134not support it at all. In the latter case, EGD or PRNGD should be
135installed, and this directive should specify the name of the EGD/PRNGD
136socket. The environment variable {{EX:RANDFILE}} can also be used
137to specify the filename. Also, in the absence of these options, the
138{{EX:.rnd}} file in the slapd user's home directory may be used if
139it exists. To use the {{EX:.rnd}} file, just create the file and
140copy a few hundred bytes of arbitrary data into the file. The file
141is only used to provide a seed for the pseudo-random number generator,
142and it doesn't need very much data to work.
143
144H4: TLSEphemeralDHParamFile <filename>
145
146This directive specifies the file that contains parameters for
147Diffie-Hellman ephemeral key exchange.  This is required in order
148to use a DSA certificate on the server side (i.e.
149{{EX:TLSCertificateKeyFile}} points to a DSA key).  Multiple sets
150of parameters can be included in the file; all of them will be
151processed.  Parameters can be generated using the following command
152
153>	openssl dhparam [-dsaparam] -out <filename> <numbits>
154
155H4: TLSVerifyClient { never | allow | try | demand }
156
157This directive specifies what checks to perform on client certificates
158in an incoming TLS session, if any. This option is set to {{EX:never}}
159by default, in which case the server never asks the client for a
160certificate. With a setting of {{EX:allow}} the server will ask
161for a client certificate; if none is provided the session proceeds
162normally. If a certificate is provided but the server is unable to
163verify it, the certificate is ignored and the session proceeds
164normally, as if no certificate had been provided. With a setting of
165{{EX:try}} the certificate is requested, and if none is provided,
166the session proceeds normally. If a certificate is provided and it
167cannot be verified, the session is immediately terminated. With a
168setting of {{EX:demand}} the certificate is requested and a valid
169certificate must be provided, otherwise the session is immediately
170terminated.
171
172Note: The server must request a client certificate in order to
173use the SASL EXTERNAL authentication mechanism with a TLS session.
174As such, a non-default {{EX:TLSVerifyClient}} setting must be configured
175before SASL EXTERNAL authentication may be attempted, and the
176SASL EXTERNAL mechanism will only be offered to the client if a valid
177client certificate was received.
178
179H3: Client Configuration
180
181Most of the client configuration directives parallel the server
182directives. The names of the directives are different, and they go
183into {{ldap.conf}}(5) instead of {{slapd.conf}}(5), but their
184functionality is mostly the same. Also, while most of these options may
185be configured on a system-wide basis, they may all be overridden by
186individual users in their {{.ldaprc}} files.
187
188The LDAP Start TLS operation is used in LDAP to initiate TLS
189negotiation.  All OpenLDAP command line tools support a {{EX:-Z}}
190and {{EX:-ZZ}} flag to indicate whether a Start TLS operation is to
191be issued.  The latter flag indicates that the tool is to cease
192processing if TLS cannot be started while the former allows the
193command to continue.
194
195In LDAPv2 environments, TLS is normally started using the LDAP
196Secure URI scheme ({{EX:ldaps://}}) instead of the normal LDAP URI
197scheme ({{EX:ldap://}}).  OpenLDAP command line tools allow either
198scheme to used with the {{EX:-H}} flag and with the {{EX:URI}}
199{{ldap.conf}}(5) option.
200
201
202H4: TLS_CACERT <filename>
203
204This is equivalent to the server's {{EX:TLSCACertificateFile}} option. As
205noted in the {{SECT:TLS Configuration}} section, a client typically
206may need to know about more CAs than a server, but otherwise the
207same considerations apply.
208
209H4: TLS_CACERTDIR <path>
210
211This is equivalent to the server's {{EX:TLSCACertificatePath}} option. The
212specified directory must be managed with the OpenSSL {{c_rehash}}
213utility as well.
214
215H4: TLS_CERT <filename>
216
217This directive specifies the file that contains the client certificate.
218This is a user-only directive and can only be specified in a user's
219{{.ldaprc}} file.
220
221H4: TLS_KEY <filename>
222
223This directive specifies the file that contains the private key
224that matches the certificate stored in the {{EX:TLS_CERT}}
225file. The same constraints mentioned for {{EX:TLSCertificateKeyFile}}
226apply here. This is also a user-only directive.
227
228H4: TLS_RANDFILE <filename>
229
230This directive is the same as the server's {{EX:TLSRandFile}}
231option.
232
233H4: TLS_REQCERT { never | allow | try | demand }
234
235This directive is equivalent to the server's {{EX:TLSVerifyClient}}
236option. However, for clients the default value is {{EX:demand}}
237and there generally is no good reason to change this setting.
238
239