diff options
Diffstat (limited to '')
-rw-r--r-- | src/lib/libcrypto/man/openssl.cnf.5 | 496 |
1 files changed, 496 insertions, 0 deletions
diff --git a/src/lib/libcrypto/man/openssl.cnf.5 b/src/lib/libcrypto/man/openssl.cnf.5 new file mode 100644 index 0000000000..2826b779ba --- /dev/null +++ b/src/lib/libcrypto/man/openssl.cnf.5 | |||
@@ -0,0 +1,496 @@ | |||
1 | .\" $OpenBSD: openssl.cnf.5,v 1.1 2016/12/11 18:06:09 schwarze Exp $ | ||
2 | .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | ||
3 | .\" | ||
4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | ||
5 | .\" Copyright (c) 1999, 2000, 2004, 2013, 2015, 2016 The OpenSSL Project. | ||
6 | .\" All rights reserved. | ||
7 | .\" | ||
8 | .\" Redistribution and use in source and binary forms, with or without | ||
9 | .\" modification, are permitted provided that the following conditions | ||
10 | .\" are met: | ||
11 | .\" | ||
12 | .\" 1. Redistributions of source code must retain the above copyright | ||
13 | .\" notice, this list of conditions and the following disclaimer. | ||
14 | .\" | ||
15 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
16 | .\" notice, this list of conditions and the following disclaimer in | ||
17 | .\" the documentation and/or other materials provided with the | ||
18 | .\" distribution. | ||
19 | .\" | ||
20 | .\" 3. All advertising materials mentioning features or use of this | ||
21 | .\" software must display the following acknowledgment: | ||
22 | .\" "This product includes software developed by the OpenSSL Project | ||
23 | .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
24 | .\" | ||
25 | .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
26 | .\" endorse or promote products derived from this software without | ||
27 | .\" prior written permission. For written permission, please contact | ||
28 | .\" openssl-core@openssl.org. | ||
29 | .\" | ||
30 | .\" 5. Products derived from this software may not be called "OpenSSL" | ||
31 | .\" nor may "OpenSSL" appear in their names without prior written | ||
32 | .\" permission of the OpenSSL Project. | ||
33 | .\" | ||
34 | .\" 6. Redistributions of any form whatsoever must retain the following | ||
35 | .\" acknowledgment: | ||
36 | .\" "This product includes software developed by the OpenSSL Project | ||
37 | .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
38 | .\" | ||
39 | .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
40 | .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
41 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
42 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
43 | .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
44 | .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
45 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
46 | .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
47 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
48 | .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | ||
51 | .\" | ||
52 | .Dd $Mdocdate: December 11 2016 $ | ||
53 | .Dt OPENSSL.CNF 5 | ||
54 | .Os | ||
55 | .Sh NAME | ||
56 | .Nm openssl.cnf | ||
57 | .Nd OpenSSL configuration files | ||
58 | .Sh DESCRIPTION | ||
59 | The OpenSSL CONF library can be used to read configuration files, see | ||
60 | .Xr CONF_modules_load_file 3 . | ||
61 | It is used for the OpenSSL master configuration file | ||
62 | .Pa /etc/ssl/openssl.cnf | ||
63 | and in a few other places like | ||
64 | .Sy SPKAC | ||
65 | files and certificate extension files for the | ||
66 | .Xr openssl 1 | ||
67 | .Cm x509 | ||
68 | utility. | ||
69 | OpenSSL applications can also use the CONF library for their own | ||
70 | purposes. | ||
71 | .Pp | ||
72 | A configuration file is divided into a number of sections. | ||
73 | Each section starts with a line | ||
74 | .Bq Ar section_name | ||
75 | and ends when a new section is started or the end of the file is reached. | ||
76 | A section name can consist of alphanumeric characters and underscores. | ||
77 | .Pp | ||
78 | The first section of a configuration file is special and is referred to | ||
79 | as the | ||
80 | .Dq default section . | ||
81 | It is usually unnamed and extends from the start of file to the | ||
82 | first named section. | ||
83 | When a name is being looked up, it is first looked up in a named | ||
84 | section (if any) and then in the default section. | ||
85 | .Pp | ||
86 | The environment is mapped onto a section called | ||
87 | .Ic ENV . | ||
88 | .Pp | ||
89 | Comments can be included by preceding them with the | ||
90 | .Ql # | ||
91 | character. | ||
92 | .Pp | ||
93 | Each section in a configuration file consists of a number of name and | ||
94 | value pairs of the form | ||
95 | .Ar name Ns = Ns Ar value . | ||
96 | .Pp | ||
97 | The | ||
98 | .Ar name | ||
99 | string can contain any alphanumeric characters as well as a few | ||
100 | punctuation symbols such as | ||
101 | .Ql \&. | ||
102 | .Ql \&, | ||
103 | .Ql \&; | ||
104 | and | ||
105 | .Ql _ . | ||
106 | .Pp | ||
107 | The | ||
108 | .Ar value | ||
109 | string consists of the string following the | ||
110 | .Ql = | ||
111 | character until the end of the line with any leading and trailing | ||
112 | whitespace removed. | ||
113 | .Pp | ||
114 | The value string undergoes variable expansion. | ||
115 | This can be done by including substrings of the form | ||
116 | .Pf $ Ar name | ||
117 | or | ||
118 | .Pf $ Brq Ar name : | ||
119 | this will substitute the value of the named variable in the current | ||
120 | section. | ||
121 | It is also possible to substitute a value from another section using the | ||
122 | syntax | ||
123 | .Pf $ Ar section Ns :: Ns Ar name | ||
124 | or | ||
125 | .Pf $ Brq Ar section Ns :: Ns Ar name . | ||
126 | By using the form | ||
127 | .Pf $ Ic ENV Ns :: Ns Ar name , | ||
128 | environment variables can be substituted. | ||
129 | It is also possible to assign values to environment variables by using | ||
130 | the name | ||
131 | .Ic ENV Ns :: Ns Ar name . | ||
132 | This will work if the program looks up environment variables using | ||
133 | the CONF library instead of calling | ||
134 | .Xr getenv 3 | ||
135 | directly. | ||
136 | .Pp | ||
137 | It is possible to escape certain characters by using any kind of quote | ||
138 | or the | ||
139 | .Ql \e | ||
140 | character. | ||
141 | By making the last character of a line a | ||
142 | .Ql \e , | ||
143 | a | ||
144 | .Ar value | ||
145 | string can be spread across multiple lines. | ||
146 | In addition the sequences | ||
147 | .Ql \en , | ||
148 | .Ql \er , | ||
149 | .Ql \eb , | ||
150 | and | ||
151 | .Ql \et | ||
152 | are recognized. | ||
153 | .Sh OPENSSL LIBRARY CONFIGURATION | ||
154 | Applications can automatically configure certain aspects of OpenSSL | ||
155 | using the master OpenSSL configuration file, or optionally an | ||
156 | alternative configuration file. | ||
157 | The | ||
158 | .Xr openssl 1 | ||
159 | utility includes this functionality: any sub command uses the master | ||
160 | OpenSSL configuration file unless an option is used in the sub command | ||
161 | to use an alternative configuration file. | ||
162 | .Pp | ||
163 | To enable library configuration, the default section needs to contain | ||
164 | an appropriate line which points to the main configuration section. | ||
165 | The default name is | ||
166 | .Ic openssl_conf | ||
167 | which is used by the | ||
168 | .Xr openssl 1 | ||
169 | utility. | ||
170 | Other applications may use an alternative name such as | ||
171 | .Sy myapplicaton_conf . | ||
172 | .Pp | ||
173 | The configuration section should consist of a set of name value pairs | ||
174 | which contain specific module configuration information. | ||
175 | The | ||
176 | .Ar name | ||
177 | represents the name of the configuration module. | ||
178 | The meaning of the | ||
179 | .Ar value | ||
180 | is module specific: it may, for example, represent a further | ||
181 | configuration section containing configuration module specific | ||
182 | information. | ||
183 | For example: | ||
184 | .Bd -literal -offset indent | ||
185 | openssl_conf = openssl_init | ||
186 | |||
187 | [openssl_init] | ||
188 | oid_section = new_oids | ||
189 | engines = engine_section | ||
190 | |||
191 | [new_oids] | ||
192 | \&... new oids here ... | ||
193 | |||
194 | [engine_section] | ||
195 | \&... engine stuff here ... | ||
196 | .Ed | ||
197 | .Pp | ||
198 | The features of each configuration module are described below. | ||
199 | .Ss ASN1 Object Configuration Module | ||
200 | This module has the name | ||
201 | .Ic oid_section . | ||
202 | The value of this variable points to a section containing name value | ||
203 | pairs of OIDs: the name is the OID short and long name, the value is the | ||
204 | numerical form of the OID. | ||
205 | Although some of the | ||
206 | .Xr openssl 1 | ||
207 | utility subcommands already have their own ASN1 OBJECT section | ||
208 | functionality, not all do. | ||
209 | By using the ASN1 OBJECT configuration module, all the | ||
210 | .Xr openssl 1 | ||
211 | utility subcommands can see the new objects as well as any compliant | ||
212 | applications. | ||
213 | For example: | ||
214 | .Bd -literal -offset indent | ||
215 | [new_oids] | ||
216 | some_new_oid = 1.2.3.4 | ||
217 | some_other_oid = 1.2.3.5 | ||
218 | .Ed | ||
219 | .Pp | ||
220 | It is also possible to set the value to the long name followed by a | ||
221 | comma and the numerical OID form. | ||
222 | For example: | ||
223 | .Pp | ||
224 | .Dl shortName = some object long name, 1.2.3.4 | ||
225 | .Ss Engine Configuration Module | ||
226 | This ENGINE configuration module has the name | ||
227 | .Ic engines . | ||
228 | The value of this variable points to a section containing further ENGINE | ||
229 | configuration information. | ||
230 | .Pp | ||
231 | The section pointed to by | ||
232 | .Ic engines | ||
233 | is a table of engine names (though see | ||
234 | .Ic engine_id | ||
235 | below) and further sections containing configuration information | ||
236 | specific to each ENGINE. | ||
237 | .Pp | ||
238 | Each ENGINE specific section is used to set default algorithms, load | ||
239 | dynamic, perform initialization and send ctrls. | ||
240 | The actual operation performed depends on the command | ||
241 | name which is the name of the name value pair. | ||
242 | The currently supported commands are listed below. | ||
243 | .Pp | ||
244 | For example: | ||
245 | .Bd -literal -offset indent | ||
246 | [engine_section] | ||
247 | # Configure ENGINE named "foo" | ||
248 | foo = foo_section | ||
249 | # Configure ENGINE named "bar" | ||
250 | bar = bar_section | ||
251 | |||
252 | [foo_section] | ||
253 | \&... foo ENGINE specific commands ... | ||
254 | |||
255 | [bar_section] | ||
256 | \&... "bar" ENGINE specific commands ... | ||
257 | .Ed | ||
258 | .Pp | ||
259 | The command | ||
260 | .Ic engine_id | ||
261 | is used to give the ENGINE name. | ||
262 | If used this command must be first. | ||
263 | For example: | ||
264 | .Bd -literal -offset indent | ||
265 | [engine_section] | ||
266 | # This would normally handle an ENGINE named "foo" | ||
267 | foo = foo_section | ||
268 | |||
269 | [foo_section] | ||
270 | # Override default name and use "myfoo" instead. | ||
271 | engine_id = myfoo | ||
272 | .Ed | ||
273 | .Pp | ||
274 | The command | ||
275 | .Ic dynamic_path | ||
276 | loads and adds an ENGINE from the given path. | ||
277 | It is equivalent to sending the ctrls | ||
278 | .Sy SO_PATH | ||
279 | with the path argument followed by | ||
280 | .Sy LIST_ADD | ||
281 | with value 2 and | ||
282 | .Sy LOAD | ||
283 | to the dynamic ENGINE. If this is not the required behaviour then | ||
284 | alternative ctrls can be sent directly to the dynamic ENGINE using ctrl | ||
285 | commands. | ||
286 | .Pp | ||
287 | The command | ||
288 | .Ic init | ||
289 | determines whether to initialize the ENGINE. | ||
290 | If the value is 0, the ENGINE will not be initialized. | ||
291 | If it is 1, an attempt is made to initialized the ENGINE immediately. | ||
292 | If the | ||
293 | .Ic init | ||
294 | command is not present, then an attempt will be made to initialize | ||
295 | the ENGINE after all commands in its section have been processed. | ||
296 | .Pp | ||
297 | The command | ||
298 | .Ic default_algorithms | ||
299 | sets the default algorithms an ENGINE will supply using the functions | ||
300 | .Xr ENGINE_set_default_string 3 . | ||
301 | .Pp | ||
302 | If the name matches none of the above command names it is assumed | ||
303 | to be a ctrl command which is sent to the ENGINE. | ||
304 | The value of the command is the argument to the ctrl command. | ||
305 | If the value is the string | ||
306 | .Cm EMPTY , | ||
307 | then no value is sent to the command. | ||
308 | .Pp | ||
309 | For example: | ||
310 | .Bd -literal -offset indent | ||
311 | [engine_section] | ||
312 | # Configure ENGINE named "foo" | ||
313 | foo = foo_section | ||
314 | |||
315 | [foo_section] | ||
316 | # Load engine from DSO | ||
317 | dynamic_path = /some/path/fooengine.so | ||
318 | # A foo specific ctrl. | ||
319 | some_ctrl = some_value | ||
320 | # Another ctrl that doesn't take a value. | ||
321 | other_ctrl = EMPTY | ||
322 | # Supply all default algorithms | ||
323 | default_algorithms = ALL | ||
324 | .Ed | ||
325 | .Ss SSL Configuration Module | ||
326 | This module has the name | ||
327 | .Ic ssl_conf | ||
328 | which points to a section containing SSL configurations. | ||
329 | .Pp | ||
330 | Each line in the SSL configuration section contains the name of the | ||
331 | configuration and the section containing it. | ||
332 | .Pp | ||
333 | Each configuration section consists of command value pairs for | ||
334 | .Vt SSL_CONF . | ||
335 | Each pair will be passed to a | ||
336 | .Vt SSL_CTX | ||
337 | or | ||
338 | .Vt SSL | ||
339 | structure if it calls | ||
340 | .Xr SSL_CTX_config 3 | ||
341 | or | ||
342 | .Xr SSL_config 3 | ||
343 | with the appropriate configuration name. | ||
344 | .Pp | ||
345 | Note: any characters before an initial dot in the configuration section | ||
346 | are ignored so the same command can be used multiple times. | ||
347 | .Pp | ||
348 | For example: | ||
349 | .Bd -literal -offset indent | ||
350 | ssl_conf = ssl_sect | ||
351 | |||
352 | [ssl_sect] | ||
353 | server = server_section | ||
354 | |||
355 | [server_section] | ||
356 | RSA.Certificate = server-rsa.pem | ||
357 | ECDSA.Certificate = server-ecdsa.pem | ||
358 | Ciphers = ALL:!RC4 | ||
359 | .Ed | ||
360 | .Sh FILES | ||
361 | .Bl -tag -width /etc/ssl/openssl.cnf -compact | ||
362 | .It Pa /etc/ssl/openssl.cnf | ||
363 | standard configuration file | ||
364 | .El | ||
365 | .Sh EXAMPLES | ||
366 | Here is a sample configuration file using some of the features | ||
367 | mentioned above: | ||
368 | .Bd -literal -offset indent | ||
369 | # This is the default section. | ||
370 | HOME=/temp | ||
371 | RANDFILE= ${ENV::HOME}/.rnd | ||
372 | configdir=$ENV::HOME/config | ||
373 | |||
374 | [ section_one ] | ||
375 | # We are now in section one. | ||
376 | |||
377 | # Quotes permit leading and trailing whitespace | ||
378 | any = " any variable name " | ||
379 | |||
380 | other = A string that can \e | ||
381 | cover several lines \e | ||
382 | by including \e\e characters | ||
383 | |||
384 | message = Hello World\en | ||
385 | |||
386 | [ section_two ] | ||
387 | greeting = $section_one::message | ||
388 | .Ed | ||
389 | .Pp | ||
390 | This next example shows how to expand environment variables safely. | ||
391 | .Pp | ||
392 | Suppose you want a variable called | ||
393 | .Sy tmpfile | ||
394 | to refer to a temporary filename. | ||
395 | The directory it is placed in can determined by the | ||
396 | .Ev TEMP | ||
397 | or | ||
398 | .Ev TMP | ||
399 | environment variables but they may not be set to any value at all. | ||
400 | If you just include the environment variable names and the variable | ||
401 | doesn't exist then this will cause an error when an attempt is made to | ||
402 | load the configuration file. | ||
403 | By making use of the default section both values can be looked up with | ||
404 | .Ev TEMP | ||
405 | taking priority and | ||
406 | .Pa /tmp | ||
407 | used if neither is defined: | ||
408 | .Bd -literal -offset indent | ||
409 | TMP=/tmp | ||
410 | # The above value is used if TMP isn't in the environment | ||
411 | TEMP=$ENV::TMP | ||
412 | # The above value is used if TEMP isn't in the environment | ||
413 | tmpfile=${ENV::TEMP}/tmp.filename | ||
414 | .Ed | ||
415 | .Pp | ||
416 | More complex OpenSSL library configuration. | ||
417 | Add OID: | ||
418 | .Bd -literal -offset indent | ||
419 | # Default appname: should match "appname" parameter (if any) | ||
420 | # supplied to CONF_modules_load_file et al. | ||
421 | openssl_conf = openssl_conf_section | ||
422 | |||
423 | [openssl_conf_section] | ||
424 | # Configuration module list | ||
425 | alg_section = evp_sect | ||
426 | oid_section = new_oids | ||
427 | |||
428 | [new_oids] | ||
429 | # New OID, just short name | ||
430 | newoid1 = 1.2.3.4.1 | ||
431 | # New OID shortname and long name | ||
432 | newoid2 = New OID 2 long name, 1.2.3.4.2 | ||
433 | .Ed | ||
434 | .Pp | ||
435 | The above examples can be used with any application supporting library | ||
436 | configuration if "openssl_conf" is modified to match the appropriate | ||
437 | "appname". | ||
438 | .Pp | ||
439 | For example if the second sample file above is saved to "example.cnf" | ||
440 | then the command line: | ||
441 | .Pp | ||
442 | .Dl OPENSSL_CONF=example.cnf openssl asn1parse -genstr OID:1.2.3.4.1 | ||
443 | .Pp | ||
444 | will output: | ||
445 | .Dl 0:d=0 hl=2 l= 4 prim: OBJECT :newoid1 | ||
446 | .Pp | ||
447 | showing that the OID "newoid1" has been added as "1.2.3.4.1". | ||
448 | .Sh SEE ALSO | ||
449 | .Xr openssl 1 , | ||
450 | .Xr CONF_modules_load_file 3 , | ||
451 | .Xr x509v3.cnf 5 | ||
452 | .Sh CAVEATS | ||
453 | If a configuration file attempts to expand a variable that doesn't | ||
454 | exist, then an error is flagged and the file will not load. | ||
455 | This can also happen if an attempt is made to expand an environment | ||
456 | variable that doesn't exist. | ||
457 | For example, in a previous version of OpenSSL the default OpenSSL | ||
458 | master configuration file used the value of | ||
459 | .Ev HOME | ||
460 | which may not be defined on non Unix systems and would cause an error. | ||
461 | .Pp | ||
462 | This can be worked around by including a default section to provide | ||
463 | a default value: then if the environment lookup fails, the default | ||
464 | value will be used instead. | ||
465 | For this to work properly, the default value must be defined earlier | ||
466 | in the configuration file than the expansion. | ||
467 | See the | ||
468 | .Sx EXAMPLES | ||
469 | section for an example of how to do this. | ||
470 | .Pp | ||
471 | If the same variable is defined more than once in the same section, | ||
472 | then all but the last value will be silently ignored. | ||
473 | In certain circumstances such as with DNs, the same field may occur | ||
474 | multiple times. | ||
475 | This is usually worked around by ignoring any characters before an | ||
476 | initial | ||
477 | .Ql \&. , | ||
478 | for example: | ||
479 | .Bd -literal -offset indent | ||
480 | 1.OU="My first OU" | ||
481 | 2.OU="My Second OU" | ||
482 | .Ed | ||
483 | .Sh BUGS | ||
484 | Currently there is no way to include characters using the octal | ||
485 | .Pf \e Ar nnn | ||
486 | form. | ||
487 | Strings are all NUL terminated, so NUL bytes cannot form part of | ||
488 | the value. | ||
489 | .Pp | ||
490 | The escaping isn't quite right: if you want to use sequences like | ||
491 | .Ql \en , | ||
492 | you can't use any quote escaping on the same line. | ||
493 | .Pp | ||
494 | Files are loaded in a single pass. | ||
495 | This means that an variable expansion will only work if the variables | ||
496 | referenced are defined earlier in the file. | ||