]> granicus.if.org Git - apache/blob - docs/manual/mod/mod_ssl.xml
b126d6067249856f826694db2131ce7c880309aa
[apache] / docs / manual / mod / mod_ssl.xml
1 <?xml version="1.0"?>
2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <!-- $LastChangedRevision$ -->
5
6 <!--
7  Licensed to the Apache Software Foundation (ASF) under one or more
8  contributor license agreements.  See the NOTICE file distributed with
9  this work for additional information regarding copyright ownership.
10  The ASF licenses this file to You under the Apache License, Version 2.0
11  (the "License"); you may not use this file except in compliance with
12  the License.  You may obtain a copy of the License at
13
14      http://www.apache.org/licenses/LICENSE-2.0
15
16  Unless required by applicable law or agreed to in writing, software
17  distributed under the License is distributed on an "AS IS" BASIS,
18  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  See the License for the specific language governing permissions and
20  limitations under the License.
21 -->
22
23 <modulesynopsis metafile="mod_ssl.xml.meta">
24
25 <name>mod_ssl</name>
26 <description>Strong cryptography using the Secure Sockets
27 Layer (SSL) and Transport Layer Security (TLS) protocols</description>
28 <status>Extension</status>
29 <sourcefile>mod_ssl.c</sourcefile>
30 <identifier>ssl_module</identifier>
31
32 <summary>
33 <p>This module provides SSL v2/v3 and TLS v1 support for the Apache
34 HTTP Server.  It was contributed by Ralf S. Engeschall based on his
35 mod_ssl project and originally derived from work by Ben Laurie.</p>
36
37 <p>This module relies on <a href="http://www.openssl.org/">OpenSSL</a>
38 to provide the cryptography engine.</p>
39
40 <p>Further details, discussion, and examples are provided in the
41 <a href="../ssl/">SSL documentation</a>.</p>
42 </summary>
43
44 <section id="envvars"><title>Environment Variables</title>
45
46 <p>This module provides a lot of SSL information as additional environment
47 variables to the SSI and CGI namespace. The generated variables are listed in
48 the table below. For backward compatibility the information can
49 be made available under different names, too. Look in the <a
50 href="../ssl/ssl_compat.html">Compatibility</a> chapter for details on the
51 compatibility variables.</p>
52
53 <table border="1">
54 <columnspec><column width=".3"/><column width=".2"/><column width=".5"/>
55 </columnspec>
56 <tr>
57  <th><a name="table3">Variable Name:</a></th>
58  <th>Value Type:</th>
59  <th>Description:</th>
60 </tr>
61 <tr><td><code>HTTPS</code></td>                         <td>flag</td>      <td>HTTPS is being used.</td></tr>
62 <tr><td><code>SSL_PROTOCOL</code></td>                  <td>string</td>    <td>The SSL protocol version (SSLv2, SSLv3, TLSv1)</td></tr>
63 <tr><td><code>SSL_SESSION_ID</code></td>                <td>string</td>    <td>The hex-encoded SSL session id</td></tr>
64 <tr><td><code>SSL_SESSION_RESUMED</code></td>           <td>string</td>    <td>Initial or Resumed SSL Session.  Note: multiple requests may be served over the same (Initial or Resumed) SSL session if HTTP KeepAlive is in use</td></tr>
65 <tr><td><code>SSL_SECURE_RENEG</code></td>              <td>string</td>    <td><code>true</code> if secure renegotiation is supported, else <code>false</code></td></tr>
66 <tr><td><code>SSL_CIPHER</code></td>                    <td>string</td>    <td>The cipher specification name</td></tr>
67 <tr><td><code>SSL_CIPHER_EXPORT</code></td>             <td>string</td>    <td><code>true</code> if cipher is an export cipher</td></tr>
68 <tr><td><code>SSL_CIPHER_USEKEYSIZE</code></td>         <td>number</td>    <td>Number of cipher bits (actually used)</td></tr>
69 <tr><td><code>SSL_CIPHER_ALGKEYSIZE</code></td>         <td>number</td>    <td>Number of cipher bits (possible)</td></tr>
70 <tr><td><code>SSL_COMPRESS_METHOD</code></td>           <td>string</td>    <td>SSL compression method negotiated</td></tr>
71 <tr><td><code>SSL_VERSION_INTERFACE</code></td>         <td>string</td>    <td>The mod_ssl program version</td></tr>
72 <tr><td><code>SSL_VERSION_LIBRARY</code></td>           <td>string</td>    <td>The OpenSSL program version</td></tr>
73 <tr><td><code>SSL_CLIENT_M_VERSION</code></td>          <td>string</td>    <td>The version of the client certificate</td></tr>
74 <tr><td><code>SSL_CLIENT_M_SERIAL</code></td>           <td>string</td>    <td>The serial of the client certificate</td></tr>
75 <tr><td><code>SSL_CLIENT_S_DN</code></td>               <td>string</td>    <td>Subject DN in client's certificate</td></tr>
76 <tr><td><code>SSL_CLIENT_S_DN_</code><em>x509</em></td> <td>string</td>    <td>Component of client's Subject DN</td></tr>
77 <tr><td><code>SSL_CLIENT_I_DN</code></td>               <td>string</td>    <td>Issuer DN of client's certificate</td></tr>
78 <tr><td><code>SSL_CLIENT_I_DN_</code><em>x509</em></td> <td>string</td>    <td>Component of client's Issuer DN</td></tr>
79 <tr><td><code>SSL_CLIENT_V_START</code></td>            <td>string</td>    <td>Validity of client's certificate (start time)</td></tr>
80 <tr><td><code>SSL_CLIENT_V_END</code></td>              <td>string</td>    <td>Validity of client's certificate (end time)</td></tr>
81 <tr><td><code>SSL_CLIENT_V_REMAIN</code></td>           <td>string</td>    <td>Number of days until client's certificate expires</td></tr>
82 <tr><td><code>SSL_CLIENT_A_SIG</code></td>              <td>string</td>    <td>Algorithm used for the signature of client's certificate</td></tr>
83 <tr><td><code>SSL_CLIENT_A_KEY</code></td>              <td>string</td>    <td>Algorithm used for the public key of client's certificate</td></tr>
84 <tr><td><code>SSL_CLIENT_CERT</code></td>               <td>string</td>    <td>PEM-encoded client certificate</td></tr>
85 <tr><td><code>SSL_CLIENT_CERT_CHAIN_</code><em>n</em></td> <td>string</td>    <td>PEM-encoded certificates in client certificate chain</td></tr>
86 <tr><td><code>SSL_CLIENT_VERIFY</code></td>             <td>string</td>    <td><code>NONE</code>, <code>SUCCESS</code>, <code>GENEROUS</code> or <code>FAILED:</code><em>reason</em></td></tr>
87 <tr><td><code>SSL_SERVER_M_VERSION</code></td>          <td>string</td>    <td>The version of the server certificate</td></tr>
88 <tr><td><code>SSL_SERVER_M_SERIAL</code></td>           <td>string</td>    <td>The serial of the server certificate</td></tr>
89 <tr><td><code>SSL_SERVER_S_DN</code></td>               <td>string</td>    <td>Subject DN in server's certificate</td></tr>
90 <tr><td><code>SSL_SERVER_S_DN_</code><em>x509</em></td> <td>string</td>    <td>Component of server's Subject DN</td></tr>
91 <tr><td><code>SSL_SERVER_I_DN</code></td>               <td>string</td>    <td>Issuer DN of server's certificate</td></tr>
92 <tr><td><code>SSL_SERVER_I_DN_</code><em>x509</em></td> <td>string</td>    <td>Component of server's Issuer DN</td></tr>
93 <tr><td><code>SSL_SERVER_V_START</code></td>            <td>string</td>    <td>Validity of server's certificate (start time)</td></tr>
94 <tr><td><code>SSL_SERVER_V_END</code></td>              <td>string</td>    <td>Validity of server's certificate (end time)</td></tr>
95 <tr><td><code>SSL_SERVER_A_SIG</code></td>              <td>string</td>    <td>Algorithm used for the signature of server's certificate</td></tr>
96 <tr><td><code>SSL_SERVER_A_KEY</code></td>              <td>string</td>    <td>Algorithm used for the public key of server's certificate</td></tr>
97 <tr><td><code>SSL_SERVER_CERT</code></td>               <td>string</td>    <td>PEM-encoded server certificate</td></tr>
98 </table>
99
100 <p><em>x509</em> specifies a component of an X.509 DN; one of
101 <code>C,ST,L,O,OU,CN,T,I,G,S,D,UID,Email</code>.  In Apache 2.1 and
102 later, <em>x509</em> may also include a numeric <code>_n</code>
103 suffix.  If the DN in question contains multiple attributes of the
104 same name, this suffix is used as an index to select a particular
105 attribute.  For example, where the server certificate subject DN
106 included two OU fields, <code>SSL_SERVER_S_DN_OU_0</code> and
107 <code>SSL_SERVER_S_DN_OU_1</code> could be used to reference each.</p>
108
109 <p><code>SSL_CLIENT_V_REMAIN</code> is only available in version 2.1
110 and later.</p>
111
112 <p>A number of additional environment variables can also be used
113 in <directive>SSLRequire</directive> expressions, or in custom log
114 formats:</p>
115
116 <note><pre>HTTP_USER_AGENT        PATH_INFO             AUTH_TYPE
117 HTTP_REFERER           QUERY_STRING          SERVER_SOFTWARE
118 HTTP_COOKIE            REMOTE_HOST           API_VERSION
119 HTTP_FORWARDED         REMOTE_IDENT          TIME_YEAR
120 HTTP_HOST              IS_SUBREQ             TIME_MON
121 HTTP_PROXY_CONNECTION  DOCUMENT_ROOT         TIME_DAY
122 HTTP_ACCEPT            SERVER_ADMIN          TIME_HOUR
123 THE_REQUEST            SERVER_NAME           TIME_MIN
124 REQUEST_FILENAME       SERVER_PORT           TIME_SEC
125 REQUEST_METHOD         SERVER_PROTOCOL       TIME_WDAY
126 REQUEST_SCHEME         REMOTE_ADDR           TIME
127 REQUEST_URI            REMOTE_USER</pre></note>
128
129 <p>In these contexts, two special formats can also be used:</p>
130
131 <dl>
132   <dt><code>ENV:<em>variablename</em></code></dt>
133   <dd>This will expand to the standard environment
134   variable <em>variablename</em>.</dd>
135   
136   <dt><code>HTTP:<em>headername</em></code></dt>
137   <dd>This will expand to the value of the request header with name
138   <em>headername</em>.</dd>
139 </dl>
140
141 </section>
142
143 <section id="logformats"><title>Custom Log Formats</title>
144
145 <p>When <module>mod_ssl</module> is built into Apache or at least
146 loaded (under DSO situation) additional functions exist for the <a
147 href="mod_log_config.html#formats">Custom Log Format</a> of 
148 <module>mod_log_config</module>. First there is an
149 additional ``<code>%{</code><em>varname</em><code>}x</code>''
150 eXtension format function which can be used to expand any variables
151 provided by any module, especially those provided by mod_ssl which can
152 you find in the above table.</p>
153 <p>
154 For backward compatibility there is additionally a special
155 ``<code>%{</code><em>name</em><code>}c</code>'' cryptography format function
156 provided. Information about this function is provided in the <a
157 href="../ssl/ssl_compat.html">Compatibility</a> chapter.</p>
158 <example><title>Example</title>
159 CustomLog logs/ssl_request_log \
160           "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
161 </example>
162 </section>
163
164 <section id="notes"><title>Request Notes</title>
165
166 <p><module>mod_ssl</module> sets "notes" for the request which can be
167 used in logging with the <code>%{<em>name</em>}n</code> format
168 string in <module>mod_log_config</module>.</p>
169
170 <p>The notes supported are as follows:</p>
171
172 <dl>
173   <dt><code>ssl-access-forbidden</code></dt>
174   <dd>This note is set to the value <code>1</code> if access was
175   denied due to an <directive>SSLRequire</directive>
176   or <directive>SSLRequireSSL</directive> directive.</dd>
177
178   <dt><code>ssl-secure-reneg</code></dt>
179   <dd>If <module>mod_ssl</module> is built against a version of
180   OpenSSL which supports the secure renegotiation extension, this note
181   is set to the value <code>1</code> if SSL is in used for the current
182   connection, and the client also supports the secure renegotiation
183   extension.  If the client does not support the secure renegotiation
184   extension, the note is set to the value <code>0</code>.
185   If <module>mod_ssl</module> is not built against a version of
186   OpenSSL which supports secure renegotiation, or if SSL is not in use
187   for the current connection, the note is not set.</dd>
188 </dl>
189
190 </section>
191
192 <directivesynopsis>
193 <name>SSLPassPhraseDialog</name>
194 <description>Type of pass phrase dialog for encrypted private 
195 keys</description>
196 <syntax>SSLPassPhraseDialog <em>type</em></syntax>
197 <default>SSLPassPhraseDialog builtin</default>
198 <contextlist><context>server config</context></contextlist>
199
200 <usage>
201 <p>
202 When Apache starts up it has to read the various Certificate (see
203 <directive module="mod_ssl">SSLCertificateFile</directive>) and
204 Private Key (see <directive
205 module="mod_ssl">SSLCertificateKeyFile</directive>) files of the
206 SSL-enabled virtual servers. Because for security reasons the Private
207 Key files are usually encrypted, mod_ssl needs to query the
208 administrator for a Pass Phrase in order to decrypt those files. This
209 query can be done in two ways which can be configured by
210 <em>type</em>:</p>
211 <ul>
212 <li><code>builtin</code>
213     <p>
214     This is the default where an interactive terminal dialog occurs at startup
215     time just before Apache detaches from the terminal. Here the administrator
216     has to manually enter the Pass Phrase for each encrypted Private Key file.
217     Because a lot of SSL-enabled virtual hosts can be configured, the
218     following reuse-scheme is used to minimize the dialog: When a Private Key
219     file is encrypted, all known Pass Phrases (at the beginning there are
220     none, of course) are tried. If one of those known Pass Phrases succeeds no
221     dialog pops up for this particular Private Key file. If none succeeded,
222     another Pass Phrase is queried on the terminal and remembered for the next
223     round (where it perhaps can be reused).</p>
224     <p>
225     This scheme allows mod_ssl to be maximally flexible (because for N encrypted
226     Private Key files you <em>can</em> use N different Pass Phrases - but then
227     you have to enter all of them, of course) while minimizing the terminal
228     dialog (i.e. when you use a single Pass Phrase for all N Private Key files
229     this Pass Phrase is queried only once).</p></li>
230
231 <li><code>|/path/to/program [args...]</code> 
232
233    <p>This mode allows an external program to be used which acts as a
234    pipe to a particular input device; the program is sent the standard
235    prompt text used for the <code>builtin</code> mode on
236    <code>stdin</code>, and is expected to write password strings on
237    <code>stdout</code>.  If several passwords are needed (or an
238    incorrect password is entered), additional prompt text will be
239    written subsequent to the first password being returned, and more
240    passwords must then be written back.</p></li>
241
242 <li><code>exec:/path/to/program</code>
243     <p>
244     Here an external program is configured which is called at startup for each
245     encrypted Private Key file. It is called with two arguments (the first is
246     of the form ``<code>servername:portnumber</code>'', the second is either
247     ``<code>RSA</code>'' or ``<code>DSA</code>''), which indicate for which
248     server and algorithm it has to print the corresponding Pass Phrase to
249     <code>stdout</code>. The intent is that this external program first runs
250     security checks to make sure that the system is not compromised by an
251     attacker, and only when these checks were passed successfully it provides
252     the Pass Phrase.</p>
253     <p>
254     Both these security checks, and the way the Pass Phrase is determined, can
255     be as complex as you like. Mod_ssl just defines the interface: an
256     executable program which provides the Pass Phrase on <code>stdout</code>.
257     Nothing more or less! So, if you're really paranoid about security, here
258     is your interface. Anything else has to be left as an exercise to the
259     administrator, because local security requirements are so different.</p>
260     <p>
261     The reuse-algorithm above is used here, too. In other words: The external
262     program is called only once per unique Pass Phrase.</p></li>
263 </ul>
264 <example><title>Example</title>
265 SSLPassPhraseDialog exec:/usr/local/apache/sbin/pp-filter
266 </example>
267 </usage>
268 </directivesynopsis>
269
270 <directivesynopsis>
271 <name>SSLRandomSeed</name>
272 <description>Pseudo Random Number Generator (PRNG) seeding 
273 source</description>
274 <syntax>SSLRandomSeed <em>context</em> <em>source</em> 
275 [<em>bytes</em>]</syntax>
276 <contextlist><context>server config</context></contextlist>
277
278 <usage>
279 <p>
280 This configures one or more sources for seeding the Pseudo Random Number
281 Generator (PRNG) in OpenSSL at startup time (<em>context</em> is
282 <code>startup</code>) and/or just before a new SSL connection is established
283 (<em>context</em> is <code>connect</code>). This directive can only be used
284 in the global server context because the PRNG is a global facility.</p>
285 <p>
286 The following <em>source</em> variants are available:</p>
287 <ul>
288 <li><code>builtin</code>
289     <p> This is the always available builtin seeding source. It's usage
290     consumes minimum CPU cycles under runtime and hence can be always used
291     without drawbacks. The source used for seeding the PRNG contains of the
292     current time, the current process id and (when applicable) a randomly
293     choosen 1KB extract of the inter-process scoreboard structure of Apache.
294     The drawback is that this is not really a strong source and at startup
295     time (where the scoreboard is still not available) this source just
296     produces a few bytes of entropy. So you should always, at least for the
297     startup, use an additional seeding source.</p></li>
298 <li><code>file:/path/to/source</code>
299     <p>
300     This variant uses an external file <code>/path/to/source</code> as the
301     source for seeding the PRNG. When <em>bytes</em> is specified, only the
302     first <em>bytes</em> number of bytes of the file form the entropy (and
303     <em>bytes</em> is given to <code>/path/to/source</code> as the first
304     argument). When <em>bytes</em> is not specified the whole file forms the
305     entropy (and <code>0</code> is given to <code>/path/to/source</code> as
306     the first argument). Use this especially at startup time, for instance
307     with an available <code>/dev/random</code> and/or
308     <code>/dev/urandom</code> devices (which usually exist on modern Unix
309     derivates like FreeBSD and Linux).</p>
310     <p>
311     <em>But be careful</em>: Usually <code>/dev/random</code> provides only as
312     much entropy data as it actually has, i.e. when you request 512 bytes of
313     entropy, but the device currently has only 100 bytes available two things
314     can happen: On some platforms you receive only the 100 bytes while on
315     other platforms the read blocks until enough bytes are available (which
316     can take a long time). Here using an existing <code>/dev/urandom</code> is
317     better, because it never blocks and actually gives the amount of requested
318     data. The drawback is just that the quality of the received data may not
319     be the best.</p>
320     <p>
321     On some platforms like FreeBSD one can even control how the entropy is
322     actually generated, i.e. by which system interrupts. More details one can
323     find under <em>rndcontrol(8)</em> on those platforms. Alternatively, when
324     your system lacks such a random device, you can use tool
325     like <a href="http://www.lothar.com/tech/crypto/">EGD</a>
326     (Entropy Gathering Daemon) and run it's client program with the
327     <code>exec:/path/to/program/</code> variant (see below) or use
328     <code>egd:/path/to/egd-socket</code> (see below).</p></li>
329
330 <li><code>exec:/path/to/program</code>
331     <p>
332     This variant uses an external executable
333     <code>/path/to/program</code> as the source for seeding the
334     PRNG. When <em>bytes</em> is specified, only the first
335     <em>bytes</em> number of bytes of its <code>stdout</code> contents
336     form the entropy. When <em>bytes</em> is not specified, the
337     entirety of the data produced on <code>stdout</code> form the
338     entropy. Use this only at startup time when you need a very strong
339     seeding with the help of an external program (for instance as in
340     the example above with the <code>truerand</code> utility you can
341     find in the mod_ssl distribution which is based on the AT&amp;T
342     <em>truerand</em> library). Using this in the connection context
343     slows down the server too dramatically, of course.  So usually you
344     should avoid using external programs in that context.</p></li>
345 <li><code>egd:/path/to/egd-socket</code> (Unix only)
346     <p>
347     This variant uses the Unix domain socket of the
348     external Entropy Gathering Daemon (EGD) (see <a
349     href="http://www.lothar.com/tech/crypto/">http://www.lothar.com/tech
350     /crypto/</a>) to seed the PRNG. Use this if no random device exists
351     on your platform.</p></li>
352 </ul>
353 <example><title>Example</title>
354 SSLRandomSeed startup builtin<br />
355 SSLRandomSeed startup file:/dev/random<br />
356 SSLRandomSeed startup file:/dev/urandom 1024<br />
357 SSLRandomSeed startup exec:/usr/local/bin/truerand 16<br />
358 SSLRandomSeed connect builtin<br />
359 SSLRandomSeed connect file:/dev/random<br />
360 SSLRandomSeed connect file:/dev/urandom 1024<br />
361 </example>
362 </usage>
363 </directivesynopsis>
364
365 <directivesynopsis>
366 <name>SSLSessionCache</name>
367 <description>Type of the global/inter-process SSL Session 
368 Cache</description>
369 <syntax>SSLSessionCache <em>type</em></syntax>
370 <default>SSLSessionCache none</default>
371 <contextlist><context>server config</context></contextlist>
372
373 <usage>
374 <p>
375 This configures the storage type of the global/inter-process SSL Session
376 Cache. This cache is an optional facility which speeds up parallel request
377 processing. For requests to the same server process (via HTTP keep-alive),
378 OpenSSL already caches the SSL session information locally. But because modern
379 clients request inlined images and other data via parallel requests (usually
380 up to four parallel requests are common) those requests are served by
381 <em>different</em> pre-forked server processes. Here an inter-process cache
382 helps to avoid unneccessary session handshakes.</p>
383 <p>
384 The following four storage <em>type</em>s are currently supported:</p>
385 <ul>
386 <li><code>none</code>
387
388     <p>This disables the global/inter-process Session Cache.  This
389     will incur a noticeable speed penalty and may cause problems if
390     using certain browsers, particularly if client certificates are
391     enabled.  This setting is not recommended.</p></li>
392
393 <li><code>nonenotnull</code>
394
395     <p>This disables any global/inter-process Session Cache.  However
396     it does force OpenSSL to send a non-null session ID to
397     accommodate buggy clients that require one.</p></li>
398
399 <li><code>dbm:/path/to/datafile</code>
400
401     <p>This makes use of a DBM hashfile on the local disk to
402     synchronize the local OpenSSL memory caches of the server
403     processes.  This session cache may suffer reliability issues under
404     high load.</p></li>
405
406 <li><code>shm:/path/to/datafile</code>[<code>(</code><em>size</em><code>)</code>]
407
408     <p>This makes use of a high-performance cyclic buffer
409     (approx. <em>size</em> bytes in size) inside a shared memory
410     segment in RAM (established via <code>/path/to/datafile</code>) to
411     synchronize the local OpenSSL memory caches of the server
412     processes.  This is the recommended session cache.</p></li>
413
414 <li><code>dc:UNIX:/path/to/socket</code>
415
416     <p>This makes use of the <a
417     href="http://www.distcache.org/">distcache</a> distributed session
418     caching libraries.  The argument should specify the location of
419     the server or proxy to be used using the distcache address syntax;
420     for example, <code>UNIX:/path/to/socket</code> specifies a UNIX
421     domain socket (typically a local dc_client proxy);
422     <code>IP:server.example.com:9001</code> specifies an IP
423     address.</p></li>
424
425 </ul>
426
427 <example><title>Examples</title>
428 SSLSessionCache dbm:/usr/local/apache/logs/ssl_gcache_data<br />
429 SSLSessionCache shm:/usr/local/apache/logs/ssl_gcache_data(512000)
430 </example>
431
432 <p>The <code>ssl-cache</code> mutex is used to serialize access to
433 the session cache to prevent corruption.  This mutex can be configured
434 using the <directive module="core">Mutex</directive> directive.</p>
435 </usage>
436 </directivesynopsis>
437
438 <directivesynopsis>
439 <name>SSLSessionCacheTimeout</name>
440 <description>Number of seconds before an SSL session expires
441 in the Session Cache</description>
442 <syntax>SSLSessionCacheTimeout <em>seconds</em></syntax>
443 <default>SSLSessionCacheTimeout 300</default>
444 <contextlist><context>server config</context>
445 <context>virtual host</context></contextlist>
446
447 <usage>
448 <p>
449 This directive sets the timeout in seconds for the information stored in the
450 global/inter-process SSL Session Cache and the OpenSSL internal memory cache.
451 It can be set as low as 15 for testing, but should be set to higher
452 values like 300 in real life.</p>
453 <example><title>Example</title>
454 SSLSessionCacheTimeout 600
455 </example>
456 </usage>
457 </directivesynopsis>
458
459 <directivesynopsis>
460 <name>SSLEngine</name>
461 <description>SSL Engine Operation Switch</description>
462 <syntax>SSLEngine on|off|optional</syntax>
463 <default>SSLEngine off</default>
464 <contextlist><context>server config</context>
465 <context>virtual host</context></contextlist>
466
467 <usage>
468 <p>
469 This directive toggles the usage of the SSL/TLS Protocol Engine. This
470 is usually used inside a <directive module="core"
471 type="section">VirtualHost</directive> section to enable SSL/TLS for a
472 particular virtual host. By default the SSL/TLS Protocol Engine is
473 disabled for both the main server and all configured virtual hosts.</p>
474 <example><title>Example</title>
475 &lt;VirtualHost _default_:443&gt;<br />
476 SSLEngine on<br />
477 ...<br />
478 &lt;/VirtualHost&gt;
479 </example>
480 <p>In Apache 2.1 and later, <directive>SSLEngine</directive> can be set to 
481 <code>optional</code>. This enables support for 
482 <a href="http://www.ietf.org/rfc/rfc2817.txt">RFC 2817</a>, Upgrading to TLS 
483 Within HTTP/1.1. At this time no web browsers support RFC 2817.</p>
484 </usage>
485 </directivesynopsis>
486
487 <directivesynopsis>
488 <name>SSLFIPS</name>
489 <description>SSL FIPS mode Switch</description>
490 <syntax>SSLFIPS on|off</syntax>
491 <default>SSLFIPS off</default>
492 <contextlist><context>server config</context></contextlist>
493
494 <usage>
495 <p>
496 This directive toggles the usage of the SSL library FIPS_mode flag.
497 It must be set in the global server context and cannot be configured
498 with conflicting settings (SSLFIPS on followed by SSLFIPS off or 
499 similar).  The mode applies to all SSL library operations.
500 </p>
501 <p>
502 If httpd was compiled against an SSL library which did not support
503 the FIPS_mode flag, <code>SSLFIPS on</code> will fail.  Refer to the
504 FIPS 140-2 Security Policy document of the SSL provider library for
505 specific requirements to use mod_ssl in a FIPS 140-2 approved mode
506 of operation; note that mod_ssl itself is not validated, but may be
507 described as using FIPS 140-2 validated cryptographic module, when
508 all components are assembled and operated under the guidelines imposed
509 by the applicable Security Policy.
510 </p>
511 </usage>
512 </directivesynopsis>
513
514 <directivesynopsis>
515 <name>SSLProtocol</name>
516 <description>Configure usable SSL protocol versions</description>
517 <syntax>SSLProtocol [+|-]<em>protocol</em> ...</syntax>
518 <default>SSLProtocol all</default>
519 <contextlist><context>server config</context>
520 <context>virtual host</context></contextlist>
521
522 <usage>
523 <p>
524 This directive can be used to control which versions of the SSL protocol 
525 will be accepted in new connections.</p>
526 <p>
527 The available (case-insensitive) <em>protocol</em>s are:</p>
528 <ul>
529 <li><code>SSLv2</code>
530     <p>
531     This is the Secure Sockets Layer (SSL) protocol, version 2.0. It is the
532     original SSL protocol as designed by Netscape Corporation.  Though it's
533     use has been deprecated, because of weaknesses in the security of the protocol.</p></li>
534
535 <li><code>SSLv3</code>
536     <p>
537     This is the Secure Sockets Layer (SSL) protocol, version 3.0, from
538     the Netscape Corporation. 
539     It is the successor to SSLv2 and the predecessor to TLSv1. It's supported by
540     almost all popular browsers.</p></li>
541
542 <li><code>TLSv1</code>
543     <p>
544     This is the Transport Layer Security (TLS) protocol, version 1.0. It is the
545     successor to SSLv3 and is defined in <a href="http://www.ietf.org/rfc/rfc2246.txt">RFC2246</a>. 
546     Which has been obsoleted by <a href="http://www.ietf.org/rfc/rfc4346.txt">RFC4346</a>.</p></li>
547
548 <li><code>All</code>
549     <p>
550     This is a shortcut for ``<code>+SSLv2 +SSLv3 +TLSv1</code>'' and a
551     convenient way for enabling all protocols except one when used in
552     combination with the minus sign on a protocol as the example above 
553     shows.</p></li>
554 </ul>
555 <example><title>Example</title>
556 #   enable SSLv3 and TLSv1, but not SSLv2<br />
557 SSLProtocol all -SSLv2
558 </example>
559 </usage>
560 </directivesynopsis>
561
562 <directivesynopsis>
563 <name>SSLCipherSuite</name>
564 <description>Cipher Suite available for negotiation in SSL 
565 handshake</description>
566 <syntax>SSLCipherSuite <em>cipher-spec</em></syntax>
567 <default>SSLCipherSuite ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP</default>
568 <contextlist><context>server config</context>
569 <context>virtual host</context>
570 <context>directory</context>
571 <context>.htaccess</context></contextlist>
572 <override>AuthConfig</override>
573
574 <usage>
575 <p>
576 This complex directive uses a colon-separated <em>cipher-spec</em> string
577 consisting of OpenSSL cipher specifications to configure the Cipher Suite the
578 client is permitted to negotiate in the SSL handshake phase. Notice that this
579 directive can be used both in per-server and per-directory context. In
580 per-server context it applies to the standard SSL handshake when a connection
581 is established. In per-directory context it forces a SSL renegotation with the
582 reconfigured Cipher Suite after the HTTP request was read but before the HTTP
583 response is sent.</p>
584 <p>
585 An SSL cipher specification in <em>cipher-spec</em> is composed of 4 major
586 attributes plus a few extra minor ones:</p>
587 <ul>
588 <li><em>Key Exchange Algorithm</em>:<br />
589     RSA or Diffie-Hellman variants.
590 </li>
591 <li><em>Authentication Algorithm</em>:<br />
592     RSA, Diffie-Hellman, DSS or none.
593 </li>
594 <li><em>Cipher/Encryption Algorithm</em>:<br />
595     DES, Triple-DES, RC4, RC2, IDEA or none.
596 </li>
597 <li><em>MAC Digest Algorithm</em>:<br />
598     MD5, SHA or SHA1.
599 </li>
600 </ul>
601 <p>An SSL cipher can also be an export cipher and is either a SSLv2 or SSLv3/TLSv1
602 cipher (here TLSv1 is equivalent to SSLv3). To specify which ciphers to use,
603 one can either specify all the Ciphers, one at a time, or use aliases to
604 specify the preference and order for the ciphers (see <a href="#table1">Table
605 1</a>).</p>
606
607 <table border="1">
608 <columnspec><column width=".5"/><column width=".5"/></columnspec>
609 <tr><th><a name="table1">Tag</a></th> <th>Description</th></tr>
610 <tr><td colspan="2"><em>Key Exchange Algorithm:</em></td></tr>
611 <tr><td><code>kRSA</code></td>   <td>RSA key exchange</td></tr>
612 <tr><td><code>kDHr</code></td>   <td>Diffie-Hellman key exchange with RSA key</td></tr>
613 <tr><td><code>kDHd</code></td>   <td>Diffie-Hellman key exchange with DSA key</td></tr>
614 <tr><td><code>kEDH</code></td>   <td>Ephemeral (temp.key) Diffie-Hellman key exchange (no cert)</td>   </tr>
615 <tr><td colspan="2"><em>Authentication Algorithm:</em></td></tr>
616 <tr><td><code>aNULL</code></td>  <td>No authentication</td></tr>
617 <tr><td><code>aRSA</code></td>   <td>RSA authentication</td></tr>
618 <tr><td><code>aDSS</code></td>   <td>DSS authentication</td> </tr>
619 <tr><td><code>aDH</code></td>    <td>Diffie-Hellman authentication</td></tr>
620 <tr><td colspan="2"><em>Cipher Encoding Algorithm:</em></td></tr>
621 <tr><td><code>eNULL</code></td>  <td>No encoding</td>         </tr>
622 <tr><td><code>DES</code></td>    <td>DES encoding</td>        </tr>
623 <tr><td><code>3DES</code></td>   <td>Triple-DES encoding</td> </tr>
624 <tr><td><code>RC4</code></td>    <td>RC4 encoding</td>       </tr>
625 <tr><td><code>RC2</code></td>    <td>RC2 encoding</td>       </tr>
626 <tr><td><code>IDEA</code></td>   <td>IDEA encoding</td>       </tr>
627 <tr><td colspan="2"><em>MAC Digest Algorithm</em>:</td></tr>
628 <tr><td><code>MD5</code></td>    <td>MD5 hash function</td></tr>
629 <tr><td><code>SHA1</code></td>   <td>SHA1 hash function</td></tr>
630 <tr><td><code>SHA</code></td>    <td>SHA hash function</td> </tr>
631 <tr><td colspan="2"><em>Aliases:</em></td></tr>
632 <tr><td><code>SSLv2</code></td>  <td>all SSL version 2.0 ciphers</td></tr>
633 <tr><td><code>SSLv3</code></td>  <td>all SSL version 3.0 ciphers</td> </tr>
634 <tr><td><code>TLSv1</code></td>  <td>all TLS version 1.0 ciphers</td> </tr>
635 <tr><td><code>EXP</code></td>    <td>all export ciphers</td>  </tr>
636 <tr><td><code>EXPORT40</code></td> <td>all 40-bit export ciphers only</td>  </tr>
637 <tr><td><code>EXPORT56</code></td> <td>all 56-bit export ciphers only</td>  </tr>
638 <tr><td><code>LOW</code></td>    <td>all low strength ciphers (no export, single DES)</td></tr>
639 <tr><td><code>MEDIUM</code></td> <td>all ciphers with 128 bit encryption</td> </tr>
640 <tr><td><code>HIGH</code></td>   <td>all ciphers using Triple-DES</td>     </tr>
641 <tr><td><code>RSA</code></td>    <td>all ciphers using RSA key exchange</td> </tr>
642 <tr><td><code>DH</code></td>     <td>all ciphers using Diffie-Hellman key exchange</td> </tr>
643 <tr><td><code>EDH</code></td>    <td>all ciphers using Ephemeral Diffie-Hellman key exchange</td> </tr>
644 <tr><td><code>ADH</code></td>    <td>all ciphers using Anonymous Diffie-Hellman key exchange</td> </tr>
645 <tr><td><code>DSS</code></td>    <td>all ciphers using DSS authentication</td> </tr>
646 <tr><td><code>NULL</code></td>   <td>all ciphers using no encryption</td> </tr>
647 </table>
648 <p>
649 Now where this becomes interesting is that these can be put together
650 to specify the order and ciphers you wish to use. To speed this up
651 there are also aliases (<code>SSLv2, SSLv3, TLSv1, EXP, LOW, MEDIUM,
652 HIGH</code>) for certain groups of ciphers. These tags can be joined
653 together with prefixes to form the <em>cipher-spec</em>. Available
654 prefixes are:</p>
655 <ul>
656 <li>none: add cipher to list</li>
657 <li><code>+</code>: add ciphers to list and pull them to current location in list</li>
658 <li><code>-</code>: remove cipher from list (can be added later again)</li>
659 <li><code>!</code>: kill cipher from list completely (can <strong>not</strong> be added later again)</li>
660 </ul>
661 <p>A simpler way to look at all of this is to use the ``<code>openssl ciphers
662 -v</code>'' command which provides a nice way to successively create the
663 correct <em>cipher-spec</em> string. The default <em>cipher-spec</em> string
664 is ``<code>ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP</code>'' which
665 means the following: first, remove from consideration any ciphers that do not
666 authenticate, i.e. for SSL only the Anonymous Diffie-Hellman ciphers. Next,
667 use ciphers using RC4 and RSA. Next include the high, medium and then the low
668 security ciphers. Finally <em>pull</em> all SSLv2 and export ciphers to the
669 end of the list.</p>
670 <example>
671 <pre>
672 $ openssl ciphers -v 'ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP'
673 NULL-SHA                SSLv3 Kx=RSA      Au=RSA  Enc=None      Mac=SHA1
674 NULL-MD5                SSLv3 Kx=RSA      Au=RSA  Enc=None      Mac=MD5
675 EDH-RSA-DES-CBC3-SHA    SSLv3 Kx=DH       Au=RSA  Enc=3DES(168) Mac=SHA1
676 ...                     ...               ...     ...           ...
677 EXP-RC4-MD5             SSLv3 Kx=RSA(512) Au=RSA  Enc=RC4(40)   Mac=MD5  export
678 EXP-RC2-CBC-MD5         SSLv2 Kx=RSA(512) Au=RSA  Enc=RC2(40)   Mac=MD5  export
679 EXP-RC4-MD5             SSLv2 Kx=RSA(512) Au=RSA  Enc=RC4(40)   Mac=MD5  export
680 </pre>
681 </example>
682 <p>The complete list of particular RSA &amp; DH ciphers for SSL is given in <a
683 href="#table2">Table 2</a>.</p>
684 <example><title>Example</title>
685 SSLCipherSuite RSA:!EXP:!NULL:+HIGH:+MEDIUM:-LOW
686 </example>
687 <table border="1">
688 <columnspec><column width=".3"/><column width=".1"/><column width=".13"/>
689 <column width=".1"/><column width=".13"/><column width=".1"/>
690 <column width=".13"/></columnspec>
691 <tr><th><a name="table2">Cipher-Tag</a></th> <th>Protocol</th> <th>Key Ex.</th> <th>Auth.</th> <th>Enc.</th> <th>MAC</th> <th>Type</th> </tr>
692 <tr><td colspan="7"><em>RSA Ciphers:</em></td></tr>
693 <tr><td><code>DES-CBC3-SHA</code></td> <td>SSLv3</td> <td>RSA</td> <td>RSA</td> <td>3DES(168)</td> <td>SHA1</td> <td></td> </tr>
694 <tr><td><code>DES-CBC3-MD5</code></td> <td>SSLv2</td> <td>RSA</td> <td>RSA</td> <td>3DES(168)</td> <td>MD5</td> <td></td> </tr>
695 <tr><td><code>IDEA-CBC-SHA</code></td> <td>SSLv3</td> <td>RSA</td> <td>RSA</td> <td>IDEA(128)</td> <td>SHA1</td> <td></td> </tr>
696 <tr><td><code>RC4-SHA</code></td> <td>SSLv3</td> <td>RSA</td> <td>RSA</td> <td>RC4(128)</td> <td>SHA1</td> <td></td> </tr>
697 <tr><td><code>RC4-MD5</code></td> <td>SSLv3</td> <td>RSA</td> <td>RSA</td> <td>RC4(128)</td> <td>MD5</td> <td></td> </tr>
698 <tr><td><code>IDEA-CBC-MD5</code></td> <td>SSLv2</td> <td>RSA</td> <td>RSA</td> <td>IDEA(128)</td> <td>MD5</td> <td></td> </tr>
699 <tr><td><code>RC2-CBC-MD5</code></td> <td>SSLv2</td> <td>RSA</td> <td>RSA</td> <td>RC2(128)</td> <td>MD5</td> <td></td> </tr>
700 <tr><td><code>RC4-MD5</code></td> <td>SSLv2</td> <td>RSA</td> <td>RSA</td> <td>RC4(128)</td> <td>MD5</td> <td></td> </tr>
701 <tr><td><code>DES-CBC-SHA</code></td> <td>SSLv3</td> <td>RSA</td> <td>RSA</td> <td>DES(56)</td> <td>SHA1</td> <td></td> </tr>
702 <tr><td><code>RC4-64-MD5</code></td> <td>SSLv2</td> <td>RSA</td> <td>RSA</td> <td>RC4(64)</td> <td>MD5</td> <td></td> </tr>
703 <tr><td><code>DES-CBC-MD5</code></td> <td>SSLv2</td> <td>RSA</td> <td>RSA</td> <td>DES(56)</td> <td>MD5</td> <td></td> </tr>
704 <tr><td><code>EXP-DES-CBC-SHA</code></td> <td>SSLv3</td> <td>RSA(512)</td> <td>RSA</td> <td>DES(40)</td> <td>SHA1</td> <td> export</td> </tr>
705 <tr><td><code>EXP-RC2-CBC-MD5</code></td> <td>SSLv3</td> <td>RSA(512)</td> <td>RSA</td> <td>RC2(40)</td> <td>MD5</td> <td>  export</td> </tr>
706 <tr><td><code>EXP-RC4-MD5</code></td> <td>SSLv3</td> <td>RSA(512)</td> <td>RSA</td> <td>RC4(40)</td> <td>MD5</td> <td>  export</td> </tr>
707 <tr><td><code>EXP-RC2-CBC-MD5</code></td> <td>SSLv2</td> <td>RSA(512)</td> <td>RSA</td> <td>RC2(40)</td> <td>MD5</td> <td>  export</td> </tr>
708 <tr><td><code>EXP-RC4-MD5</code></td> <td>SSLv2</td> <td>RSA(512)</td> <td>RSA</td> <td>RC4(40)</td> <td>MD5</td> <td>  export</td> </tr>
709 <tr><td><code>NULL-SHA</code></td> <td>SSLv3</td> <td>RSA</td> <td>RSA</td> <td>None</td> <td>SHA1</td> <td></td> </tr>
710 <tr><td><code>NULL-MD5</code></td> <td>SSLv3</td> <td>RSA</td> <td>RSA</td> <td>None</td> <td>MD5</td> <td></td> </tr>
711 <tr><td colspan="7"><em>Diffie-Hellman Ciphers:</em></td></tr>
712 <tr><td><code>ADH-DES-CBC3-SHA</code></td> <td>SSLv3</td> <td>DH</td> <td>None</td> <td>3DES(168)</td> <td>SHA1</td> <td></td> </tr>
713 <tr><td><code>ADH-DES-CBC-SHA</code></td> <td>SSLv3</td> <td>DH</td> <td>None</td> <td>DES(56)</td> <td>SHA1</td> <td></td> </tr>
714 <tr><td><code>ADH-RC4-MD5</code></td> <td>SSLv3</td> <td>DH</td> <td>None</td> <td>RC4(128)</td> <td>MD5</td> <td></td> </tr>
715 <tr><td><code>EDH-RSA-DES-CBC3-SHA</code></td> <td>SSLv3</td> <td>DH</td> <td>RSA</td> <td>3DES(168)</td> <td>SHA1</td> <td></td> </tr>
716 <tr><td><code>EDH-DSS-DES-CBC3-SHA</code></td> <td>SSLv3</td> <td>DH</td> <td>DSS</td> <td>3DES(168)</td> <td>SHA1</td> <td></td> </tr>
717 <tr><td><code>EDH-RSA-DES-CBC-SHA</code></td> <td>SSLv3</td> <td>DH</td> <td>RSA</td> <td>DES(56)</td> <td>SHA1</td> <td></td> </tr>
718 <tr><td><code>EDH-DSS-DES-CBC-SHA</code></td> <td>SSLv3</td> <td>DH</td> <td>DSS</td> <td>DES(56)</td> <td>SHA1</td> <td></td> </tr>
719 <tr><td><code>EXP-EDH-RSA-DES-CBC-SHA</code></td> <td>SSLv3</td> <td>DH(512)</td> <td>RSA</td> <td>DES(40)</td> <td>SHA1</td> <td> export</td> </tr>
720 <tr><td><code>EXP-EDH-DSS-DES-CBC-SHA</code></td> <td>SSLv3</td> <td>DH(512)</td> <td>DSS</td> <td>DES(40)</td> <td>SHA1</td> <td> export</td> </tr>
721 <tr><td><code>EXP-ADH-DES-CBC-SHA</code></td> <td>SSLv3</td> <td>DH(512)</td> <td>None</td> <td>DES(40)</td> <td>SHA1</td> <td> export</td> </tr>
722 <tr><td><code>EXP-ADH-RC4-MD5</code></td> <td>SSLv3</td> <td>DH(512)</td> <td>None</td> <td>RC4(40)</td> <td>MD5</td> <td>  export</td> </tr>
723 </table>
724 </usage>
725 </directivesynopsis>
726
727 <directivesynopsis>
728 <name>SSLCertificateFile</name>
729 <description>Server PEM-encoded X.509 Certificate file</description>
730 <syntax>SSLCertificateFile <em>file-path</em></syntax>
731 <contextlist><context>server config</context>
732 <context>virtual host</context></contextlist>
733
734 <usage>
735 <p>
736 This directive points to the PEM-encoded Certificate file for the server and
737 optionally also to the corresponding RSA or DSA Private Key file for it
738 (contained in the same file). If the contained Private Key is encrypted the
739 Pass Phrase dialog is forced at startup time. This directive can be used up to
740 two times (referencing different filenames) when both a RSA and a DSA based
741 server certificate is used in parallel.</p>
742 <example><title>Example</title>
743 SSLCertificateFile /usr/local/apache2/conf/ssl.crt/server.crt
744 </example>
745 </usage>
746 </directivesynopsis>
747
748 <directivesynopsis>
749 <name>SSLCertificateKeyFile</name>
750 <description>Server PEM-encoded Private Key file</description>
751 <syntax>SSLCertificateKeyFile <em>file-path</em></syntax>
752 <contextlist><context>server config</context>
753 <context>virtual host</context></contextlist>
754
755 <usage>
756 <p>
757 This directive points to the PEM-encoded Private Key file for the
758 server. If the Private Key is not combined with the Certificate in the
759 <directive>SSLCertificateFile</directive>, use this additional directive to
760 point to the file with the stand-alone Private Key. When
761 <directive>SSLCertificateFile</directive> is used and the file
762 contains both the Certificate and the Private Key this directive need
763 not be used. But we strongly discourage this practice.  Instead we
764 recommend you to separate the Certificate and the Private Key. If the
765 contained Private Key is encrypted, the Pass Phrase dialog is forced
766 at startup time. This directive can be used up to two times
767 (referencing different filenames) when both a RSA and a DSA based
768 private key is used in parallel.</p>
769 <example><title>Example</title>
770 SSLCertificateKeyFile /usr/local/apache2/conf/ssl.key/server.key
771 </example>
772 </usage>
773 </directivesynopsis>
774
775 <directivesynopsis>
776 <name>SSLCertificateChainFile</name>
777 <description>File of PEM-encoded Server CA Certificates</description>
778 <syntax>SSLCertificateChainFile <em>file-path</em></syntax>
779 <contextlist><context>server config</context>
780 <context>virtual host</context></contextlist>
781
782 <usage>
783 <p>
784 This directive sets the optional <em>all-in-one</em> file where you can
785 assemble the certificates of Certification Authorities (CA) which form the
786 certificate chain of the server certificate. This starts with the issuing CA
787 certificate of the server certificate and can range up to the root CA
788 certificate. Such a file is simply the concatenation of the various
789 PEM-encoded CA Certificate files, usually in certificate chain order.</p>
790 <p>
791 This should be used alternatively and/or additionally to <directive
792 module="mod_ssl">SSLCACertificatePath</directive> for explicitly
793 constructing the server certificate chain which is sent to the browser
794 in addition to the server certificate. It is especially useful to
795 avoid conflicts with CA certificates when using client
796 authentication. Because although placing a CA certificate of the
797 server certificate chain into <directive
798 module="mod_ssl">SSLCACertificatePath</directive> has the same effect
799 for the certificate chain construction, it has the side-effect that
800 client certificates issued by this same CA certificate are also
801 accepted on client authentication.</p>
802 <p>
803 But be careful: Providing the certificate chain works only if you are using a
804 <em>single</em> RSA <em>or</em> DSA based server certificate. If you are
805 using a coupled RSA+DSA certificate pair, this will work only if actually both
806 certificates use the <em>same</em> certificate chain. Else the browsers will be
807 confused in this situation.</p>
808 <example><title>Example</title>
809 SSLCertificateChainFile /usr/local/apache2/conf/ssl.crt/ca.crt
810 </example>
811 </usage>
812 </directivesynopsis>
813
814 <directivesynopsis>
815 <name>SSLCACertificatePath</name>
816 <description>Directory of PEM-encoded CA Certificates for 
817 Client Auth</description>
818 <syntax>SSLCACertificatePath <em>directory-path</em></syntax>
819 <contextlist><context>server config</context>
820 <context>virtual host</context></contextlist>
821
822 <usage>
823 <p>
824 This directive sets the directory where you keep the Certificates of
825 Certification Authorities (CAs) whose clients you deal with. These are used to
826 verify the client certificate on Client Authentication.</p>
827 <p>
828 The files in this directory have to be PEM-encoded and are accessed through
829 hash filenames. So usually you can't just place the Certificate files
830 there: you also have to create symbolic links named
831 <em>hash-value</em><code>.N</code>. And you should always make sure this directory
832 contains the appropriate symbolic links. Use the <code>Makefile</code> which
833 comes with mod_ssl to accomplish this task.</p>
834 <example><title>Example</title>
835 SSLCACertificatePath /usr/local/apache2/conf/ssl.crt/
836 </example>
837 </usage>
838 </directivesynopsis>
839
840 <directivesynopsis>
841 <name>SSLCACertificateFile</name>
842 <description>File of concatenated PEM-encoded CA Certificates 
843 for Client Auth</description>
844 <syntax>SSLCACertificateFile <em>file-path</em></syntax>
845 <contextlist><context>server config</context>
846 <context>virtual host</context></contextlist>
847
848 <usage>
849 <p>
850 This directive sets the <em>all-in-one</em> file where you can assemble the
851 Certificates of Certification Authorities (CA) whose <em>clients</em> you deal
852 with. These are used for Client Authentication. Such a file is simply the
853 concatenation of the various PEM-encoded Certificate files, in order of
854 preference. This can be used alternatively and/or additionally to 
855 <directive module="mod_ssl">SSLCACertificatePath</directive>.</p>
856 <example><title>Example</title>
857 SSLCACertificateFile /usr/local/apache2/conf/ssl.crt/ca-bundle-client.crt
858 </example>
859 </usage>
860 </directivesynopsis>
861
862 <directivesynopsis>
863 <name>SSLCADNRequestFile</name>
864 <description>File of concatenated PEM-encoded CA Certificates 
865 for defining acceptable CA names</description>
866 <syntax>SSLCADNRequestFile <em>file-path</em></syntax>
867 <contextlist><context>server config</context>
868 <context>virtual host</context></contextlist>
869
870 <usage>
871 <p>When a client certificate is requested by mod_ssl, a list of
872 <em>acceptable Certificate Authority names</em> is sent to the client
873 in the SSL handshake.  These CA names can be used by the client to
874 select an appropriate client certificate out of those it has
875 available.</p>
876
877 <p>If neither of the directives <directive
878 module="mod_ssl">SSLCADNRequestPath</directive> or <directive
879 module="mod_ssl">SSLCADNRequestFile</directive> are given, then the
880 set of acceptable CA names sent to the client is the names of all the
881 CA certificates given by the <directive
882 module="mod_ssl">SSLCACertificateFile</directive> and <directive
883 module="mod_ssl">SSLCACertificatePath</directive> directives; in other
884 words, the names of the CAs which will actually be used to verify the
885 client certificate.</p>
886
887 <p>In some circumstances, it is useful to be able to send a set of
888 acceptable CA names which differs from the actual CAs used to verify
889 the client certificate - for example, if the client certificates are
890 signed by intermediate CAs.  In such cases, <directive
891 module="mod_ssl">SSLCADNRequestPath</directive> and/or <directive
892 module="mod_ssl">SSLCADNRequestFile</directive> can be used; the
893 acceptable CA names are then taken from the complete set of
894 certificates in the directory and/or file specified by this pair of
895 directives.</p>
896
897 <p><directive module="mod_ssl">SSLCADNRequestFile</directive> must
898 specify an <em>all-in-one</em> file containing a concatenation of
899 PEM-encoded CA certificates.</p>
900
901 <example><title>Example</title>
902 SSLCADNRequestFile /usr/local/apache2/conf/ca-names.crt
903 </example>
904 </usage>
905 </directivesynopsis>
906
907 <directivesynopsis>
908 <name>SSLCADNRequestPath</name>
909 <description>Directory of PEM-encoded CA Certificates for 
910 defining acceptable CA names</description>
911 <syntax>SSLCADNRequestPath <em>directory-path</em></syntax>
912 <contextlist><context>server config</context>
913 <context>virtual host</context></contextlist>
914
915 <usage>
916
917 <p>This optional directive can be used to specify the set of
918 <em>acceptable CA names</em> which will be sent to the client when a
919 client certificate is requested.  See the <directive
920 module="mod_ssl">SSLCADNRequestFile</directive> directive for more
921 details.</p>
922
923 <p>The files in this directory have to be PEM-encoded and are accessed
924 through hash filenames. So usually you can't just place the
925 Certificate files there: you also have to create symbolic links named
926 <em>hash-value</em><code>.N</code>. And you should always make sure
927 this directory contains the appropriate symbolic links. Use the
928 <code>Makefile</code> which comes with mod_ssl to accomplish this
929 task.</p>
930 <example><title>Example</title>
931 SSLCADNRequestPath /usr/local/apache2/conf/ca-names.crt/
932 </example>
933 </usage>
934 </directivesynopsis>
935
936 <directivesynopsis>
937 <name>SSLCARevocationPath</name>
938 <description>Directory of PEM-encoded CA CRLs for 
939 Client Auth</description>
940 <syntax>SSLCARevocationPath <em>directory-path</em></syntax>
941 <contextlist><context>server config</context>
942 <context>virtual host</context></contextlist>
943
944 <usage>
945 <p>
946 This directive sets the directory where you keep the Certificate Revocation
947 Lists (CRL) of Certification Authorities (CAs) whose clients you deal with.
948 These are used to revoke the client certificate on Client Authentication.</p>
949 <p>
950 The files in this directory have to be PEM-encoded and are accessed through
951 hash filenames. So usually you have not only to place the CRL files there.
952 Additionally you have to create symbolic links named
953 <em>hash-value</em><code>.rN</code>. And you should always make sure this directory
954 contains the appropriate symbolic links. Use the <code>Makefile</code> which
955 comes with <module>mod_ssl</module> to accomplish this task.</p>
956 <example><title>Example</title>
957 SSLCARevocationPath /usr/local/apache2/conf/ssl.crl/
958 </example>
959 </usage>
960 </directivesynopsis>
961
962 <directivesynopsis>
963 <name>SSLCARevocationFile</name>
964 <description>File of concatenated PEM-encoded CA CRLs for 
965 Client Auth</description>
966 <syntax>SSLCARevocationFile <em>file-path</em></syntax>
967 <contextlist><context>server config</context>
968 <context>virtual host</context></contextlist>
969
970 <usage>
971 <p>
972 This directive sets the <em>all-in-one</em> file where you can
973 assemble the Certificate Revocation Lists (CRL) of Certification
974 Authorities (CA) whose <em>clients</em> you deal with. These are used
975 for Client Authentication.  Such a file is simply the concatenation of
976 the various PEM-encoded CRL files, in order of preference. This can be
977 used alternatively and/or additionally to <directive
978 module="mod_ssl">SSLCARevocationPath</directive>.</p>
979 <example><title>Example</title>
980 SSLCARevocationFile /usr/local/apache2/conf/ssl.crl/ca-bundle-client.crl
981 </example>
982 </usage>
983 </directivesynopsis>
984
985 <directivesynopsis>
986 <name>SSLVerifyClient</name>
987 <description>Type of Client Certificate verification</description>
988 <syntax>SSLVerifyClient <em>level</em></syntax>
989 <default>SSLVerifyClient none</default>
990 <contextlist><context>server config</context>
991 <context>virtual host</context>
992 <context>directory</context>
993 <context>.htaccess</context></contextlist>
994 <override>AuthConfig</override>
995
996 <usage>
997 <p>
998 This directive sets the Certificate verification level for the Client
999 Authentication. Notice that this directive can be used both in per-server and
1000 per-directory context. In per-server context it applies to the client
1001 authentication process used in the standard SSL handshake when a connection is
1002 established. In per-directory context it forces a SSL renegotation with the
1003 reconfigured client verification level after the HTTP request was read but
1004 before the HTTP response is sent.</p>
1005 <p>
1006 The following levels are available for <em>level</em>:</p>
1007 <ul>
1008 <li><strong>none</strong>:
1009      no client Certificate is required at all</li>
1010 <li><strong>optional</strong>:
1011      the client <em>may</em> present a valid Certificate</li>
1012 <li><strong>require</strong>:
1013      the client <em>has to</em> present a valid Certificate</li>
1014 <li><strong>optional_no_ca</strong>:
1015      the client may present a valid Certificate<br />
1016      but it need not to be (successfully) verifiable.</li>
1017 </ul>
1018 <p>In practice only levels <strong>none</strong> and
1019 <strong>require</strong> are really interesting, because level
1020 <strong>optional</strong> doesn't work with all browsers and level
1021 <strong>optional_no_ca</strong> is actually against the idea of
1022 authentication (but can be used to establish SSL test pages, etc.)</p>
1023 <example><title>Example</title>
1024 SSLVerifyClient require
1025 </example>
1026 </usage>
1027 </directivesynopsis>
1028
1029 <directivesynopsis>
1030 <name>SSLVerifyDepth</name>
1031 <description>Maximum depth of CA Certificates in Client 
1032 Certificate verification</description>
1033 <syntax>SSLVerifyDepth <em>number</em></syntax>
1034 <default>SSLVerifyDepth 1</default>
1035 <contextlist><context>server config</context>
1036 <context>virtual host</context>
1037 <context>directory</context>
1038 <context>.htaccess</context></contextlist>
1039 <override>AuthConfig</override>
1040
1041 <usage>
1042 <p>
1043 This directive sets how deeply mod_ssl should verify before deciding that the
1044 clients don't have a valid certificate. Notice that this directive can be
1045 used both in per-server and per-directory context. In per-server context it
1046 applies to the client authentication process used in the standard SSL
1047 handshake when a connection is established. In per-directory context it forces
1048 a SSL renegotation with the reconfigured client verification depth after the
1049 HTTP request was read but before the HTTP response is sent.</p>
1050 <p>
1051 The depth actually is the maximum number of intermediate certificate issuers,
1052 i.e. the number of CA certificates which are max allowed to be followed while
1053 verifying the client certificate. A depth of 0 means that self-signed client
1054 certificates are accepted only, the default depth of 1 means the client
1055 certificate can be self-signed or has to be signed by a CA which is directly
1056 known to the server (i.e. the CA's certificate is under
1057 <directive module="mod_ssl">SSLCACertificatePath</directive>), etc.</p>
1058 <example><title>Example</title>
1059 SSLVerifyDepth 10
1060 </example>
1061 </usage>
1062 </directivesynopsis>
1063
1064 <directivesynopsis>
1065 <name>SSLOptions</name>
1066 <description>Configure various SSL engine run-time options</description>
1067 <syntax>SSLOptions [+|-]<em>option</em> ...</syntax>
1068 <contextlist><context>server config</context>
1069 <context>virtual host</context>
1070 <context>directory</context>
1071 <context>.htaccess</context></contextlist>
1072 <override>Options</override>
1073
1074 <usage>
1075 <p>
1076 This directive can be used to control various run-time options on a
1077 per-directory basis. Normally, if multiple <code>SSLOptions</code>
1078 could apply to a directory, then the most specific one is taken
1079 completely; the options are not merged. However if <em>all</em> the
1080 options on the <code>SSLOptions</code> directive are preceded by a
1081 plus (<code>+</code>) or minus (<code>-</code>) symbol, the options
1082 are merged. Any options preceded by a <code>+</code> are added to the
1083 options currently in force, and any options preceded by a
1084 <code>-</code> are removed from the options currently in force.</p>
1085 <p>
1086 The available <em>option</em>s are:</p>
1087 <ul>
1088 <li><code>StdEnvVars</code>
1089     <p>
1090     When this option is enabled, the standard set of SSL related CGI/SSI
1091     environment variables are created. This per default is disabled for
1092     performance reasons, because the information extraction step is a
1093     rather expensive operation. So one usually enables this option for
1094     CGI and SSI requests only.</p>
1095 </li>
1096 <li><code>ExportCertData</code>
1097     <p>
1098     When this option is enabled, additional CGI/SSI environment variables are
1099     created: <code>SSL_SERVER_CERT</code>, <code>SSL_CLIENT_CERT</code> and
1100     <code>SSL_CLIENT_CERT_CHAIN_</code><em>n</em> (with <em>n</em> = 0,1,2,..).
1101     These contain the PEM-encoded X.509 Certificates of server and client for
1102     the current HTTPS connection and can be used by CGI scripts for deeper
1103     Certificate checking. Additionally all other certificates of the client
1104     certificate chain are provided, too. This bloats up the environment a
1105     little bit which is why you have to use this option to enable it on
1106     demand.</p>
1107 </li>
1108 <li><code>FakeBasicAuth</code>
1109     <p>
1110     When this option is enabled, the Subject Distinguished Name (DN) of the
1111     Client X509 Certificate is translated into a HTTP Basic Authorization
1112     username. This means that the standard Apache authentication methods can
1113     be used for access control. The user name is just the Subject of the
1114     Client's X509 Certificate (can be determined by running OpenSSL's
1115     <code>openssl x509</code> command: <code>openssl x509 -noout -subject -in
1116     </code><em>certificate</em><code>.crt</code>). Note that no password is
1117     obtained from the user. Every entry in the user file needs this password:
1118     ``<code>xxj31ZMTZzkVA</code>'', which is the DES-encrypted version of the
1119     word `<code>password</code>''. Those who live under MD5-based encryption
1120     (for instance under FreeBSD or BSD/OS, etc.) should use the following MD5
1121     hash of the same word: ``<code>$1$OXLyS...$Owx8s2/m9/gfkcRVXzgoE/</code>''.</p>
1122 </li>
1123 <li><code>StrictRequire</code>
1124     <p>
1125     This <em>forces</em> forbidden access when <code>SSLRequireSSL</code> or
1126     <code>SSLRequire</code> successfully decided that access should be
1127     forbidden. Usually the default is that in the case where a ``<code>Satisfy
1128     any</code>'' directive is used, and other access restrictions are passed,
1129     denial of access due to <code>SSLRequireSSL</code> or
1130     <code>SSLRequire</code> is overridden (because that's how the Apache
1131     <code>Satisfy</code> mechanism should work.) But for strict access restriction
1132     you can use <code>SSLRequireSSL</code> and/or <code>SSLRequire</code> in
1133     combination with an ``<code>SSLOptions +StrictRequire</code>''. Then an
1134     additional ``<code>Satisfy Any</code>'' has no chance once mod_ssl has
1135     decided to deny access.</p>
1136 </li>
1137 <li><code>OptRenegotiate</code>
1138     <p>
1139     This enables optimized SSL connection renegotiation handling when SSL
1140     directives are used in per-directory context. By default a strict
1141     scheme is enabled where <em>every</em> per-directory reconfiguration of
1142     SSL parameters causes a <em>full</em> SSL renegotiation handshake. When this
1143     option is used mod_ssl tries to avoid unnecessary handshakes by doing more
1144     granular (but still safe) parameter checks. Nevertheless these granular
1145     checks sometimes maybe not what the user expects, so enable this on a
1146     per-directory basis only, please.</p>
1147 </li>
1148 </ul>
1149 <example><title>Example</title>
1150 SSLOptions +FakeBasicAuth -StrictRequire<br />
1151 &lt;Files ~ "\.(cgi|shtml)$"&gt;<br />
1152     SSLOptions +StdEnvVars -ExportCertData<br />
1153 &lt;Files&gt;
1154 </example>
1155 </usage>
1156 </directivesynopsis>
1157
1158 <directivesynopsis>
1159 <name>SSLRequireSSL</name>
1160 <description>Deny access when SSL is not used for the 
1161 HTTP request</description>
1162 <syntax>SSLRequireSSL</syntax>
1163 <contextlist><context>directory</context>
1164 <context>.htaccess</context></contextlist>
1165 <override>AuthConfig</override>
1166
1167 <usage>
1168 <p><!-- XXX: I think the syntax is wrong -->
1169 This directive forbids access unless HTTP over SSL (i.e. HTTPS) is enabled for
1170 the current connection. This is very handy inside the SSL-enabled virtual
1171 host or directories for defending against configuration errors that expose
1172 stuff that should be protected. When this directive is present all requests
1173 are denied which are not using SSL.</p>
1174 <example><title>Example</title>
1175 SSLRequireSSL
1176 </example>
1177 </usage>
1178 </directivesynopsis>
1179
1180 <directivesynopsis>
1181 <name>SSLRequire</name>
1182 <description>Allow access only when an arbitrarily complex 
1183 boolean expression is true</description>
1184 <syntax>SSLRequire <em>expression</em></syntax>
1185 <contextlist><context>directory</context>
1186 <context>.htaccess</context></contextlist>
1187 <override>AuthConfig</override>
1188
1189 <usage>
1190 <p>
1191 This directive specifies a general access requirement which has to be
1192 fulfilled in order to allow access. It is a very powerful directive because the
1193 requirement specification is an arbitrarily complex boolean expression
1194 containing any number of access checks.</p>
1195 <note type="warning">
1196 <p>The implementation of <code>SSLRequire</code> is not thread safe.  
1197    Using <code>SSLRequire</code> inside <code>.htaccess</code> files
1198    on a threaded <a href="../mpm.html">MPM</a> may cause random crashes.
1199 </p>
1200 </note>
1201 <p>
1202 The <em>expression</em> must match the following syntax (given as a BNF
1203 grammar notation):</p>
1204 <blockquote>
1205 <pre>
1206 expr     ::= "<strong>true</strong>" | "<strong>false</strong>"
1207            | "<strong>!</strong>" expr
1208            | expr "<strong>&amp;&amp;</strong>" expr
1209            | expr "<strong>||</strong>" expr
1210            | "<strong>(</strong>" expr "<strong>)</strong>"
1211            | comp
1212
1213 comp     ::= word "<strong>==</strong>" word | word "<strong>eq</strong>" word
1214            | word "<strong>!=</strong>" word | word "<strong>ne</strong>" word
1215            | word "<strong>&lt;</strong>"  word | word "<strong>lt</strong>" word
1216            | word "<strong>&lt;=</strong>" word | word "<strong>le</strong>" word
1217            | word "<strong>&gt;</strong>"  word | word "<strong>gt</strong>" word
1218            | word "<strong>&gt;=</strong>" word | word "<strong>ge</strong>" word
1219            | word "<strong>in</strong>" "<strong>{</strong>" wordlist "<strong>}</strong>"
1220            | word "<strong>in</strong>" "<strong>PeerExtList(</strong>" word "<strong>)</strong>"
1221            | word "<strong>=~</strong>" regex
1222            | word "<strong>!~</strong>" regex
1223
1224 wordlist ::= word
1225            | wordlist "<strong>,</strong>" word
1226
1227 word     ::= digit
1228            | cstring
1229            | variable
1230            | function
1231
1232 digit    ::= [0-9]+
1233 cstring  ::= "..."
1234 variable ::= "<strong>%{</strong>" varname "<strong>}</strong>"
1235 function ::= funcname "<strong>(</strong>" funcargs "<strong>)</strong>"
1236 </pre>
1237 </blockquote>
1238 <p>For <code>varname</code> any of the variables described in <a
1239 href="#envvars">Environment Variables</a> can be used.  For
1240 <code>funcname</code> the following functions are available:</p>
1241 <ul>
1242 <li><code>file(</code><em>filename</em><code>)</code>
1243     <p>
1244     This function takes one string argument and expands to the contents of the
1245     file. This is especially useful for matching this contents against a
1246     regular expression, etc.</p>
1247 </li>
1248 </ul>
1249 <p>Notice that <em>expression</em> is first parsed into an internal machine
1250 representation and then evaluated in a second step. Actually, in Global and
1251 Per-Server Class context <em>expression</em> is parsed at startup time and
1252 at runtime only the machine representation is executed. For Per-Directory
1253 context this is different: here <em>expression</em> has to be parsed and
1254 immediately executed for every request.</p>
1255 <example><title>Example</title>
1256 <pre>SSLRequire (    %{SSL_CIPHER} !~ m/^(EXP|NULL)-/                \
1257             and %{SSL_CLIENT_S_DN_O} eq "Snake Oil, Ltd."        \
1258             and %{SSL_CLIENT_S_DN_OU} in {"Staff", "CA", "Dev"}  \
1259             and %{TIME_WDAY} &gt;= 1 and %{TIME_WDAY} &lt;= 5          \
1260             and %{TIME_HOUR} &gt;= 8 and %{TIME_HOUR} &lt;= 20       ) \
1261            or %{REMOTE_ADDR} =~ m/^192\.76\.162\.[0-9]+$/</pre>
1262 </example>
1263
1264 <p>The <code>PeerExtList(<em>object-ID</em>)</code> function expects
1265 to find zero or more instances of the X.509 certificate extension
1266 identified by the given <em>object ID</em> (OID) in the client certificate.
1267 The expression evaluates to true if the left-hand side string matches
1268 exactly against the value of an extension identified with this OID.
1269 (If multiple extensions with the same OID are present, at least one
1270 extension must match).</p>
1271
1272 <example><title>Example</title>
1273 SSLRequire "foobar" in PeerExtList("1.2.3.4.5.6")
1274 </example>
1275
1276 <note><title>Notes on the PeerExtList function</title>
1277
1278 <ul>
1279
1280 <li><p>The object ID can be specified either as a descriptive
1281 name recognized by the SSL library, such as <code>"nsComment"</code>,
1282 or as a numeric OID, such as <code>"1.2.3.4.5.6"</code>.</p></li>
1283
1284 <li><p>Expressions with types known to the SSL library are rendered to
1285 a string before comparison.  For an extension with a type not
1286 recognized by the SSL library, mod_ssl will parse the value if it is
1287 one of the primitive ASN.1 types UTF8String, IA5String, VisibleString,
1288 or BMPString.  For an extension of one of these types, the string
1289 value will be converted to UTF-8 if necessary, then compared against
1290 the left-hand-side expression.</p></li>
1291
1292 </ul>
1293 </note>
1294
1295 </usage>
1296 </directivesynopsis>
1297
1298 <directivesynopsis>
1299 <name>SSLRenegBufferSize</name>
1300 <description>Set the size for the SSL renegotiation buffer</description>
1301 <syntax>SSLRenegBufferSize <var>bytes</var></syntax>
1302 <default>SSLRenegBufferSize 131072</default>
1303 <contextlist><context>directory</context>
1304 <context>.htaccess</context></contextlist>
1305 <override>AuthConfig</override>
1306
1307 <usage>
1308
1309 <p>If an SSL renegotiation is required in per-location context, for
1310 example, any use of <directive
1311 module="mod_ssl">SSLVerifyClient</directive> in a Directory or
1312 Location block, then <module>mod_ssl</module> must buffer any HTTP
1313 request body into memory until the new SSL handshake can be performed.
1314 This directive can be used to set the amount of memory that will be
1315 used for this buffer. </p>
1316
1317 <note type="warning"><p>
1318 Note that in many configurations, the client sending the request body
1319 will be untrusted so a denial of service attack by consumption of
1320 memory must be considered when changing this configuration setting.
1321 </p></note>
1322
1323 <example><title>Example</title>
1324 SSLRenegBufferSize 262144
1325 </example>
1326 </usage>
1327 </directivesynopsis>
1328
1329 <directivesynopsis>
1330 <name>SSLStrictSNIVHostCheck</name>
1331 <description>Whether to allow non-SNI clients to access a name-based virtual
1332 host.
1333 </description>
1334 <syntax>SSLStrictSNIVHostCheck on|off</syntax>
1335 <default>SSLStrictSNIVHostCheck off</default>
1336 <contextlist><context>server config</context>
1337 <context>virtual host</context></contextlist>
1338 <compatibility>Available in Apache 2.2.12 and later</compatibility>
1339
1340 <usage>
1341 <p>
1342 This directive sets whether a non-SNI client is allowed to access a name-based
1343 virtual host. If set to <code>on</code> in the default name-based virtual
1344 host, clients that are SNI unaware will not be allowed to access <em>any</em>
1345 virtual host, belonging to this particular IP / port combination.
1346 If set to <code>on</code> in any other virtual host, SNI unaware clients
1347 are not allowed to access this particular virtual host.
1348 </p>
1349
1350 <note type="warning"><p>
1351 This option is only available if httpd was compiled against an SNI capable
1352 version of OpenSSL.
1353 </p></note>
1354
1355 <example><title>Example</title>
1356 SSLStrictSNIVHostCheck on
1357 </example>
1358 </usage>
1359 </directivesynopsis>
1360
1361 <directivesynopsis>
1362 <name>SSLProxyMachineCertificatePath</name>
1363 <description>Directory of PEM-encoded client certificates and keys to be used by the proxy</description>
1364 <syntax>SSLProxyMachineCertificatePath <em>directory</em></syntax>
1365 <contextlist><context>server config</context></contextlist>
1366 <override>Not applicable</override>
1367
1368 <usage>
1369 <p>
1370 This directive sets the directory where you keep the certificates and
1371 keys used for authentication of the proxy server to remote servers.
1372 </p>
1373 <p>The files in this directory must be PEM-encoded and are accessed through
1374 hash filenames. Additionally, you must create symbolic links named
1375 <code><em>hash-value</em>.N</code>. And you should always make sure this
1376 directory contains the appropriate symbolic links. Use the Makefile which
1377 comes with mod_ssl to accomplish this task.
1378 </p>
1379 <note type="warning">
1380 <p>Currently there is no support for encrypted private keys</p>
1381 </note>
1382 <example><title>Example</title>
1383 SSLProxyMachineCertificatePath /usr/local/apache2/conf/proxy.crt/
1384 </example> 
1385 </usage> 
1386 </directivesynopsis>
1387
1388
1389 <directivesynopsis>
1390 <name>SSLProxyMachineCertificateFile</name>
1391 <description>File of concatenated PEM-encoded client certificates and keys to be used by the proxy</description>
1392 <syntax>SSLProxyMachineCertificateFile <em>filename</em></syntax>
1393 <contextlist><context>server config</context></contextlist>
1394 <override>Not applicable</override>
1395
1396 <usage>
1397 <p>
1398 This directive sets the all-in-one file where you keep the certificates and
1399 keys used for authentication of the proxy server to remote servers.
1400 </p>
1401 <p>
1402 This referenced file is simply the concatenation of the various PEM-encoded
1403 certificate files, in order of preference. Use this directive alternatively
1404 or additionally to <code>SSLProxyMachineCertificatePath</code>.
1405 </p>
1406 <note type="warning">
1407 <p>Currently there is no support for encrypted private keys</p>
1408 </note>
1409 <example><title>Example</title>
1410 SSLProxyMachineCertificateFile /usr/local/apache2/conf/ssl.crt/proxy.pem
1411 </example>
1412 </usage>
1413 </directivesynopsis>
1414
1415 <directivesynopsis>
1416 <name>SSLProxyVerify</name>
1417 <description>Type of remote server Certificate verification</description>
1418 <syntax>SSLProxyVerify <em>level</em></syntax>
1419 <default>SSLProxyVerify none</default>
1420 <contextlist><context>server config</context>
1421 <context>virtual host</context>
1422 <context>directory</context>
1423 <context>.htaccess</context></contextlist>
1424 <override>AuthConfig</override>
1425
1426 <usage>
1427
1428 <p>When a proxy is configured to forward requests to a remote SSL
1429 server, this directive can be used to configure certificate
1430 verification of the remote server.  Notice that this directive can be
1431 used both in per-server and per-directory context. In per-server
1432 context it applies to the remote server authentication process used in
1433 the standard SSL handshake when a connection is established by the
1434 proxy. In per-directory context it forces a SSL renegotation with the
1435 reconfigured remote server verification level after the HTTP request
1436 was read but before the HTTP response is sent.</p>
1437
1438 <p>
1439 The following levels are available for <em>level</em>:</p>
1440 <ul>
1441 <li><strong>none</strong>:
1442      no remote server Certificate is required at all</li>
1443 <li><strong>optional</strong>:
1444      the remote server <em>may</em> present a valid Certificate</li>
1445 <li><strong>require</strong>:
1446      the remote server <em>has to</em> present a valid Certificate</li>
1447 <li><strong>optional_no_ca</strong>:
1448      the remote server may present a valid Certificate<br />
1449      but it need not to be (successfully) verifiable.</li>
1450 </ul>
1451 <p>In practice only levels <strong>none</strong> and
1452 <strong>require</strong> are really interesting, because level
1453 <strong>optional</strong> doesn't work with all servers and level
1454 <strong>optional_no_ca</strong> is actually against the idea of
1455 authentication (but can be used to establish SSL test pages, etc.)</p>
1456 <example><title>Example</title>
1457 SSLProxyVerify require
1458 </example>
1459 </usage>
1460 </directivesynopsis>
1461
1462 <directivesynopsis>
1463 <name>SSLProxyVerifyDepth</name>
1464 <description>Maximum depth of CA Certificates in Remote Server
1465 Certificate verification</description>
1466 <syntax>SSLProxyVerifyDepth <em>number</em></syntax>
1467 <default>SSLProxyVerifyDepth 1</default>
1468 <contextlist><context>server config</context>
1469 <context>virtual host</context>
1470 <context>directory</context>
1471 <context>.htaccess</context></contextlist>
1472 <override>AuthConfig</override>
1473
1474 <usage>
1475 <p>
1476 This directive sets how deeply mod_ssl should verify before deciding that the
1477 remote server does not have a valid certificate. Notice that this directive can be
1478 used both in per-server and per-directory context. In per-server context it
1479 applies to the client authentication process used in the standard SSL
1480 handshake when a connection is established. In per-directory context it forces
1481 a SSL renegotation with the reconfigured remote server verification depth after the
1482 HTTP request was read but before the HTTP response is sent.</p>
1483 <p>
1484 The depth actually is the maximum number of intermediate certificate issuers,
1485 i.e. the number of CA certificates which are max allowed to be followed while
1486 verifying the remote server certificate. A depth of 0 means that self-signed
1487 remote server certificates are accepted only, the default depth of 1 means
1488 the remote server certificate can be self-signed or has to be signed by a CA
1489 which is directly known to the server (i.e. the CA's certificate is under
1490 <directive module="mod_ssl">SSLProxyCACertificatePath</directive>), etc.</p>
1491 <example><title>Example</title>
1492 SSLProxyVerifyDepth 10
1493 </example>
1494 </usage>
1495 </directivesynopsis>
1496
1497 <directivesynopsis>
1498 <name>SSLProxyCheckPeerExpire</name>
1499 <description>Whether to check if remote server certificate is expired
1500 </description>
1501 <syntax>SSLProxyCheckPeerExpire on|off</syntax>
1502 <default>SSLProxyCheckPeerExpire on</default>
1503 <contextlist><context>server config</context>
1504 <context>virtual host</context></contextlist>
1505
1506 <usage>
1507 <p>
1508 This directive sets whether it is checked if the remote server certificate
1509 is expired or not. If the check fails a 502 status code (Bad Gateway) is
1510 sent.
1511 </p>
1512 <example><title>Example</title>
1513 SSLProxyCheckPeerExpire on
1514 </example>
1515 </usage>
1516 </directivesynopsis>
1517
1518 <directivesynopsis>
1519 <name>SSLProxyCheckPeerCN</name>
1520 <description>Whether to check the remote server certificates CN field
1521 </description>
1522 <syntax>SSLProxyCheckPeerCN on|off</syntax>
1523 <default>SSLProxyCheckPeerCN on</default>
1524 <contextlist><context>server config</context>
1525 <context>virtual host</context></contextlist>
1526
1527 <usage>
1528 <p>
1529 This directive sets whether the remote server certificates CN field is
1530 compared against the hostname of the request URL. If both are not equal
1531 a 502 status code (Bad Gateway) is sent.
1532 </p>
1533 <example><title>Example</title>
1534 SSLProxyCheckPeerCN on
1535 </example>
1536 </usage>
1537 </directivesynopsis>
1538
1539 <directivesynopsis>
1540 <name>SSLProxyEngine</name>
1541 <description>SSL Proxy Engine Operation Switch</description>
1542 <syntax>SSLProxyEngine on|off</syntax>
1543 <default>SSLProxyEngine off</default>
1544 <contextlist><context>server config</context>
1545 <context>virtual host</context></contextlist>
1546
1547 <usage>
1548 <p>
1549 This directive toggles the usage of the SSL/TLS Protocol Engine for proxy. This
1550 is usually used inside a <directive module="core"
1551 type="section">VirtualHost</directive> section to enable SSL/TLS for proxy
1552 usage in a particular virtual host. By default the SSL/TLS Protocol Engine is
1553 disabled for proxy image both for the main server and all configured virtual hosts.</p>
1554 <example><title>Example</title>
1555 &lt;VirtualHost _default_:443&gt;<br />
1556 SSLProxyEngine on<br />
1557 ...<br />
1558 &lt;/VirtualHost&gt;
1559 </example>
1560 </usage>
1561 </directivesynopsis>
1562
1563 <directivesynopsis>
1564 <name>SSLProxyProtocol</name>
1565 <description>Configure usable SSL protocol flavors for proxy usage</description>
1566 <syntax>SSLProxyProtocol [+|-]<em>protocol</em> ...</syntax>
1567 <default>SSLProxyProtocol all</default>
1568 <contextlist><context>server config</context>
1569 <context>virtual host</context></contextlist>
1570 <override>Options</override>
1571
1572 <usage>
1573 <!-- XXX Why does this have an override and not .htaccess context? -->
1574 <p>
1575 This directive can be used to control the SSL protocol flavors mod_ssl should
1576 use when establishing its server environment for proxy . It will only connect
1577 to servers using one of the provided protocols.</p>
1578 <p>Please refer to <directive module="mod_ssl">SSLProtocol</directive>
1579 for additional information.
1580 </p>
1581 </usage>
1582 </directivesynopsis>
1583
1584 <directivesynopsis>
1585 <name>SSLProxyCipherSuite</name>
1586 <description>Cipher Suite available for negotiation in SSL 
1587 proxy handshake</description>
1588 <syntax>SSLProxyCipherSuite <em>cipher-spec</em></syntax>
1589 <default>SSLProxyCipherSuite ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP</default>
1590 <contextlist><context>server config</context>
1591 <context>virtual host</context>
1592 <context>directory</context>
1593 <context>.htaccess</context></contextlist>
1594 <override>AuthConfig</override>
1595 <usage>
1596 <p>Equivalent to <code>SSLCipherSuite</code>, but for the proxy connection.
1597 Please refer to <directive module="mod_ssl">SSLCipherSuite</directive>
1598 for additional information.</p>
1599 </usage>
1600
1601 </directivesynopsis>
1602 <directivesynopsis>
1603 <name>SSLProxyCACertificatePath</name>
1604 <description>Directory of PEM-encoded CA Certificates for 
1605 Remote Server Auth</description>
1606 <syntax>SSLProxyCACertificatePath <em>directory-path</em></syntax>
1607 <contextlist><context>server config</context>
1608 <context>virtual host</context></contextlist>
1609
1610 <usage>
1611 <p>
1612 This directive sets the directory where you keep the Certificates of
1613 Certification Authorities (CAs) whose remote servers you deal with. These are used to
1614 verify the remote server certificate on Remote Server Authentication.</p>
1615 <p>
1616 The files in this directory have to be PEM-encoded and are accessed through
1617 hash filenames. So usually you can't just place the Certificate files
1618 there: you also have to create symbolic links named
1619 <em>hash-value</em><code>.N</code>. And you should always make sure this directory
1620 contains the appropriate symbolic links. Use the <code>Makefile</code> which
1621 comes with mod_ssl to accomplish this task.</p>
1622 <example><title>Example</title>
1623 SSLProxyCACertificatePath /usr/local/apache2/conf/ssl.crt/
1624 </example>
1625 </usage>
1626 </directivesynopsis>
1627
1628 <directivesynopsis>
1629 <name>SSLProxyCACertificateFile</name>
1630 <description>File of concatenated PEM-encoded CA Certificates 
1631 for Remote Server Auth</description>
1632 <syntax>SSLProxyCACertificateFile <em>file-path</em></syntax>
1633 <contextlist><context>server config</context>
1634 <context>virtual host</context></contextlist>
1635
1636 <usage>
1637 <p>
1638 This directive sets the <em>all-in-one</em> file where you can assemble the
1639 Certificates of Certification Authorities (CA) whose <em>remote servers</em> you deal
1640 with. These are used for Remote Server Authentication. Such a file is simply the
1641 concatenation of the various PEM-encoded Certificate files, in order of
1642 preference. This can be used alternatively and/or additionally to 
1643 <directive module="mod_ssl">SSLProxyCACertificatePath</directive>.</p>
1644 <example><title>Example</title>
1645 SSLProxyCACertificateFile /usr/local/apache2/conf/ssl.crt/ca-bundle-remote-server.crt
1646 </example>
1647 </usage>
1648 </directivesynopsis>
1649
1650 <directivesynopsis>
1651 <name>SSLProxyCARevocationPath</name>
1652 <description>Directory of PEM-encoded CA CRLs for 
1653 Remote Server Auth</description>
1654 <syntax>SSLProxyCARevocationPath <em>directory-path</em></syntax>
1655 <contextlist><context>server config</context>
1656 <context>virtual host</context></contextlist>
1657
1658 <usage>
1659 <p>
1660 This directive sets the directory where you keep the Certificate Revocation
1661 Lists (CRL) of Certification Authorities (CAs) whose remote servers you deal with.
1662 These are used to revoke the remote server certificate on Remote Server Authentication.</p>
1663 <p>
1664 The files in this directory have to be PEM-encoded and are accessed through
1665 hash filenames. So usually you have not only to place the CRL files there.
1666 Additionally you have to create symbolic links named
1667 <em>hash-value</em><code>.rN</code>. And you should always make sure this directory
1668 contains the appropriate symbolic links. Use the <code>Makefile</code> which
1669 comes with <module>mod_ssl</module> to accomplish this task.</p>
1670 <example><title>Example</title>
1671 SSLProxyCARevocationPath /usr/local/apache2/conf/ssl.crl/
1672 </example>
1673 </usage>
1674 </directivesynopsis>
1675
1676 <directivesynopsis>
1677 <name>SSLProxyCARevocationFile</name>
1678 <description>File of concatenated PEM-encoded CA CRLs for 
1679 Remote Server Auth</description>
1680 <syntax>SSLProxyCARevocationFile <em>file-path</em></syntax>
1681 <contextlist><context>server config</context>
1682 <context>virtual host</context></contextlist>
1683
1684 <usage>
1685 <p>
1686 This directive sets the <em>all-in-one</em> file where you can
1687 assemble the Certificate Revocation Lists (CRL) of Certification
1688 Authorities (CA) whose <em>remote servers</em> you deal with. These are used
1689 for Remote Server Authentication.  Such a file is simply the concatenation of
1690 the various PEM-encoded CRL files, in order of preference. This can be
1691 used alternatively and/or additionally to <directive
1692 module="mod_ssl">SSLProxyCARevocationPath</directive>.</p>
1693 <example><title>Example</title>
1694 SSLProxyCARevocationFile /usr/local/apache2/conf/ssl.crl/ca-bundle-remote-server.crl
1695 </example>
1696 </usage>
1697 </directivesynopsis>
1698
1699 <directivesynopsis>
1700 <name>SSLUserName</name>
1701 <description>Variable name to determine user name</description>
1702 <syntax>SSLUserName <em>varname</em></syntax>
1703 <contextlist><context>server config</context>
1704 <context>directory</context>
1705 <context>.htaccess</context></contextlist>
1706 <override>AuthConfig</override>
1707 <compatibility>Available in Apache 2.0.51 and later</compatibility>
1708
1709 <usage>
1710 <p>
1711 This directive sets the "user" field in the Apache request object.
1712 This is used by lower modules to identify the user with a character
1713 string. In particular, this may cause the environment variable
1714 <code>REMOTE_USER</code> to be set.  The <em>varname</em> can be
1715 any of the <a href="#envvars">SSL environment variables</a>.</p>
1716
1717 <p>Note that this directive has no effect if the
1718 <code>FakeBasicAuth</code> option is used (see <a
1719 href="#ssloptions">SSLOptions</a>).</p>
1720
1721 <example><title>Example</title>
1722 SSLUserName SSL_CLIENT_S_DN_CN
1723 </example>
1724 </usage>
1725 </directivesynopsis>
1726
1727 <directivesynopsis>
1728 <name>SSLHonorCipherOrder</name>
1729 <description>Option to prefer the server's cipher preference order</description>
1730 <syntax>SSLHonorCipherOrder <em>flag</em></syntax>
1731 <contextlist><context>server config</context>
1732 <context>virtual host</context></contextlist>
1733 <compatibility>Available in Apache 2.1 and later, if using OpenSSL 0.9.7 or later</compatibility>
1734
1735 <usage>
1736 <p>When choosing a cipher during an SSLv3 or TLSv1 handshake, normally
1737 the client's preference is used.  If this directive is enabled, the
1738 server's preference will be used instead.</p>
1739 <example><title>Example</title>
1740 SSLHonorCipherOrder on
1741 </example>
1742 </usage>
1743 </directivesynopsis>
1744
1745 <directivesynopsis>
1746 <name>SSLCryptoDevice</name>
1747 <description>Enable use of a cryptographic hardware accelerator</description>
1748 <syntax>SSLCryptoDevice <em>engine</em></syntax>
1749 <default>SSLCryptoDevice builtin</default>
1750 <contextlist><context>server config</context></contextlist>
1751
1752 <usage>
1753 <p>
1754 This directive enables use of a cryptographic hardware accelerator
1755 board to offload some of the SSL processing overhead.  This directive
1756 can only be used if the SSL toolkit is built with "engine" support;
1757 OpenSSL 0.9.7 and later releases have "engine" support by default, the
1758 separate "-engine" releases of OpenSSL 0.9.6 must be used.</p>
1759
1760 <p>To discover which engine names are supported, run the command
1761 &quot;<code>openssl engine</code>&quot;.</p>
1762
1763 <example><title>Example</title>
1764 # For a Broadcom accelerator:<br />
1765 SSLCryptoDevice ubsec
1766 </example>
1767 </usage>
1768 </directivesynopsis>
1769
1770 <directivesynopsis>
1771 <name>SSLOCSPEnable</name>
1772 <description>Enable OCSP validation of the client certificate chain</description>
1773 <syntax>SSLOCSPEnable <em>flag</em></syntax>
1774 <contextlist><context>server config</context>
1775 <context>virtual host</context></contextlist>
1776 <compatibility>Available in httpd 2.3 and later, if using OpenSSL 0.9.7 or later</compatibility>
1777
1778 <usage>
1779 <p>This option enables OCSP validation of the client certificate
1780 chain.  If this option is enabled, certificates in the client's
1781 certificate chain will be validated against an OCSP responder after
1782 normal verification (including CRL checks) have taken place.</p>
1783
1784 <p>The OCSP responder used is either extracted from the certificate
1785 itself, or derived by configuration; see the
1786 <directive module="mod_ssl">SSLOCSPDefaultResponder</directive> and
1787 <directive module="mod_ssl">SSLOCSPOverrideResponder</directive>
1788 directives.</p>
1789
1790 <example><title>Example</title>
1791 SSLVerifyClient on<br/>
1792 SSLOCSPEnable on<br/>
1793 SSLOCSPDefaultResponder http://responder.example.com:8888/responder<br/>
1794 SSLOCSPOverrideResponder on
1795 </example>
1796 </usage>
1797 </directivesynopsis>
1798
1799 <directivesynopsis>
1800 <name>SSLOCSPDefaultResponder</name>
1801 <description>Set the default responder URI for OCSP validation</description>
1802 <syntax>SSLOCSDefaultResponder <em>uri</em></syntax>
1803 <contextlist><context>server config</context>
1804 <context>virtual host</context></contextlist>
1805 <compatibility>Available in httpd 2.3 and later, if using OpenSSL 0.9.7 or later</compatibility>
1806
1807 <usage>
1808 <p>This option sets the default OCSP responder to use.  If <directive
1809 module="mod_ssl">SSLOCSPOverrideResponder</directive> is not enabled,
1810 the URI given will be used only if no responder URI is specified in
1811 the certificate being verified.</p>
1812 </usage>
1813 </directivesynopsis>
1814
1815 <directivesynopsis>
1816 <name>SSLOCSPOverrideResponder</name>
1817 <description>Force use of the default responder URI for OCSP validation</description>
1818 <syntax>SSLOCSPOverrideResponder <em>flag</em></syntax>
1819 <contextlist><context>server config</context>
1820 <context>virtual host</context></contextlist>
1821 <compatibility>Available in httpd 2.3 and later, if using OpenSSL 0.9.7 or later</compatibility>
1822
1823 <usage>
1824 <p>This option forces the configured default OCSP responder to be used
1825 during OCSP certificate validation, regardless of whether the
1826 certificate being validated references an OCSP responder.</p>
1827 </usage>
1828 </directivesynopsis>
1829
1830 <directivesynopsis>
1831 <name>SSLInsecureRenegotiation</name>
1832 <description>Option to enable support for insecure renegotiation</description>
1833 <syntax>SSLInsecureRenegotiation <em>flag</em></syntax>
1834 <default>SSLInsecureRenegotiation off</default>
1835 <contextlist><context>server config</context>
1836 <context>virtual host</context></contextlist>
1837 <compatibility>Available in httpd 2.2.15 and later, if using OpenSSL 0.9.8m or later</compatibility>
1838
1839 <usage>
1840 <p>As originally specified, all versions of the SSL and TLS protocols
1841 (up to and including TLS/1.2) were vulnerable to a Man-in-the-Middle
1842 attack
1843 (<a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2009-3555">CVE-2009-3555</a>)
1844 during a renegotiation.  This vulnerability allowed an attacker to
1845 "prefix" a chosen plaintext to the HTTP request as seen by the web
1846 server.  A protocol extension was developed which fixed this
1847 vulnerability if supported by both client and server.</p>
1848
1849 <p>If <module>mod_ssl</module> is linked against OpenSSL version 0.9.8m
1850 or later, by default renegotiation is only supported with
1851 clients supporting the new protocol extension.  If this directive is
1852 enabled, renegotiation will be allowed with old (unpatched) clients,
1853 albeit insecurely.</p>
1854
1855 <note type="warning"><title>Security warning</title>
1856 <p>If this directive is enabled, SSL connections will be vulnerable to
1857 the Man-in-the-Middle prefix attack as described
1858 in <a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2009-3555">CVE-2009-3555</a>.</p>
1859 </note>
1860
1861 <example><title>Example</title>
1862 SSLInsecureRenegotiation on
1863 </example>
1864
1865 <p>The <code>SSL_SECURE_RENEG</code> environment variable can be used
1866 from an SSI or CGI script to determine whether secure renegotiation is
1867 supported for a given SSL connection.</p>
1868
1869 </usage>
1870 </directivesynopsis>
1871
1872 </modulesynopsis>