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