config.5 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  1. .\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35)
  2. .\"
  3. .\" Standard preamble:
  4. .\" ========================================================================
  5. .de Sp \" Vertical space (when we can't use .PP)
  6. .if t .sp .5v
  7. .if n .sp
  8. ..
  9. .de Vb \" Begin verbatim text
  10. .ft CW
  11. .nf
  12. .ne \\$1
  13. ..
  14. .de Ve \" End verbatim text
  15. .ft R
  16. .fi
  17. ..
  18. .\" Set up some character translations and predefined strings. \*(-- will
  19. .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
  20. .\" double quote, and \*(R" will give a right double quote. \*(C+ will
  21. .\" give a nicer C++. Capital omega is used to do unbreakable dashes and
  22. .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
  23. .\" nothing in troff, for use with C<>.
  24. .tr \(*W-
  25. .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
  26. .ie n \{\
  27. . ds -- \(*W-
  28. . ds PI pi
  29. . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
  30. . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
  31. . ds L" ""
  32. . ds R" ""
  33. . ds C` ""
  34. . ds C' ""
  35. 'br\}
  36. .el\{\
  37. . ds -- \|\(em\|
  38. . ds PI \(*p
  39. . ds L" ``
  40. . ds R" ''
  41. . ds C`
  42. . ds C'
  43. 'br\}
  44. .\"
  45. .\" Escape single quotes in literal strings from groff's Unicode transform.
  46. .ie \n(.g .ds Aq \(aq
  47. .el .ds Aq '
  48. .\"
  49. .\" If the F register is >0, we'll generate index entries on stderr for
  50. .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
  51. .\" entries marked with X<> in POD. Of course, you'll have to process the
  52. .\" output yourself in some meaningful fashion.
  53. .\"
  54. .\" Avoid warning from groff about undefined register 'F'.
  55. .de IX
  56. ..
  57. .if !\nF .nr F 0
  58. .if \nF>0 \{\
  59. . de IX
  60. . tm Index:\\$1\t\\n%\t"\\$2"
  61. ..
  62. . if !\nF==2 \{\
  63. . nr % 0
  64. . nr F 2
  65. . \}
  66. .\}
  67. .\"
  68. .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
  69. .\" Fear. Run. Save yourself. No user-serviceable parts.
  70. . \" fudge factors for nroff and troff
  71. .if n \{\
  72. . ds #H 0
  73. . ds #V .8m
  74. . ds #F .3m
  75. . ds #[ \f1
  76. . ds #] \fP
  77. .\}
  78. .if t \{\
  79. . ds #H ((1u-(\\\\n(.fu%2u))*.13m)
  80. . ds #V .6m
  81. . ds #F 0
  82. . ds #[ \&
  83. . ds #] \&
  84. .\}
  85. . \" simple accents for nroff and troff
  86. .if n \{\
  87. . ds ' \&
  88. . ds ` \&
  89. . ds ^ \&
  90. . ds , \&
  91. . ds ~ ~
  92. . ds /
  93. .\}
  94. .if t \{\
  95. . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
  96. . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
  97. . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
  98. . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
  99. . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
  100. . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
  101. .\}
  102. . \" troff and (daisy-wheel) nroff accents
  103. .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
  104. .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
  105. .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
  106. .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
  107. .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
  108. .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
  109. .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
  110. .ds ae a\h'-(\w'a'u*4/10)'e
  111. .ds Ae A\h'-(\w'A'u*4/10)'E
  112. . \" corrections for vroff
  113. .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
  114. .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
  115. . \" for low resolution devices (crt and lpr)
  116. .if \n(.H>23 .if \n(.V>19 \
  117. \{\
  118. . ds : e
  119. . ds 8 ss
  120. . ds o a
  121. . ds d- d\h'-1'\(ga
  122. . ds D- D\h'-1'\(hy
  123. . ds th \o'bp'
  124. . ds Th \o'LP'
  125. . ds ae ae
  126. . ds Ae AE
  127. .\}
  128. .rm #[ #] #H #V #F C
  129. .\" ========================================================================
  130. .\"
  131. .IX Title "CONFIG 5"
  132. .TH CONFIG 5 "2019-09-12" "1.0.2g" "OpenSSL"
  133. .\" For nroff, turn off justification. Always turn off hyphenation; it makes
  134. .\" way too many mistakes in technical documents.
  135. .if n .ad l
  136. .nh
  137. .SH "NAME"
  138. config \- OpenSSL CONF library configuration files
  139. .SH "DESCRIPTION"
  140. .IX Header "DESCRIPTION"
  141. The OpenSSL \s-1CONF\s0 library can be used to read configuration files.
  142. It is used for the OpenSSL master configuration file \fBopenssl.cnf\fR
  143. and in a few other places like \fB\s-1SPKAC\s0\fR files and certificate extension
  144. files for the \fBx509\fR utility. OpenSSL applications can also use the
  145. \&\s-1CONF\s0 library for their own purposes.
  146. .PP
  147. A configuration file is divided into a number of sections. Each section
  148. starts with a line \fB[ section_name ]\fR and ends when a new section is
  149. started or end of file is reached. A section name can consist of
  150. alphanumeric characters and underscores.
  151. .PP
  152. The first section of a configuration file is special and is referred
  153. to as the \fBdefault\fR section this is usually unnamed and is from the
  154. start of file until the first named section. When a name is being looked up
  155. it is first looked up in a named section (if any) and then the
  156. default section.
  157. .PP
  158. The environment is mapped onto a section called \fB\s-1ENV\s0\fR.
  159. .PP
  160. Comments can be included by preceding them with the \fB#\fR character
  161. .PP
  162. Each section in a configuration file consists of a number of name and
  163. value pairs of the form \fBname=value\fR
  164. .PP
  165. The \fBname\fR string can contain any alphanumeric characters as well as
  166. a few punctuation symbols such as \fB.\fR \fB,\fR \fB;\fR and \fB_\fR.
  167. .PP
  168. The \fBvalue\fR string consists of the string following the \fB=\fR character
  169. until end of line with any leading and trailing white space removed.
  170. .PP
  171. The value string undergoes variable expansion. This can be done by
  172. including the form \fB\f(CB$var\fB\fR or \fB${var}\fR: this will substitute the value
  173. of the named variable in the current section. It is also possible to
  174. substitute a value from another section using the syntax \fB\f(CB$section::name\fB\fR
  175. or \fB${section::name}\fR. By using the form \fB\f(CB$ENV::name\fB\fR environment
  176. variables can be substituted. It is also possible to assign values to
  177. environment variables by using the name \fBENV::name\fR, this will work
  178. if the program looks up environment variables using the \fB\s-1CONF\s0\fR library
  179. instead of calling \fB\f(BIgetenv()\fB\fR directly.
  180. .PP
  181. It is possible to escape certain characters by using any kind of quote
  182. or the \fB\e\fR character. By making the last character of a line a \fB\e\fR
  183. a \fBvalue\fR string can be spread across multiple lines. In addition
  184. the sequences \fB\en\fR, \fB\er\fR, \fB\eb\fR and \fB\et\fR are recognized.
  185. .SH "OPENSSL LIBRARY CONFIGURATION"
  186. .IX Header "OPENSSL LIBRARY CONFIGURATION"
  187. In OpenSSL 0.9.7 and later applications can automatically configure certain
  188. aspects of OpenSSL using the master OpenSSL configuration file, or optionally
  189. an alternative configuration file. The \fBopenssl\fR utility includes this
  190. functionality: any sub command uses the master OpenSSL configuration file
  191. unless an option is used in the sub command to use an alternative configuration
  192. file.
  193. .PP
  194. To enable library configuration the default section needs to contain an
  195. appropriate line which points to the main configuration section. The default
  196. name is \fBopenssl_conf\fR which is used by the \fBopenssl\fR utility. Other
  197. applications may use an alternative name such as \fBmyapplicaton_conf\fR.
  198. .PP
  199. The configuration section should consist of a set of name value pairs which
  200. contain specific module configuration information. The \fBname\fR represents
  201. the name of the \fIconfiguration module\fR the meaning of the \fBvalue\fR is
  202. module specific: it may, for example, represent a further configuration
  203. section containing configuration module specific information. E.g.
  204. .PP
  205. .Vb 1
  206. \& openssl_conf = openssl_init
  207. \&
  208. \& [openssl_init]
  209. \&
  210. \& oid_section = new_oids
  211. \& engines = engine_section
  212. \&
  213. \& [new_oids]
  214. \&
  215. \& ... new oids here ...
  216. \&
  217. \& [engine_section]
  218. \&
  219. \& ... engine stuff here ...
  220. .Ve
  221. .PP
  222. The features of each configuration module are described below.
  223. .SS "\s-1ASN1 OBJECT CONFIGURATION MODULE\s0"
  224. .IX Subsection "ASN1 OBJECT CONFIGURATION MODULE"
  225. This module has the name \fBoid_section\fR. The value of this variable points
  226. to a section containing name value pairs of OIDs: the name is the \s-1OID\s0 short
  227. and long name, the value is the numerical form of the \s-1OID.\s0 Although some of
  228. the \fBopenssl\fR utility sub commands already have their own \s-1ASN1 OBJECT\s0 section
  229. functionality not all do. By using the \s-1ASN1 OBJECT\s0 configuration module
  230. \&\fBall\fR the \fBopenssl\fR utility sub commands can see the new objects as well
  231. as any compliant applications. For example:
  232. .PP
  233. .Vb 1
  234. \& [new_oids]
  235. \&
  236. \& some_new_oid = 1.2.3.4
  237. \& some_other_oid = 1.2.3.5
  238. .Ve
  239. .PP
  240. In OpenSSL 0.9.8 it is also possible to set the value to the long name followed
  241. by a comma and the numerical \s-1OID\s0 form. For example:
  242. .PP
  243. .Vb 1
  244. \& shortName = some object long name, 1.2.3.4
  245. .Ve
  246. .SS "\s-1ENGINE CONFIGURATION MODULE\s0"
  247. .IX Subsection "ENGINE CONFIGURATION MODULE"
  248. This \s-1ENGINE\s0 configuration module has the name \fBengines\fR. The value of this
  249. variable points to a section containing further \s-1ENGINE\s0 configuration
  250. information.
  251. .PP
  252. The section pointed to by \fBengines\fR is a table of engine names (though see
  253. \&\fBengine_id\fR below) and further sections containing configuration information
  254. specific to each \s-1ENGINE.\s0
  255. .PP
  256. Each \s-1ENGINE\s0 specific section is used to set default algorithms, load
  257. dynamic, perform initialization and send ctrls. The actual operation performed
  258. depends on the \fIcommand\fR name which is the name of the name value pair. The
  259. currently supported commands are listed below.
  260. .PP
  261. For example:
  262. .PP
  263. .Vb 1
  264. \& [engine_section]
  265. \&
  266. \& # Configure ENGINE named "foo"
  267. \& foo = foo_section
  268. \& # Configure ENGINE named "bar"
  269. \& bar = bar_section
  270. \&
  271. \& [foo_section]
  272. \& ... foo ENGINE specific commands ...
  273. \&
  274. \& [bar_section]
  275. \& ... "bar" ENGINE specific commands ...
  276. .Ve
  277. .PP
  278. The command \fBengine_id\fR is used to give the \s-1ENGINE\s0 name. If used this
  279. command must be first. For example:
  280. .PP
  281. .Vb 3
  282. \& [engine_section]
  283. \& # This would normally handle an ENGINE named "foo"
  284. \& foo = foo_section
  285. \&
  286. \& [foo_section]
  287. \& # Override default name and use "myfoo" instead.
  288. \& engine_id = myfoo
  289. .Ve
  290. .PP
  291. The command \fBdynamic_path\fR loads and adds an \s-1ENGINE\s0 from the given path. It
  292. is equivalent to sending the ctrls \fB\s-1SO_PATH\s0\fR with the path argument followed
  293. by \fB\s-1LIST_ADD\s0\fR with value 2 and \fB\s-1LOAD\s0\fR to the dynamic \s-1ENGINE.\s0 If this is
  294. not the required behaviour then alternative ctrls can be sent directly
  295. to the dynamic \s-1ENGINE\s0 using ctrl commands.
  296. .PP
  297. The command \fBinit\fR determines whether to initialize the \s-1ENGINE.\s0 If the value
  298. is \fB0\fR the \s-1ENGINE\s0 will not be initialized, if \fB1\fR and attempt it made to
  299. initialized the \s-1ENGINE\s0 immediately. If the \fBinit\fR command is not present
  300. then an attempt will be made to initialize the \s-1ENGINE\s0 after all commands in
  301. its section have been processed.
  302. .PP
  303. The command \fBdefault_algorithms\fR sets the default algorithms an \s-1ENGINE\s0 will
  304. supply using the functions \fB\f(BIENGINE_set_default_string()\fB\fR
  305. .PP
  306. If the name matches none of the above command names it is assumed to be a
  307. ctrl command which is sent to the \s-1ENGINE.\s0 The value of the command is the
  308. argument to the ctrl command. If the value is the string \fB\s-1EMPTY\s0\fR then no
  309. value is sent to the command.
  310. .PP
  311. For example:
  312. .PP
  313. .Vb 1
  314. \& [engine_section]
  315. \&
  316. \& # Configure ENGINE named "foo"
  317. \& foo = foo_section
  318. \&
  319. \& [foo_section]
  320. \& # Load engine from DSO
  321. \& dynamic_path = /some/path/fooengine.so
  322. \& # A foo specific ctrl.
  323. \& some_ctrl = some_value
  324. \& # Another ctrl that doesn\*(Aqt take a value.
  325. \& other_ctrl = EMPTY
  326. \& # Supply all default algorithms
  327. \& default_algorithms = ALL
  328. .Ve
  329. .SS "\s-1EVP CONFIGURATION MODULE\s0"
  330. .IX Subsection "EVP CONFIGURATION MODULE"
  331. This modules has the name \fBalg_section\fR which points to a section containing
  332. algorithm commands.
  333. .PP
  334. Currently the only algorithm command supported is \fBfips_mode\fR whose
  335. value should be a boolean string such as \fBon\fR or \fBoff\fR. If the value is
  336. \&\fBon\fR this attempt to enter \s-1FIPS\s0 mode. If the call fails or the library is
  337. not \s-1FIPS\s0 capable then an error occurs.
  338. .PP
  339. For example:
  340. .PP
  341. .Vb 1
  342. \& alg_section = evp_settings
  343. \&
  344. \& [evp_settings]
  345. \&
  346. \& fips_mode = on
  347. .Ve
  348. .SH "NOTES"
  349. .IX Header "NOTES"
  350. If a configuration file attempts to expand a variable that doesn't exist
  351. then an error is flagged and the file will not load. This can happen
  352. if an attempt is made to expand an environment variable that doesn't
  353. exist. For example in a previous version of OpenSSL the default OpenSSL
  354. master configuration file used the value of \fB\s-1HOME\s0\fR which may not be
  355. defined on non Unix systems and would cause an error.
  356. .PP
  357. This can be worked around by including a \fBdefault\fR section to provide
  358. a default value: then if the environment lookup fails the default value
  359. will be used instead. For this to work properly the default value must
  360. be defined earlier in the configuration file than the expansion. See
  361. the \fB\s-1EXAMPLES\s0\fR section for an example of how to do this.
  362. .PP
  363. If the same variable exists in the same section then all but the last
  364. value will be silently ignored. In certain circumstances such as with
  365. DNs the same field may occur multiple times. This is usually worked
  366. around by ignoring any characters before an initial \fB.\fR e.g.
  367. .PP
  368. .Vb 2
  369. \& 1.OU="My first OU"
  370. \& 2.OU="My Second OU"
  371. .Ve
  372. .SH "EXAMPLES"
  373. .IX Header "EXAMPLES"
  374. Here is a sample configuration file using some of the features
  375. mentioned above.
  376. .PP
  377. .Vb 1
  378. \& # This is the default section.
  379. \&
  380. \& HOME=/temp
  381. \& RANDFILE= ${ENV::HOME}/.rnd
  382. \& configdir=$ENV::HOME/config
  383. \&
  384. \& [ section_one ]
  385. \&
  386. \& # We are now in section one.
  387. \&
  388. \& # Quotes permit leading and trailing whitespace
  389. \& any = " any variable name "
  390. \&
  391. \& other = A string that can \e
  392. \& cover several lines \e
  393. \& by including \e\e characters
  394. \&
  395. \& message = Hello World\en
  396. \&
  397. \& [ section_two ]
  398. \&
  399. \& greeting = $section_one::message
  400. .Ve
  401. .PP
  402. This next example shows how to expand environment variables safely.
  403. .PP
  404. Suppose you want a variable called \fBtmpfile\fR to refer to a
  405. temporary filename. The directory it is placed in can determined by
  406. the the \fB\s-1TEMP\s0\fR or \fB\s-1TMP\s0\fR environment variables but they may not be
  407. set to any value at all. If you just include the environment variable
  408. names and the variable doesn't exist then this will cause an error when
  409. an attempt is made to load the configuration file. By making use of the
  410. default section both values can be looked up with \fB\s-1TEMP\s0\fR taking
  411. priority and \fB/tmp\fR used if neither is defined:
  412. .PP
  413. .Vb 5
  414. \& TMP=/tmp
  415. \& # The above value is used if TMP isn\*(Aqt in the environment
  416. \& TEMP=$ENV::TMP
  417. \& # The above value is used if TEMP isn\*(Aqt in the environment
  418. \& tmpfile=${ENV::TEMP}/tmp.filename
  419. .Ve
  420. .PP
  421. Simple OpenSSL library configuration example to enter \s-1FIPS\s0 mode:
  422. .PP
  423. .Vb 3
  424. \& # Default appname: should match "appname" parameter (if any)
  425. \& # supplied to CONF_modules_load_file et al.
  426. \& openssl_conf = openssl_conf_section
  427. \&
  428. \& [openssl_conf_section]
  429. \& # Configuration module list
  430. \& alg_section = evp_sect
  431. \&
  432. \& [evp_sect]
  433. \& # Set to "yes" to enter FIPS mode if supported
  434. \& fips_mode = yes
  435. .Ve
  436. .PP
  437. Note: in the above example you will get an error in non \s-1FIPS\s0 capable versions
  438. of OpenSSL.
  439. .PP
  440. More complex OpenSSL library configuration. Add \s-1OID\s0 and don't enter \s-1FIPS\s0 mode:
  441. .PP
  442. .Vb 3
  443. \& # Default appname: should match "appname" parameter (if any)
  444. \& # supplied to CONF_modules_load_file et al.
  445. \& openssl_conf = openssl_conf_section
  446. \&
  447. \& [openssl_conf_section]
  448. \& # Configuration module list
  449. \& alg_section = evp_sect
  450. \& oid_section = new_oids
  451. \&
  452. \& [evp_sect]
  453. \& # This will have no effect as FIPS mode is off by default.
  454. \& # Set to "yes" to enter FIPS mode, if supported
  455. \& fips_mode = no
  456. \&
  457. \& [new_oids]
  458. \& # New OID, just short name
  459. \& newoid1 = 1.2.3.4.1
  460. \& # New OID shortname and long name
  461. \& newoid2 = New OID 2 long name, 1.2.3.4.2
  462. .Ve
  463. .PP
  464. The above examples can be used with with any application supporting library
  465. configuration if \*(L"openssl_conf\*(R" is modified to match the appropriate \*(L"appname\*(R".
  466. .PP
  467. For example if the second sample file above is saved to \*(L"example.cnf\*(R" then
  468. the command line:
  469. .PP
  470. .Vb 1
  471. \& OPENSSL_CONF=example.cnf openssl asn1parse \-genstr OID:1.2.3.4.1
  472. .Ve
  473. .PP
  474. will output:
  475. .PP
  476. .Vb 1
  477. \& 0:d=0 hl=2 l= 4 prim: OBJECT :newoid1
  478. .Ve
  479. .PP
  480. showing that the \s-1OID\s0 \*(L"newoid1\*(R" has been added as \*(L"1.2.3.4.1\*(R".
  481. .SH "BUGS"
  482. .IX Header "BUGS"
  483. Currently there is no way to include characters using the octal \fB\ennn\fR
  484. form. Strings are all null terminated so nulls cannot form part of
  485. the value.
  486. .PP
  487. The escaping isn't quite right: if you want to use sequences like \fB\en\fR
  488. you can't use any quote escaping on the same line.
  489. .PP
  490. Files are loaded in a single pass. This means that an variable expansion
  491. will only work if the variables referenced are defined earlier in the
  492. file.
  493. .SH "SEE ALSO"
  494. .IX Header "SEE ALSO"
  495. \&\fIx509\fR\|(1), \fIreq\fR\|(1), \fIca\fR\|(1)