You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

917 lines
28 KiB

5 years ago
1 month ago
  1. .\" Copyright (c) 2019-2020 Rodolphe Bréard <rodolphe@breard.tf>
  2. .\"
  3. .\" Copying and distribution of this file, with or without modification,
  4. .\" are permitted in any medium without royalty provided the copyright
  5. .\" notice and this notice are preserved. This file is offered as-is,
  6. .\" without any warranty.
  7. .Dd Dec 21, 2024
  8. .Dt ACMED.TOML 5
  9. .Os
  10. .Sh NAME
  11. .Nm acmed.toml
  12. .Nd ACMEd configuration file format
  13. .Sh DESCRIPTION
  14. Configuration files for
  15. .Xr acmed 8
  16. are written in the
  17. .Em TOML
  18. format. The allowed elements are described below.
  19. .Bl -tag
  20. .It Ic account
  21. Table representing an account on one or several endpoint.
  22. .Bl -tag
  23. .It Ic contacts Ar array
  24. Array of tables describing describing the account holder's contact information. Each table must have one and only one key-value pair. Possible keys and their associated values are:
  25. .Bl -tag
  26. .It Ic mailto Ar string
  27. A mailto URI as defined by
  28. .Em RFC 6068 .
  29. This URI cannot contains neither
  30. .Dq hfields
  31. nor more than one
  32. .Dq addr-spec
  33. in the
  34. .Dq to
  35. component.
  36. .El
  37. .It Ic env Ar table
  38. Table of environment variables that will be accessible from hooks.
  39. .It Ic external_account Ar table
  40. Table containing the information required to bind the account to an external one. Possible fields and values are:
  41. .Bl -tag
  42. .It Ic identifier Ar string
  43. ASCII string identifying the key.
  44. .It Ic key Ar string
  45. Private key encoded in base64url without padding.
  46. .It Ic signature_algorithm Ar string
  47. Name of the signature algorithm used to sign the external account binding message sent to the endpoint as defined in
  48. .Em RFC 7518 .
  49. Possible values are:
  50. .Bl -dash -compact
  51. .It
  52. HS256
  53. .Aq default
  54. .It
  55. HS384
  56. .It
  57. HS512
  58. .El
  59. .El
  60. .It Ic hooks Ar array
  61. Names of hooks that will be called during operations on the account storage file. The hooks are guaranteed to be called sequentially in the declaration order.
  62. .It Cm key_type Ar string
  63. Name of the asymmetric cryptography algorithm used to generate the key pair. Possible values are:
  64. .Bl -dash -compact
  65. .It
  66. ed25519
  67. .It
  68. ed448
  69. .It
  70. ecdsa_p256
  71. .Aq default
  72. .It
  73. ecdsa_p384
  74. .It
  75. ecdsa_p521
  76. .It
  77. rsa2048
  78. .It
  79. rsa4096
  80. .El
  81. .It Cm signature_algorithm Ar string
  82. Name of the signature algorithm used to sign the messages sent to the endpoint as defined in
  83. .Em RFC 7518 .
  84. The default value is derived from the key type. Possible values are:
  85. .Bl -dash -compact
  86. .It
  87. ES256
  88. .It
  89. ES384
  90. .It
  91. ES512
  92. .It
  93. RS256
  94. .El
  95. .El
  96. .It Ic certificate
  97. Array of table representing a certificate that will be requested to a CA.
  98. .Pp
  99. Note that, by default, certificates are identified by the first identifier in the list of identifiers. That means that if you reorder the identifiers so that a different identifier is at the first position, a new certificate with a new name will be issued.
  100. .Bl -tag
  101. .It Ic account Ar string
  102. Name of the account to use.
  103. .It Ic csr_digest Ar string
  104. Name of the certificate's signing request digest algorithm. Possible values are:
  105. .Bl -dash -compact
  106. .It
  107. sha256
  108. .Aq default
  109. .It
  110. sha384
  111. .It
  112. sha512
  113. .El
  114. .It Ic directory Ar string
  115. Path to the directory where certificates and their associated private keys are stored.
  116. .It Ic endpoint Ar string
  117. Name of the endpoint to use.
  118. .It Ic env Ar table
  119. Table of environment variables that will be accessible from hooks.
  120. .It Ic file_name_format Ar string
  121. Template used to build the file's name. The template syntax is
  122. .Em MiniJinja .
  123. See the
  124. .Sx STANDARDS
  125. section for a link to the
  126. .Em MiniJinja
  127. specifications. If not specified, the value defined in the
  128. .Em endpoint
  129. element, and then the
  130. .Em global
  131. element, is used. Default is
  132. .Dq {{ name }}_{{ key_type }}.{{ file_type }}.{{ ext }} .
  133. Possible variables are:
  134. .Bl -tag
  135. .It Ic ext Ar string
  136. File extension. See
  137. .Xr cert_file_ext
  138. and
  139. .Xr pk_file_ext .
  140. .It Ic file_type Ar string
  141. Contains
  142. .Dq pk
  143. for the private key file and
  144. .Dq crt
  145. for the certificate file.
  146. .It Ic key_type Ar string
  147. The certificate's private key type.
  148. .It Ic name Ar string
  149. The certificate's name.
  150. .El
  151. .It Ic hooks Ar array
  152. Names of hooks that will be called when requesting a new certificate. The hooks are guaranteed to be called sequentially in the declaration order.
  153. .It Ic identifiers Ar array
  154. Array of tables listing the identifiers that should be included in the certificate along with the challenge to use for each one. The
  155. .Em dns
  156. and
  157. .Em ip
  158. fields are mutually exclusive.
  159. .Bl -tag
  160. .It Ic challenge Ar string
  161. The name of the challenge to use to prove the identifier's ownership. Possible values are:
  162. .Bl -dash -compact
  163. .It
  164. dns-01
  165. .It
  166. http-01
  167. .It
  168. tls-alpn-01
  169. .El
  170. .It Ic dns Ar string
  171. The domain name.
  172. .It Ic env Ar table
  173. Table of environment variables that will be accessible from hooks.
  174. .It Ic ip Ar string
  175. The IP address.
  176. .El
  177. .It Ic key_type Ar string
  178. Name of the asymmetric cryptography algorithm used to generate the certificate's key pair. Possible values are:
  179. .Bl -dash -compact
  180. .It
  181. ed25519
  182. .It
  183. ed448
  184. .It
  185. ecdsa_p256
  186. .It
  187. ecdsa_p384
  188. .It
  189. ecdsa_p521
  190. .It
  191. rsa2048
  192. .Aq default
  193. .It
  194. rsa4096
  195. .El
  196. .It Ic kp_reuse Ar boolean
  197. Set whether or not the private key should be reused when renewing the certificate. Default is false.
  198. .It Ic name
  199. Name of the certificate. Must be unique unless the key type is different. Will be used in logs and in the associated file's name. The
  200. .Sq * ,
  201. .So
  202. :
  203. .Sc
  204. and
  205. .Sq /
  206. characters will be replaced by an underscore. Default is the first identifier.
  207. .It Cm random_early_renew Ar string
  208. Period of time before the usual certificate renewal, in which the certificate will renew at a random time. This is useful for when
  209. you want to even out your certificate orders when you're dealing with very large numbers of certificates. The format is described in the
  210. .Sx TIME PERIODS
  211. section. Default is the value defined in the associated endpoint.
  212. .It Cm renew_delay Ar string
  213. Period of time between the certificate renewal and its expiration date. The format is described in the
  214. .Sx TIME PERIODS
  215. section. Default is the value defined in the associated endpoint.
  216. .It Ic subject_attributes Ar table
  217. Table where the certificate's subject attributes are specified. Possible keys, with their RFC 4519 and X.500 equivalents, are:
  218. .Bl -column -offset indent ".Sy organizational_unit_name" ".Sy generationQualifier" ".Sy organizationalUnitName"
  219. .It Sy ACMEd key Ta Sy RFC 4519 Ta Sy X.500
  220. .It Li country_name Ta c Ta countryName
  221. .It Li generation_qualifier Ta generationQualifier Ta
  222. .It Li given_name Ta givenName Ta
  223. .It Li initials Ta initials Ta
  224. .It Li locality_name Ta l Ta localityName
  225. .It Li name Ta name Ta
  226. .It Li organization_name Ta o Ta organizationName
  227. .It Li organizational_unit_name Ta ou Ta organizationalUnitName
  228. .It Li pkcs9_email_address Ta Ta
  229. .It Li postal_address Ta postalAddress Ta
  230. .It Li postal_code Ta postalCode Ta
  231. .It Li state_or_province_name Ta st Ta stateOrProvinceName
  232. .It Li street Ta street Ta streetAddress
  233. .It Li surname Ta sn Ta surname
  234. .It Li title Ta title Ta
  235. .El
  236. .El
  237. .It Ic endpoint
  238. Table where each element defines a Certificate Authority
  239. .Pq CA
  240. which may be used to request certificates.
  241. .Bl -tag
  242. .It Cm file_name_format Ar string
  243. Template used to build the file's name. For detailed documentation, see the
  244. .Em file_name_format
  245. directive located in the
  246. .Em certificate
  247. element.
  248. .It Cm rate_limits Ar array
  249. Array containing the names of the HTTPS rate limits to apply.
  250. .It Cm random_early_renew Ar string
  251. Period of time before the usual certificate renewal, in which the certificate will renew at a random time. This is useful for when
  252. you want to even out your certificate orders when you're dealing with very large numbers of certificates. The format is described in the
  253. .Sx TIME PERIODS
  254. section. Default is the value defined in the global section.
  255. .It Cm renew_delay Ar string
  256. Period of time between the certificate renewal and its expiration date. The format is described in the
  257. .Sx TIME PERIODS
  258. section. Default is the value defined in the global section.
  259. .It Cm root_certificates Ar array
  260. Array containing the path to root certificates that should be added to the trust store.
  261. .It Cm tos_agreed Ar boolean
  262. Set whether or not the user agrees to the Terms Of Service
  263. .Pq TOS .
  264. .It Cm url Ar string
  265. The endpoint's directory URL.
  266. .El
  267. .It Ic global
  268. Table containing the global configuration options.
  269. .Bl -tag
  270. .It Cm accounts_directory Ar string
  271. Specify the directory where the accounts private and public keys are stored.
  272. .It Cm cert_file_group Ar group_name|group_id Ft string
  273. Specify the group who will own newly-created certificates files. See
  274. .Xr chown 2
  275. for more details.
  276. .It Cm cert_file_mode Ar integer
  277. Specify the permissions to use for newly-created certificates files. See
  278. .Xr chmod 2
  279. for more details.
  280. .It Cm cert_file_user Ar username|user_id Ft string
  281. Specify the user who will own newly-created certificates files. See
  282. .Xr chown 2
  283. for more details.
  284. .It Cm cert_file_ext Ft string
  285. Specify the file extension of certificate files. Default is
  286. .Dq pem .
  287. .It Cm certificates_directory Ar string
  288. Specify the directory where the certificates and their associated private keys are stored.
  289. .It Ic env Ar table
  290. Table of environment variables that will be accessible from hooks.
  291. .It Ic file_name_format Ar string
  292. Template used to build the file's name. For detailed documentation, see the
  293. .Em file_name_format
  294. directive located in the
  295. .Em certificate
  296. element.
  297. .It Cm pk_file_group Ar group_name|group_id Ft string
  298. Specify the group who will own newly-created private-key files. See
  299. .Xr chown 2
  300. for more details.
  301. .It Cm pk_file_mode Ar integer
  302. Specify the permissions to use for newly-created private-key files. See
  303. .Xr chmod 2
  304. for more details.
  305. .It Cm pk_file_user Ar username|user_id Ft string
  306. Specify the user who will own newly-created private-key files. See
  307. .Xr chown 2
  308. for more details.
  309. .It Cm pk_file_ext Ft string
  310. Specify the file extension of private-key files.
  311. .It Cm random_early_renew Ar string
  312. Period of time before the usual certificate renewal, in which the certificate will renew at a random time. This is useful for when
  313. you want to even out your certificate orders when you're dealing with very large numbers of certificates. The format is described in the
  314. .Sx TIME PERIODS
  315. section. By default, this is disabled, or rather, the time frame is set to 0.
  316. .It Cm renew_delay Ar string
  317. Period of time between the certificate renewal and its expiration date. The format is described in the
  318. .Sx TIME PERIODS
  319. section. Default is 30d.
  320. .It Cm root_certificates Ar array
  321. Array containing the path to root certificates that should be added to the trust store.
  322. .El
  323. .It Ic group
  324. Table of array allowing to group several hooks as one. A group is considered as new hook. The array contains the names of the hooks that are grouped. The hooks are guaranteed to be called sequentially in the declaration order. The group name must not start with
  325. .Dq internal: .
  326. .It Ic hook
  327. Table where each element defines a command that will be launched at a defined point. See section
  328. .Sx WRITING A HOOK
  329. for more details. The hook name must not start with
  330. .Dq internal: .
  331. .Bl -tag
  332. .It Cm allow_failure Ar boolean
  333. Defines if an error return value for this hook is allowed or not. If not allowed, a failure in this hook will fail the whole certificate request process. Default is false.
  334. .It Ic args Ar array
  335. Array of strings representing the command's arguments.
  336. .It Ic cmd Ar string
  337. The name of the command that will be launched.
  338. .It Ic stderr Ar string
  339. Path to the file where the command's standard error output if written.
  340. .It Ic stdin Ar string
  341. Path to the file that will be written into the command's standard intput. Mutually exclusive with
  342. .Em stdin_str .
  343. .It Ic stdin_str Ar string
  344. String that will be written into the command's standard input. Mutually exclusive with
  345. .Em stdin .
  346. .It Ic stdout Ar string
  347. Path to the file where the command's standard output if written.
  348. .It Cm type Ar array
  349. Array of strings. Possible types are:
  350. .Bl -dash -compact
  351. .It
  352. challenge-dns-01
  353. .It
  354. challenge-dns-01-clean
  355. .It
  356. challenge-http-01
  357. .It
  358. challenge-http-01-clean
  359. .It
  360. challenge-tls-alpn-01
  361. .It
  362. challenge-tls-alpn-01-clean
  363. .It
  364. file-post-create
  365. .It
  366. file-post-edit
  367. .It
  368. file-pre-create
  369. .It
  370. file-pre-edit
  371. .It
  372. post-operation
  373. .El
  374. .El
  375. .It Ic logging_facility
  376. Table where each element defines a logging facility. Possible fields and values are:
  377. .Bl -tag
  378. .It Cm output Ar string
  379. Path of the file where the log will be written. If the file does not exists, it will be created. It the file already exists, logs will be appended at the end of the file. The following special values may be specified:
  380. .Bl -dash -compact
  381. .It
  382. stderr: write the logs into the terminal's standard error stream
  383. .It
  384. stdout: write the logs into the terminal's standard stream
  385. .It
  386. syslog: write the logs into syslog using the daemon facility
  387. .El
  388. .It Cm format Ar string
  389. Log format. Possible values are:
  390. .Bl -dash -compact
  391. .It
  392. compact
  393. .It
  394. full
  395. .Aq default
  396. .It
  397. json
  398. .It
  399. pretty
  400. .El
  401. .It Cm level Ar string
  402. Log level. Possible values are:
  403. .Bl -dash -compact
  404. .It
  405. error
  406. .It
  407. warn
  408. .It
  409. info
  410. .Aq default
  411. .It
  412. debug
  413. .It
  414. trace
  415. .El
  416. .It Cm ansi Ar boolean
  417. Defines whether or not the log will use the ANSI terminal escape codes for colors and other text formatting. Default if true for terminal outputs (strerr and stdout) and false for syslog and files.
  418. .El
  419. .It Ic rate-limit
  420. Table where each element defines a HTTPS rate limit. Possible fields and values are:
  421. .Bl -tag
  422. .It Cm number Ar integer
  423. Number of requests authorized withing the time period.
  424. .It Cm period Ar string
  425. Period of time during which a maximal number of requests is authorized. The format is described in the
  426. .Sx TIME PERIODS
  427. section.
  428. .El
  429. .El
  430. .Sh CONFIGURATION FILES ORGANIZATION
  431. It is strongly recommended to split the configuration into several files, each file containing directives related to only one logical component. Ideally, those files should be prefixed using a 2 digit number and an underscore. The first digit should indicate the type of directives within the file:
  432. .Pp
  433. .Bl -tag -compact
  434. .It 0
  435. global configuration (including logging facilities)
  436. .It 1
  437. hooks and hook groups
  438. .It 2
  439. endpoints and their associated rate limits
  440. .It 3
  441. accounts
  442. .It 4
  443. certificates
  444. .El
  445. .Pp
  446. The second digit should a zero, unless a specific loading order is required.
  447. .Pp
  448. For example, the file containing the endpoint for the
  449. .Dq Example Org
  450. certificate authority should be named
  451. .Dq 20_example_org.toml .
  452. Accounts on this same certificate authority should either be named
  453. .Dq 30_example_org.toml
  454. or
  455. .Dq 30_account_name.toml .
  456. .Pp
  457. Some default and example configuration files are available in the conf-available directory. When using those files without modification, you should create a symbolic link pointing to them instead of copying them.
  458. .Pp
  459. For legal reasons, the default configuration files for certificate authorities endpoints do not accept the terms of services by default. The recommended way to accept those terms of service is to override this directive, either in a dedicated file or directly in the certificate's configuration. If a dedicated file is used, it is recommended to name it the same way as the endpoint file but with a higher second digit in the prefix (example:
  460. .Dq 21_example_org.toml
  461. ).
  462. .Sh WRITING A HOOK
  463. When requesting a certificate from a CA using ACME, there are three steps that are hard to automatize. The first one is solving challenges in order to prove the ownership of every identifier to be included: it requires to interact with the configuration of other services, hence depends on how the infrastructure works. The second one is restarting all the services that use a given certificate, for the same reason. The last one is archiving: although several default methods can be implemented, sometimes admins wants or are required to do it in a different way.
  464. .Pp
  465. In order to allow full automation of the three above steps without imposing arbitrary restrictions or methods,
  466. .Xr acmed 8
  467. uses hooks. Fundamentally, a hook is a command line template that will be called at a specific time of the process. Such an approach allows admins to use any executable script or program located on the machine to customize the process.
  468. .Pp
  469. For a given certificate, hooks are guaranteed to be called sequentially in the declaration order. It is therefore possible to have a hook that depends on another one. Nevertheless, several certificates may be renewed at the same time. Hence, hooks shall not use globing or any other action that may disrupt hooks called by a different certificate.
  470. .Pp
  471. A hook has a type that will influence both the moment it is called and the available template variables. It is possible to declare several types. In such a case, the hook will be invoked whenever one of its type request it. When called, the hook only have access to template variable for the current type. If a hook uses a template variable that does not exists for the current type it is invoked for, the variable is empty.
  472. .Pp
  473. When writing a hook, the values of
  474. .Em args ,
  475. .Em stdin ,
  476. .Em stdin_str ,
  477. .Em stdout
  478. and
  479. .Em stderr
  480. are considered as template strings whereas
  481. .Em cmd
  482. is not. The template syntax is
  483. .Em MiniJinja .
  484. See the
  485. .Sx STANDARDS
  486. section for a link to the
  487. .Em MiniJinja
  488. specifications.
  489. .Pp
  490. The available types and the associated template variable are described below.
  491. .Bl -tag
  492. .It Ic challenge-dns-01
  493. Invoked when the ownership of an identifier must be proved using the
  494. .Em dns-01
  495. challenge. The available template variables are:
  496. .Bl -tag -compact
  497. .It Cm challenge Ar string
  498. The name of the challenge type
  499. .Aq dns-01 .
  500. Mostly used in hooks with multiple types.
  501. .It Cm env Ar array
  502. Array containing all the environment variables.
  503. .It Cm identifier Ar string
  504. The identifier name whom ownership is currently being validated.
  505. .It Cm is_clean_hook Ar bool
  506. False
  507. .It Cm proof Ar string
  508. The content of the proof that must be written to a
  509. .Ql TXT
  510. entry of the DNS zone for the
  511. .Ql _acme-challenge
  512. subdomain.
  513. .El
  514. .It Ic challenge-dns-01-clean
  515. Invoked once an identifier ownership has been proven using the
  516. .Em dns-01
  517. challenge. This hook is intended to remove the proof since it is no longer required. The template variables are strictly identical to those given in the corresponding
  518. .Em challenge-dns-01
  519. hook, excepted
  520. .Em is_clean_hook
  521. which is set to
  522. .Em true .
  523. .It Ic challenge-http-01
  524. Invoked when the ownership of an identifier must be proved using the
  525. .Em http-01
  526. challenge. The available template variables are:
  527. .Bl -tag -compact
  528. .It Cm challenge Ar string
  529. The name of the challenge type
  530. .Aq http-01 .
  531. Mostly used in hooks with multiple types.
  532. .It Cm env Ar array
  533. Array containing all the environment variables.
  534. .It Cm file_name Ar string
  535. Name of the file containing the proof. This is not a full path and does not include the
  536. .Ql .well-known/acme-challenge/
  537. prefix.
  538. .It Cm identifier Ar string
  539. The identifier name whom ownership is currently being validated.
  540. .It Cm is_clean_hook Ar bool
  541. False
  542. .It Cm proof Ar string
  543. The content of the proof that must be written to
  544. .Em file_name .
  545. .El
  546. .It Ic challenge-http-01-clean
  547. Invoked once an identifier ownership has been proven using the
  548. .Em http-01
  549. challenge. This hook is intended to remove the proof since it is no longer required. The template variables are strictly identical to those given in the corresponding
  550. .Em challenge-http-01
  551. hook, excepted
  552. .Em is_clean_hook
  553. which is set to
  554. .Em true .
  555. .It Ic challenge-tls-alpn-01
  556. Invoked when the ownership of an identifier must be proved using the
  557. .Em tls-alpn-01
  558. challenge. The available template variables are:
  559. .Bl -tag -compact
  560. .It Cm challenge Ar string
  561. The name of the challenge type
  562. .Aq tls-alpn-01 .
  563. Mostly used in hooks with multiple types.
  564. .It Cm env Ar array
  565. Array containing all the environment variables.
  566. .It Cm identifier Ar string
  567. The identifier name whom ownership is currently being validated.
  568. .It Cm identifier_tls_alpn Ar string
  569. The identifier name whom ownership is currently being validated, in a form suitable for the TLS ALPN challenge.
  570. .It Cm is_clean_hook Ar bool
  571. False
  572. .It Cm proof Ar string
  573. Plain-text representation of the
  574. .Em acmeIdentifier
  575. extension that should be used in the self-signed certificate presented when a TLS connection is initiated with the
  576. .Qd acme-tls/1
  577. ALPN extension value.
  578. .Xr acmed 8
  579. will not generate the certificate itself since it can be done using
  580. .Xr tacd 8 .
  581. .It Cm raw_proof Ar string
  582. The SHA-256 digest of the key authorization, encoded using Base64 URL scheme without padding. This is intended for the use of ACMEd with a TLS-ALPN responder other than
  583. .Xr tacd 8 .
  584. .El
  585. .It Ic challenge-tls-alpn-01-clean
  586. Invoked once an identifier ownership has been proven using the
  587. .Em tls-alpn-01
  588. challenge. This hook is intended to remove the proof since it is no longer required. The template variables are strictly identical to those given in the corresponding
  589. .Em challenge-tls-alpn-01
  590. hook, excepted
  591. .Em is_clean_hook
  592. which is set to
  593. .Em true .
  594. .It Ic file-post-create
  595. Invoked
  596. .Em after
  597. a non-existent file
  598. .Em created .
  599. The available template variables are the same as those available for the
  600. .Em file-pre-create
  601. type.
  602. .It Ic file-post-edit
  603. Invoked
  604. .Em after
  605. an existent file
  606. .Em modified .
  607. The available template variables are the same as those available for the
  608. .Em file-pre-create
  609. type.
  610. .It Ic file-pre-create
  611. Invoked
  612. .Em before
  613. a non-existent file
  614. .Em created .
  615. The available template variables are:
  616. .Bl -tag -compact
  617. .It Cm env Ar array
  618. Array containing all the environment variables.
  619. .It Cm file_directory Ar string
  620. Name of the directory where the impacted file is located.
  621. .It Cm file_name Ar string
  622. Name of the impacted file.
  623. .It Cm file_path Ar string
  624. Full path to the impacted file.
  625. .El
  626. .It Ic file-pre-edit
  627. Invoked
  628. .Em before
  629. an existent file
  630. .Em modified .
  631. The available template variables are the same as those available for the
  632. .Em file-pre-create
  633. type.
  634. .It Ic post-operation
  635. Invoked at the end of the certificate request process. The available template variables are:
  636. .Bl -tag -compact
  637. .It Cm env Ar array
  638. Array containing all the environment variables.
  639. .It Cm identifiers Ar string
  640. Array containing the identifiers included in the requested certificate.
  641. .It Cm is_success Ar boolean
  642. True if the certificate request is successful.
  643. .It Cm key_type Ar string
  644. Name of the asymmetric cryptography algorithm used to generate the certificate's key pair.
  645. .It Cm status Ar string
  646. Human-readable status. If the certificate request failed, it contains the error description.
  647. .It Cm certificate_path Ar string
  648. Path to the file containing the certificate.
  649. .It Cm private_key_path Ar string
  650. Path to the file containing the private key.
  651. .El
  652. .El
  653. .Sh DEFAULT HOOKS
  654. Because many people have the same needs, ACMEd comes with a set of hooks that should serve most situations. Hook names being unique, the following names and any other name starting by those is reserved and should not be used.
  655. .Bl -tag
  656. .It Pa git
  657. This hook uses
  658. .Xr git 1
  659. to archive private keys, public keys and certificates. It is possible to customize the commit username and email by using respectively the
  660. .Ev GIT_USERNAME
  661. and
  662. .Ev GIT_EMAIL
  663. environment variables.
  664. .It Pa http-01-echo
  665. This hook is designed to solve the http-01 challenge. For this purpose, it will write the proof into
  666. .Pa {{ env.HTTP_ROOT }}/{{ identifier }}/.well-known/acme-challenge/{{ file_name }} .
  667. .Pp
  668. The web server must be configured so the file
  669. .Pa http://{{ identifier }}/.well-known/acme-challenge/{{ file_name }}
  670. can be accessed from the CA.
  671. .Pp
  672. If
  673. .Ev HTTP_ROOT
  674. is not specified, it will be set to
  675. .Pa /var/www .
  676. .It Pa tls-alpn-01-tacd-tcp
  677. This hook is designed to solve the tls-alpn-01 challenge using
  678. .Xr tacd 8 .
  679. It requires
  680. .Xr pkill 1
  681. to support the
  682. .Em -F
  683. option.
  684. .Pp
  685. .Xr tacd 8
  686. will listen on the host defined by the
  687. .Ev TACD_HOST
  688. environment variable (default is the identifier to be validated) and on the port defined by the
  689. .Ev TACD_PORT
  690. environment variable (default is 5001).
  691. .Pp
  692. .Xr tacd 8
  693. will store its pid into
  694. .Pa {{ TACD_PID_ROOT }}/tacd_{{ identifier }}.pid .
  695. If
  696. .Ev TACD_PID_ROOT
  697. is not specified, it will be set to
  698. .Pa /run .
  699. .It Pa tls-alpn-01-tacd-unix
  700. This hook is designed to solve the tls-alpn-01 challenge using
  701. .Xr tacd 8 .
  702. It requires
  703. .Xr pkill 1
  704. to support the
  705. .Em -F
  706. option.
  707. .Pp
  708. .Xr tacd 8
  709. will listen on the unix socket
  710. .Pa {{ env.TACD_SOCK_ROOT }}/tacd_{{ identifier }}.sock .
  711. If
  712. .Ev TACD_SOCK_ROOT
  713. is not specified, it will be set to
  714. .Pa /run .
  715. .Pp
  716. .Xr tacd 8
  717. will store its pid into
  718. .Pa {{ TACD_PID_ROOT }}/tacd_{{ identifier }}.pid .
  719. If
  720. .Ev TACD_PID_ROOT
  721. is not specified, it will be set to
  722. .Pa /run .
  723. .El
  724. .Sh TIME PERIODS
  725. ACMEd uses its own time period format, which is vaguely inspired by the ISO 8601 one. Periods are formatted as
  726. .Ar PM[PM...]
  727. where
  728. .Ar M
  729. is case sensitive character representing a length and
  730. .Ar P
  731. is an integer representing a multiplayer for the following length. The authorized length are:
  732. .Bl -dash -compact
  733. .It
  734. .Ar s :
  735. second
  736. .It
  737. .Ar m :
  738. minute
  739. .It
  740. .Ar h :
  741. hour
  742. .It
  743. .Ar d :
  744. day
  745. .It
  746. .Ar w :
  747. week
  748. .El
  749. The
  750. .Ar PM
  751. couples can be specified multiple times and in any order.
  752. .Pp
  753. For example,
  754. .Dq 1d42s
  755. and
  756. .Dq 40s20h4h2s
  757. both represents a period of one day and forty-two seconds.
  758. .Sh TEMPLATE FILTERS
  759. In addition the the filters provided by default by MiniJinja, ACMEd provides the following filters:
  760. .Bl -tag
  761. .It Pa rev_labels
  762. Reverts the labels of a domain name (eg:
  763. .Dq mx1.example.org
  764. becomes
  765. .Dq org.example.mx1
  766. ).
  767. .El
  768. .Sh FILES
  769. .Bl -tag
  770. .It Pa /var/lib/acmed/accounts
  771. Default accounts private and public keys directory.
  772. .It Pa /etc/acmed/acmed.toml
  773. Default
  774. .Xr acmed 8
  775. configuration file.
  776. .It Pa /var/lib/acmed/certs
  777. Default certificates and associated private keys directory.
  778. .El
  779. .Sh EXAMPLES
  780. The following example defines a typical endpoint, account and certificate for a domain, several subdomains and an IP address.
  781. .Bd -literal -offset indent
  782. [endpoint."example-name"]
  783. url = "https://acme.example.org/directory"
  784. tos_agreed = true
  785. [[account]]
  786. name = "my test account"
  787. contacts = [
  788. { mailto = "certs@exemple.net" }
  789. ]
  790. [[certificate]]
  791. endpoint = "example-name"
  792. account = "my test account"
  793. identifiers = [
  794. { dns = "exemple.net", challenge = "http-01"},
  795. { dns = "1.exemple.net", challenge = "dns-01"},
  796. { dns = "2.exemple.net", challenge = "tls-alpn-01", env.TACD_PORT="5010"},
  797. { dns = "3.exemple.net", challenge = "tls-alpn-01", env.TACD_PORT="5011"},
  798. { ip = "203.0.113.1", challenge = "http-01"},
  799. ]
  800. hooks = ["git", "http-01-echo", "tls-alpn-01-tacd-tcp", "some-dns-01-hook"]
  801. env.HTTP_ROOT = "/srv/http"
  802. .Ed
  803. .Pp
  804. It is possible to use
  805. .Xr echo 1
  806. to solve the
  807. .Em http-01
  808. challenge and
  809. .Xr rm 1
  810. to clean it.
  811. .Xr mkdir 1
  812. and
  813. .Xr chmod 1
  814. are used to prevent issues related to file access.
  815. .Bd -literal -offset indent
  816. [[hook]]
  817. name = "http-01-echo-mkdir"
  818. type = ["challenge-http-01"]
  819. cmd = "mkdir"
  820. args = [
  821. "-m", "0755",
  822. "-p", "{{ env.HTTP_ROOT | default('/var/www') }}/{{ identifier }}/.well-known/acme-challenge"
  823. ]
  824. [[hook]]
  825. name = "http-01-echo-echo"
  826. type = ["challenge-http-01"]
  827. cmd = "echo"
  828. args = ["{{ proof }}"]
  829. stdout = "{{ env.HTTP_ROOT | default('/var/www') }}/{{ identifier }}/.well-known/acme-challenge/{{ file_name }}"
  830. [[hook]]
  831. name = "http-01-echo-chmod"
  832. type = ["challenge-http-01-clean"]
  833. cmd = "chmod"
  834. args = [
  835. "a+r",
  836. "{{ env.HTTP_ROOT | default('/var/www') }}/{{ identifier }}/.well-known/acme-challenge/{{ file_name }}"
  837. ]
  838. [[hook]]
  839. name = "http-01-echo-clean"
  840. type = ["challenge-http-01-clean"]
  841. cmd = "rm"
  842. args = [
  843. "-f",
  844. "{{ env.HTTP_ROOT | default('/var/www') }}/{{ identifier }}/.well-known/acme-challenge/{{ file_name }}"
  845. ]
  846. .Ed
  847. .Pp
  848. The hooks from the previous example can be grouped in order to reduce the number of hooks to define in the certificate.
  849. .Bd -literal -offset indent
  850. [[group]]
  851. name = "http-01-echo-var-www"
  852. hooks = [
  853. "http-01-echo-mkdir",
  854. "http-01-echo-echo",
  855. "http-01-echo-chmod",
  856. "http-01-echo-clean"
  857. ]
  858. [[certificate]]
  859. # Some fields omitted
  860. hooks = ["http-01-echo"]
  861. env.HTTP_ROOT = "/srv/http"
  862. .Ed
  863. .Pp
  864. It is also possible to use
  865. .Xr sendmail 8
  866. in a hook in order to notify someone when the certificate request process is done.
  867. .Bd -literal -offset indent
  868. [[hook]]
  869. name = "email-report"
  870. type = ["post-operation"]
  871. cmd = "sendmail"
  872. args = [
  873. "-f", "noreply.certs@example.net",
  874. "contact@example.net"
  875. ]
  876. stdin_str = """Subject: Certificate renewal {{ 'succeeded' if is_success else 'failed' }} for {{ identifiers.0 }}
  877. The following certificate has {{ '' if is_success else '*not* ' }}been renewed.
  878. identifiers: {% for ident in identifiers %}{% if not loop.first %}, {% endif %}{{ ident }}{% endfor %}
  879. key type: {{ key_type }}
  880. status: {{ status }}"""
  881. .Ed
  882. .Sh SEE ALSO
  883. .Xr acmed 8 ,
  884. .Xr tacd 8
  885. .Sh STANDARDS
  886. .Bl -hyphen
  887. .It
  888. .Rs
  889. .%A Tom Preston-Werner
  890. .%D July 2018
  891. .%T TOML v0.5.0
  892. .%U https://toml.io/en/v0.5.0
  893. .Re
  894. .It
  895. .Rs
  896. .%A Armin Ronacher
  897. .%T MiniJinja
  898. .%U https://docs.rs/minijinja/latest/minijinja/syntax/index.html
  899. .Re
  900. .It
  901. .Rs
  902. .%A M. Jones
  903. .%D May 2015
  904. .%R RFC 7518
  905. .%T JSON Web Algorithms (JWA)
  906. .Re
  907. .El
  908. .Sh AUTHORS
  909. .An Rodolphe Bréard
  910. .Aq rodolphe@breard.tf