Standard preamble:
========================================================================
..
.... Set up some character translations and predefined strings. \*(-- will
give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
double quote, and \*(R" will give a right double quote. \*(C+ will
give a nicer C++. Capital omega is used to do unbreakable dashes and
therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
nothing in troff, for use with C<>.
.tr \(*W- . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\}
Escape single quotes in literal strings from groff's Unicode transform.
If the F register is >0, we'll generate index entries on stderr for
titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
entries marked with X<> in POD. Of course, you'll have to process the
output yourself in some meaningful fashion.
Avoid warning from groff about undefined register 'F'.
.. .nr rF 0 . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF
Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] .\} . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents . \" corrections for vroff . \" for low resolution devices (crt and lpr) \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} ========================================================================
Title "CONFIG 5"
way too many mistakes in technical documents.
The first part describes the general syntax of the configuration files, and subsequent sections describe the semantics of individual modules. Other modules are described in fips_config\|(5) and \fBx509v3_config\|(5). The syntax for defining \s-1ASN.1\s0 values is described in \fBASN1_generate_nconf\|(3).
For compatibility with older versions of OpenSSL, an equal sign after the directive will be ignored. Older versions will treat it as an assignment, so care should be taken if the difference in semantics is important.
A file can include other files using the include syntax:
.Vb 1 .include [=] pathname .Ve
If pathname is a simple filename, that file is included directly at that point. Included files can have .include statements that specify other files. If pathname is a directory, all files within that directory that have a \*(C`.cnf\*(C' or \*(C`.conf\*(C' extension will be included. (This is only available on systems with \s-1POSIX IO\s0 support.) Any sub-directories found inside the pathname are ignored. Similarly, if a file is opened while scanning a directory, and that file has an .include directive that specifies a directory, that is also ignored.
As a general rule, the pathname should be an absolute path; this can be enforced with the abspath and includedir pragmas, described below. The environment variable \s-1OPENSSL_CONF_INCLUDE\s0, if it exists, is prepended to all relative pathnames. If the pathname is still relative, it is interpreted based on the current working directory.
To require all file inclusions to name absolute paths, use the following directive:
.Vb 1 .pragma [=] abspath:value .Ve
The default behavior, where the value is false or off, is to allow relative paths. To require all .include pathnames to be absolute paths, use a value of true or on.
In these files, the dollar sign, $, is used to reference a variable, as described below. On some platforms, however, it is common to treat $ as a regular character in symbol names. Supporting this behavior can be done with the following directive:
.Vb 1 .pragma [=] dollarid:value .Ve
The default behavior, where the value is false or off, is to treat the dollarsign as indicating a variable name; \*(C`foo$bar\*(C' is interpreted as \f(CW\*(C`foo\*(C' followed by the expansion of the variable \*(C`bar\*(C'. If value is \fBtrue or on, then \*(C`foo$bar\*(C' is a single seven-character name and variable expansions must be specified using braces or parentheses.
.Vb 1 .pragma [=] includedir:value .Ve
If a relative pathname is specified in the .include directive, and the \s-1OPENSSL_CONF_INCLUDE\s0 environment variable doesn't exist, then the value of the includedir pragma, if it exists, is prepended to the pathname.
The first section of a configuration file is special and is referred to as the default section. This section is usually unnamed and spans from the start of file until the first named section. When a name is being looked up, it is first looked up in the current or named section, and then the default section if necessary.
The environment is mapped onto a section called \s-1ENV\s0.
Within a section are a series of name/value assignments, described in more detail below. As a reminder, the square brackets shown in this example are required, not optional:
.Vb 7 [ section ] name1 = This is value1 name2 = Another value ... [ newsection ] name1 = New value1 name3 = Value 3 .Ve
The name can contain any alphanumeric characters as well as a few punctuation symbols such as . , ; and _. Whitespace after the name and before the equal sign is ignored.
If a name is repeated in the same section, then all but the last value are ignored. In certain circumstances, such as with Certificate DNs, the same field may occur multiple times. In order to support this, commands like openssl-req\|(1) ignore any leading text that is preceded with a period. For example:
.Vb 2 1.OU = First OU 2.OU = Second OU .Ve
The value consists of the string following the = character until end of line with any leading and trailing whitespace removed.
The value string undergoes variable expansion. The text $var or \*(C`${var}\*(C' inserts the value of the named variable from the current section. To use a value from another section use $section::name or \*(C`${section::name}\*(C'. By using $ENV::name, the value of the specified environment variable will be substituted.
Variables must be defined before their value is referenced, otherwise an error is flagged and the file will not load. This can be worked around by specifying a default value in the default section before the variable is used.
Any name/value settings in an \s-1ENV\s0 section are available to the configuration file, but are not propagated to the environment.
It is an error if the value ends up longer than 64k.
It is possible to escape certain characters by using a single ' or double " quote around the value, or using a backslash \e before the character, By making the last character of a line a \e a value string can be spread across multiple lines. In addition the sequences \en, \er, \eb and \et are recognized.
The expansion and escape rules as described above that apply to value also apply to the pathname of the .include directive.
The OpenSSL configuration looks up the value of openssl_conf in the default section and takes that as the name of a section that specifies how to configure any modules in the library. It is not an error to leave any module in its default configuration. An application can specify a different name by calling CONF_modules_load_file(), for example, directly.
OpenSSL also looks up the value of config_diagnostics. If this exists and has a nonzero numeric value, any error suppressing flags passed to CONF_modules_load() will be ignored. This is useful for diagnosing misconfigurations but its use in production requires additional consideration. With this option enabled, a configuration error will completely prevent access to a service. Without this option and in the presence of a configuration error, access will be allowed but the desired configuration will not be used.
.Vb 3 # These must be in the default section config_diagnostics = 1 openssl_conf = openssl_init \& [openssl_init] oid_section = oids providers = providers alg_section = evp_properties ssl_conf = ssl_configuration engines = engines random = random \& [oids] ... new oids here ... \& [providers] ... provider stuff here ... \& [evp_properties] ... EVP properties here ... \& [ssl_configuration] ... SSL/TLS configuration properties here ... \& [engines] ... engine properties here ... \& [random] ... random properties here ... .Ve
The semantics of each module are described below. The phrase \*(L"in the initialization section\*(R" refers to the section identified by the \fBopenssl_conf or other name (given as openssl_init in the example above). The examples below assume the configuration above is used to specify the individual sections.
.Vb 4 [oids] shortName = a very long OID name, 1.2.3.4 newoid1 = 1.2.3.4.1 some_other_oid = 1.2.3.5 .Ve
If a full configuration with the above fragment is in the file \fIexample.cnf, then the following command line:
.Vb 1 OPENSSL_CONF=example.cnf openssl asn1parse -genstr OID:1.2.3.4.1 .Ve
will output:
.Vb 1 0:d=0 hl=2 l= 4 prim: OBJECT :newoid1 .Ve
showing that the \s-1OID\s0 \*(L"newoid1\*(R" has been added as \*(L"1.2.3.4.1\*(R".
Within a provider section, the following names have meaning:
All parameters in the section as well as sub-sections are made available to the provider.
Default provider and its activation Subsection "Default provider and its activation"
If no providers are activated explicitly, the default one is activated implicitly. See OSSL_PROVIDER-default\|(7) for more details.
If you add a section explicitly activating any other provider(s), you most probably need to explicitly activate the default provider, otherwise it becomes unavailable in openssl. It may make the system remotely unavailable.
Within the algorithm properties section, the following names have meaning:
.Vb 4 [ssl_configuration] server = server_tls_config client = client_tls_config system_default = tls_system_default \& [server_tls_config] ... configuration for SSL/TLS servers ... \& [client_tls_config] ... configuration for SSL/TLS clients ... .Ve
The configuration name system_default has a special meaning. If it exists, it is applied whenever an \s-1SSL_CTX\s0 object is created. For example, to impose system-wide minimum \s-1TLS\s0 and \s-1DTLS\s0 protocol versions:
.Vb 3 [tls_system_default] MinProtocol = TLSv1.2 MinProtocol = DTLSv1.2 .Ve
The minimum \s-1TLS\s0 protocol is applied to \s-1SSL_CTX\s0 objects that are TLS-based, and the minimum \s-1DTLS\s0 protocol to those are DTLS-based. The same applies also to maximum versions set with MaxProtocol.
Each configuration section consists of name/value pairs that are parsed by SSL_CONF_cmd\|(3), which will be called by SSL_CTX_config() or \fBSSL_config(), appropriately. Note that any characters before an initial dot in the configuration section are ignored, so that the same command can be used multiple times. This probably is most useful for loading different key types, as shown here:
.Vb 3 [server_tls_config] RSA.Certificate = server-rsa.pem ECDSA.Certificate = server-ecdsa.pem .Ve
Within an engine section, the following names have meaning:
All other names are taken to be the name of a ctrl command that is sent to the \s-1ENGINE,\s0 and the value is the argument passed with the command. The special value \s-1EMPTY\s0 means no value is sent with the command. For example:
.Vb 2 [engines] foo = foo_engine \& [foo_engine] dynamic_path = /some/path/fooengine.so some_ctrl = some_value default_algorithms = ALL other_ctrl = EMPTY .Ve
Within the random section, the following names have meaning:
0
This specifies what cipher a CTR-DRBG random bit generator will use. Other random bit generators ignore this name. The default value is \s-1AES-256-CTR\s0.
.Vb 3 # This is the default section. HOME = /temp configdir = $ENV::HOME/config \& [ section_one ] # Quotes permit leading and trailing whitespace any = " any variable name " other = A string that can \e cover several lines \e by including \e\e characters message = Hello World\en \& [ section_two ] greeting = $section_one::message .Ve
This example shows how to expand environment variables safely. In this example, the variable tempfile is intended to refer to a temporary file, and the environment variable \s-1TEMP\s0 or \fB\s-1TMP\s0, if present, specify the directory where the file should be put. Since the default section is checked if a variable does not exist, it is possible to set \s-1TMP\s0 to default to /tmp, and \fB\s-1TEMP\s0 to default to \s-1TMP\s0.
.Vb 3 # These two lines must be in the default section. TMP = /tmp TEMP = $ENV::TMP \& # This can be used anywhere tmpfile = ${ENV::TEMP}/tmp.filename .Ve
This example shows how to enforce \s-1FIPS\s0 mode for the application \fIsample.
.Vb 1 sample = fips_config \& [fips_config] alg_section = evp_properties \& [evp_properties] default_properties = "fips=yes" .Ve
The escaping isn't quite right: if you want to use sequences like \en you can't use any quote escaping on the same line.
The limit that only one directory can be opened and read at a time can be considered a bug and should be fixed.
Licensed under the Apache License 2.0 (the \*(L"License\*(R"). You may not use this file except in compliance with the License. You can obtain a copy in the file \s-1LICENSE\s0 in the source distribution or at <https://www.openssl.org/source/license.html>.