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.

873 lines
27 KiB

5 years ago
2 months 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 rate-limit
  376. Table where each element defines a HTTPS rate limit.
  377. .Bl -tag
  378. .It Cm number Ar integer
  379. Number of requests authorized withing the time period.
  380. .It Cm period Ar string
  381. Period of time during which a maximal number of requests is authorized. The format is described in the
  382. .Sx TIME PERIODS
  383. section.
  384. .El
  385. .El
  386. .Sh CONFIGURATION FILES ORGANIZATION
  387. 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:
  388. .Pp
  389. .Bl -tag -compact
  390. .It 0
  391. global configuration
  392. .It 1
  393. hooks and hook groups
  394. .It 2
  395. endpoints and their associated rate limits
  396. .It 3
  397. accounts
  398. .It 4
  399. certificates
  400. .El
  401. .Pp
  402. The second digit should a zero, unless a specific loading order is required.
  403. .Pp
  404. For example, the file containing the endpoint for the
  405. .Dq Example Org
  406. certificate authority should be named
  407. .Dq 20_example_org.toml .
  408. Accounts on this same certificate authority should either be named
  409. .Dq 30_example_org.toml
  410. or
  411. .Dq 30_account_name.toml .
  412. .Pp
  413. 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.
  414. .Pp
  415. 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:
  416. .Dq 21_example_org.toml
  417. ).
  418. .Sh WRITING A HOOK
  419. 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.
  420. .Pp
  421. In order to allow full automation of the three above steps without imposing arbitrary restrictions or methods,
  422. .Xr acmed 8
  423. 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.
  424. .Pp
  425. 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.
  426. .Pp
  427. 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.
  428. .Pp
  429. When writing a hook, the values of
  430. .Em args ,
  431. .Em stdin ,
  432. .Em stdin_str ,
  433. .Em stdout
  434. and
  435. .Em stderr
  436. are considered as template strings whereas
  437. .Em cmd
  438. is not. The template syntax is
  439. .Em MiniJinja .
  440. See the
  441. .Sx STANDARDS
  442. section for a link to the
  443. .Em MiniJinja
  444. specifications.
  445. .Pp
  446. The available types and the associated template variable are described below.
  447. .Bl -tag
  448. .It Ic challenge-dns-01
  449. Invoked when the ownership of an identifier must be proved using the
  450. .Em dns-01
  451. challenge. The available template variables are:
  452. .Bl -tag -compact
  453. .It Cm challenge Ar string
  454. The name of the challenge type
  455. .Aq dns-01 .
  456. Mostly used in hooks with multiple types.
  457. .It Cm env Ar array
  458. Array containing all the environment variables.
  459. .It Cm identifier Ar string
  460. The identifier name whom ownership is currently being validated.
  461. .It Cm is_clean_hook Ar bool
  462. False
  463. .It Cm proof Ar string
  464. The content of the proof that must be written to a
  465. .Ql TXT
  466. entry of the DNS zone for the
  467. .Ql _acme-challenge
  468. subdomain.
  469. .El
  470. .It Ic challenge-dns-01-clean
  471. Invoked once an identifier ownership has been proven using the
  472. .Em dns-01
  473. 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
  474. .Em challenge-dns-01
  475. hook, excepted
  476. .Em is_clean_hook
  477. which is set to
  478. .Em true .
  479. .It Ic challenge-http-01
  480. Invoked when the ownership of an identifier must be proved using the
  481. .Em http-01
  482. challenge. The available template variables are:
  483. .Bl -tag -compact
  484. .It Cm challenge Ar string
  485. The name of the challenge type
  486. .Aq http-01 .
  487. Mostly used in hooks with multiple types.
  488. .It Cm env Ar array
  489. Array containing all the environment variables.
  490. .It Cm file_name Ar string
  491. Name of the file containing the proof. This is not a full path and does not include the
  492. .Ql .well-known/acme-challenge/
  493. prefix.
  494. .It Cm identifier Ar string
  495. The identifier name whom ownership is currently being validated.
  496. .It Cm is_clean_hook Ar bool
  497. False
  498. .It Cm proof Ar string
  499. The content of the proof that must be written to
  500. .Em file_name .
  501. .El
  502. .It Ic challenge-http-01-clean
  503. Invoked once an identifier ownership has been proven using the
  504. .Em http-01
  505. 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
  506. .Em challenge-http-01
  507. hook, excepted
  508. .Em is_clean_hook
  509. which is set to
  510. .Em true .
  511. .It Ic challenge-tls-alpn-01
  512. Invoked when the ownership of an identifier must be proved using the
  513. .Em tls-alpn-01
  514. challenge. The available template variables are:
  515. .Bl -tag -compact
  516. .It Cm challenge Ar string
  517. The name of the challenge type
  518. .Aq tls-alpn-01 .
  519. Mostly used in hooks with multiple types.
  520. .It Cm env Ar array
  521. Array containing all the environment variables.
  522. .It Cm identifier Ar string
  523. The identifier name whom ownership is currently being validated.
  524. .It Cm identifier_tls_alpn Ar string
  525. The identifier name whom ownership is currently being validated, in a form suitable for the TLS ALPN challenge.
  526. .It Cm is_clean_hook Ar bool
  527. False
  528. .It Cm proof Ar string
  529. Plain-text representation of the
  530. .Em acmeIdentifier
  531. extension that should be used in the self-signed certificate presented when a TLS connection is initiated with the
  532. .Qd acme-tls/1
  533. ALPN extension value.
  534. .Xr acmed 8
  535. will not generate the certificate itself since it can be done using
  536. .Xr tacd 8 .
  537. .It Cm raw_proof Ar string
  538. 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
  539. .Xr tacd 8 .
  540. .El
  541. .It Ic challenge-tls-alpn-01-clean
  542. Invoked once an identifier ownership has been proven using the
  543. .Em tls-alpn-01
  544. 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
  545. .Em challenge-tls-alpn-01
  546. hook, excepted
  547. .Em is_clean_hook
  548. which is set to
  549. .Em true .
  550. .It Ic file-post-create
  551. Invoked
  552. .Em after
  553. a non-existent file
  554. .Em created .
  555. The available template variables are the same as those available for the
  556. .Em file-pre-create
  557. type.
  558. .It Ic file-post-edit
  559. Invoked
  560. .Em after
  561. an existent file
  562. .Em modified .
  563. The available template variables are the same as those available for the
  564. .Em file-pre-create
  565. type.
  566. .It Ic file-pre-create
  567. Invoked
  568. .Em before
  569. a non-existent file
  570. .Em created .
  571. The available template variables are:
  572. .Bl -tag -compact
  573. .It Cm env Ar array
  574. Array containing all the environment variables.
  575. .It Cm file_directory Ar string
  576. Name of the directory where the impacted file is located.
  577. .It Cm file_name Ar string
  578. Name of the impacted file.
  579. .It Cm file_path Ar string
  580. Full path to the impacted file.
  581. .El
  582. .It Ic file-pre-edit
  583. Invoked
  584. .Em before
  585. an existent file
  586. .Em modified .
  587. The available template variables are the same as those available for the
  588. .Em file-pre-create
  589. type.
  590. .It Ic post-operation
  591. Invoked at the end of the certificate request process. The available template variables are:
  592. .Bl -tag -compact
  593. .It Cm env Ar array
  594. Array containing all the environment variables.
  595. .It Cm identifiers Ar string
  596. Array containing the identifiers included in the requested certificate.
  597. .It Cm is_success Ar boolean
  598. True if the certificate request is successful.
  599. .It Cm key_type Ar string
  600. Name of the asymmetric cryptography algorithm used to generate the certificate's key pair.
  601. .It Cm status Ar string
  602. Human-readable status. If the certificate request failed, it contains the error description.
  603. .It Cm certificate_path Ar string
  604. Path to the file containing the certificate.
  605. .It Cm private_key_path Ar string
  606. Path to the file containing the private key.
  607. .El
  608. .El
  609. .Sh DEFAULT HOOKS
  610. 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.
  611. .Bl -tag
  612. .It Pa git
  613. This hook uses
  614. .Xr git 1
  615. to archive private keys, public keys and certificates. It is possible to customize the commit username and email by using respectively the
  616. .Ev GIT_USERNAME
  617. and
  618. .Ev GIT_EMAIL
  619. environment variables.
  620. .It Pa http-01-echo
  621. This hook is designed to solve the http-01 challenge. For this purpose, it will write the proof into
  622. .Pa {{ env.HTTP_ROOT }}/{{ identifier }}/.well-known/acme-challenge/{{ file_name }} .
  623. .Pp
  624. The web server must be configured so the file
  625. .Pa http://{{ identifier }}/.well-known/acme-challenge/{{ file_name }}
  626. can be accessed from the CA.
  627. .Pp
  628. If
  629. .Ev HTTP_ROOT
  630. is not specified, it will be set to
  631. .Pa /var/www .
  632. .It Pa tls-alpn-01-tacd-tcp
  633. This hook is designed to solve the tls-alpn-01 challenge using
  634. .Xr tacd 8 .
  635. It requires
  636. .Xr pkill 1
  637. to support the
  638. .Em -F
  639. option.
  640. .Pp
  641. .Xr tacd 8
  642. will listen on the host defined by the
  643. .Ev TACD_HOST
  644. environment variable (default is the identifier to be validated) and on the port defined by the
  645. .Ev TACD_PORT
  646. environment variable (default is 5001).
  647. .Pp
  648. .Xr tacd 8
  649. will store its pid into
  650. .Pa {{ TACD_PID_ROOT }}/tacd_{{ identifier }}.pid .
  651. If
  652. .Ev TACD_PID_ROOT
  653. is not specified, it will be set to
  654. .Pa /run .
  655. .It Pa tls-alpn-01-tacd-unix
  656. This hook is designed to solve the tls-alpn-01 challenge using
  657. .Xr tacd 8 .
  658. It requires
  659. .Xr pkill 1
  660. to support the
  661. .Em -F
  662. option.
  663. .Pp
  664. .Xr tacd 8
  665. will listen on the unix socket
  666. .Pa {{ env.TACD_SOCK_ROOT }}/tacd_{{ identifier }}.sock .
  667. If
  668. .Ev TACD_SOCK_ROOT
  669. is not specified, it will be set to
  670. .Pa /run .
  671. .Pp
  672. .Xr tacd 8
  673. will store its pid into
  674. .Pa {{ TACD_PID_ROOT }}/tacd_{{ identifier }}.pid .
  675. If
  676. .Ev TACD_PID_ROOT
  677. is not specified, it will be set to
  678. .Pa /run .
  679. .El
  680. .Sh TIME PERIODS
  681. ACMEd uses its own time period format, which is vaguely inspired by the ISO 8601 one. Periods are formatted as
  682. .Ar PM[PM...]
  683. where
  684. .Ar M
  685. is case sensitive character representing a length and
  686. .Ar P
  687. is an integer representing a multiplayer for the following length. The authorized length are:
  688. .Bl -dash -compact
  689. .It
  690. .Ar s :
  691. second
  692. .It
  693. .Ar m :
  694. minute
  695. .It
  696. .Ar h :
  697. hour
  698. .It
  699. .Ar d :
  700. day
  701. .It
  702. .Ar w :
  703. week
  704. .El
  705. The
  706. .Ar PM
  707. couples can be specified multiple times and in any order.
  708. .Pp
  709. For example,
  710. .Dq 1d42s
  711. and
  712. .Dq 40s20h4h2s
  713. both represents a period of one day and forty-two seconds.
  714. .Sh TEMPLATE FILTERS
  715. In addition the the filters provided by default by MiniJinja, ACMEd provides the following filters:
  716. .Bl -tag
  717. .It Pa rev_labels
  718. Reverts the labels of a domain name (eg:
  719. .Dq mx1.example.org
  720. becomes
  721. .Dq org.example.mx1
  722. ).
  723. .El
  724. .Sh FILES
  725. .Bl -tag
  726. .It Pa /var/lib/acmed/accounts
  727. Default accounts private and public keys directory.
  728. .It Pa /etc/acmed/acmed.toml
  729. Default
  730. .Xr acmed 8
  731. configuration file.
  732. .It Pa /var/lib/acmed/certs
  733. Default certificates and associated private keys directory.
  734. .El
  735. .Sh EXAMPLES
  736. The following example defines a typical endpoint, account and certificate for a domain, several subdomains and an IP address.
  737. .Bd -literal -offset indent
  738. [endpoint."example-name"]
  739. url = "https://acme.example.org/directory"
  740. tos_agreed = true
  741. [[account]]
  742. name = "my test account"
  743. contacts = [
  744. { mailto = "certs@exemple.net" }
  745. ]
  746. [[certificate]]
  747. endpoint = "example-name"
  748. account = "my test account"
  749. identifiers = [
  750. { dns = "exemple.net", challenge = "http-01"},
  751. { dns = "1.exemple.net", challenge = "dns-01"},
  752. { dns = "2.exemple.net", challenge = "tls-alpn-01", env.TACD_PORT="5010"},
  753. { dns = "3.exemple.net", challenge = "tls-alpn-01", env.TACD_PORT="5011"},
  754. { ip = "203.0.113.1", challenge = "http-01"},
  755. ]
  756. hooks = ["git", "http-01-echo", "tls-alpn-01-tacd-tcp", "some-dns-01-hook"]
  757. env.HTTP_ROOT = "/srv/http"
  758. .Ed
  759. .Pp
  760. It is possible to use
  761. .Xr echo 1
  762. to solve the
  763. .Em http-01
  764. challenge and
  765. .Xr rm 1
  766. to clean it.
  767. .Xr mkdir 1
  768. and
  769. .Xr chmod 1
  770. are used to prevent issues related to file access.
  771. .Bd -literal -offset indent
  772. [[hook]]
  773. name = "http-01-echo-mkdir"
  774. type = ["challenge-http-01"]
  775. cmd = "mkdir"
  776. args = [
  777. "-m", "0755",
  778. "-p", "{{ env.HTTP_ROOT | default('/var/www') }}/{{ identifier }}/.well-known/acme-challenge"
  779. ]
  780. [[hook]]
  781. name = "http-01-echo-echo"
  782. type = ["challenge-http-01"]
  783. cmd = "echo"
  784. args = ["{{ proof }}"]
  785. stdout = "{{ env.HTTP_ROOT | default('/var/www') }}/{{ identifier }}/.well-known/acme-challenge/{{ file_name }}"
  786. [[hook]]
  787. name = "http-01-echo-chmod"
  788. type = ["challenge-http-01-clean"]
  789. cmd = "chmod"
  790. args = [
  791. "a+r",
  792. "{{ env.HTTP_ROOT | default('/var/www') }}/{{ identifier }}/.well-known/acme-challenge/{{ file_name }}"
  793. ]
  794. [[hook]]
  795. name = "http-01-echo-clean"
  796. type = ["challenge-http-01-clean"]
  797. cmd = "rm"
  798. args = [
  799. "-f",
  800. "{{ env.HTTP_ROOT | default('/var/www') }}/{{ identifier }}/.well-known/acme-challenge/{{ file_name }}"
  801. ]
  802. .Ed
  803. .Pp
  804. The hooks from the previous example can be grouped in order to reduce the number of hooks to define in the certificate.
  805. .Bd -literal -offset indent
  806. [[group]]
  807. name = "http-01-echo-var-www"
  808. hooks = [
  809. "http-01-echo-mkdir",
  810. "http-01-echo-echo",
  811. "http-01-echo-chmod",
  812. "http-01-echo-clean"
  813. ]
  814. [[certificate]]
  815. # Some fields omitted
  816. hooks = ["http-01-echo"]
  817. env.HTTP_ROOT = "/srv/http"
  818. .Ed
  819. .Pp
  820. It is also possible to use
  821. .Xr sendmail 8
  822. in a hook in order to notify someone when the certificate request process is done.
  823. .Bd -literal -offset indent
  824. [[hook]]
  825. name = "email-report"
  826. type = ["post-operation"]
  827. cmd = "sendmail"
  828. args = [
  829. "-f", "noreply.certs@example.net",
  830. "contact@example.net"
  831. ]
  832. stdin_str = """Subject: Certificate renewal {{ 'succeeded' if is_success else 'failed' }} for {{ identifiers.0 }}
  833. The following certificate has {{ '' if is_success else '*not* ' }}been renewed.
  834. identifiers: {% for ident in identifiers %}{% if not loop.first %}, {% endif %}{{ ident }}{% endfor %}
  835. key type: {{ key_type }}
  836. status: {{ status }}"""
  837. .Ed
  838. .Sh SEE ALSO
  839. .Xr acmed 8 ,
  840. .Xr tacd 8
  841. .Sh STANDARDS
  842. .Bl -hyphen
  843. .It
  844. .Rs
  845. .%A Tom Preston-Werner
  846. .%D July 2018
  847. .%T TOML v0.5.0
  848. .%U https://toml.io/en/v0.5.0
  849. .Re
  850. .It
  851. .Rs
  852. .%A Armin Ronacher
  853. .%T MiniJinja
  854. .%U https://docs.rs/minijinja/latest/minijinja/syntax/index.html
  855. .Re
  856. .It
  857. .Rs
  858. .%A M. Jones
  859. .%D May 2015
  860. .%R RFC 7518
  861. .%T JSON Web Algorithms (JWA)
  862. .Re
  863. .El
  864. .Sh AUTHORS
  865. .An Rodolphe Bréard
  866. .Aq rodolphe@breard.tf