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.

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