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.

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