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.

714 lines
22 KiB

5 years ago
4 years 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 August 27, 2020
  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 include
  22. Array containing the path to configuration file to include. The path can be either relative or absolute. If relative, it is relative to the configuration file which included it.
  23. .Pp
  24. In case or overlapping global option definition, the one of the last included file will be used. For example, if a file
  25. .Em A
  26. includes files
  27. .Em B
  28. and
  29. .Em C
  30. and all three defines the same global option, the final value will be the one defined in file
  31. .Em C .
  32. .Pp
  33. Unix style globing is supported.
  34. .It Ic global
  35. Table containing the global configuration options.
  36. .Bl -tag
  37. .It Cm accounts_directory Ar string
  38. Specify the directory where the accounts private and public keys are stored.
  39. .It Cm certificates_directory Ar string
  40. Specify the directory where the certificates and their associated private keys are stored.
  41. .It Cm cert_file_mode Ar integer
  42. Specify the permissions to use for newly-created certificates files. See
  43. .Xr chmod 2
  44. for more details.
  45. .It Cm cert_file_user Ar username|user_id Ft string
  46. Specify the user who will own newly-created certificates files. See
  47. .Xr chown 2
  48. for more details.
  49. .It Cm cert_file_group Ar group_name|group_id Ft string
  50. Specify the group who will own newly-created certificates files. See
  51. .Xr chown 2
  52. for more details.
  53. .It Ic env Ar table
  54. Table of environment variables that will be accessible from hooks.
  55. .It Cm pk_file_mode Ar integer
  56. Specify the permissions to use for newly-created private-key files. See
  57. .Xr chmod 2
  58. for more details.
  59. .It Cm pk_file_user Ar username|user_id Ft string
  60. Specify the user who will own newly-created private-key files. See
  61. .Xr chown 2
  62. for more details.
  63. .It Cm pk_file_group Ar group_name|group_id Ft string
  64. Specify the group who will own newly-created private-key files. See
  65. .Xr chown 2
  66. for more details.
  67. .It Cm renew_delay Ar string
  68. Period of time between the certificate renewal and its expiration date. The format is described in the
  69. .Sx TIME PERIODS
  70. section. Default is 3w.
  71. .El
  72. .It Ic rate-limit
  73. Array of table where each element defines a HTTPS rate limit.
  74. .Bl -tag
  75. .It Cm name Ar string
  76. The name the rate limit is registered under. Must be unique.
  77. .It Cm number Ar integer
  78. Number of requests authorized withing the time period.
  79. .It Cm period Ar string
  80. Period of time during which a maximal number of requests is authorized. The format is described in the
  81. .Sx TIME PERIODS
  82. section.
  83. .El
  84. .It Ic endpoint
  85. Array of table where each element defines a Certificate Authority
  86. .Pq CA
  87. which may be used to request certificates.
  88. .Bl -tag
  89. .It Cm name Ar string
  90. The name the endpoint is registered under. Must be unique.
  91. .It Cm rate_limits Ar array
  92. Array containing the names of the HTTPS rate limits to apply.
  93. .It Cm tos_agreed Ar boolean
  94. Set whether or not the user agrees to the Terms Of Service
  95. .Pq TOS .
  96. .It Cm url Ar string
  97. The endpoint's directory URL.
  98. .It Cm renew_delay Ar string
  99. Period of time between the certificate renewal and its expiration date. The format is described in the
  100. .Sx TIME PERIODS
  101. section. Default is the value defined in the global section.
  102. .El
  103. .It Ic hook
  104. Array of table where each element defines a command that will be launched at a defined point. See section
  105. .Sx WRITING A HOOK
  106. for more details.
  107. .Bl -tag
  108. .It Cm allow_failure Ar boolean
  109. 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.
  110. .It Cm name Ar string
  111. The name the hook is registered under. Must be unique.
  112. .It Cm type Ar array
  113. Array of strings. Possible types are:
  114. .Bl -dash -compact
  115. .It
  116. challenge-http-01
  117. .It
  118. challenge-http-01-clean
  119. .It
  120. challenge-dns-01
  121. .It
  122. challenge-dns-01-clean
  123. .It
  124. challenge-tls-alpn-01
  125. .It
  126. challenge-tls-alpn-01-clean
  127. .It
  128. file-pre-create
  129. .It
  130. file-pre-edit
  131. .It
  132. file-post-create
  133. .It
  134. file-post-edit
  135. .It
  136. post-operation
  137. .El
  138. .It Ic cmd Ar string
  139. The name of the command that will be launched.
  140. .It Ic args Ar array
  141. Array of strings representing the command's arguments.
  142. .It Ic stdin Ar string
  143. Path to the file that will be written into the command's standard intput. Mutually exclusive with
  144. .Em stdin_str .
  145. .It Ic stdin_str Ar string
  146. String that will be written into the command's standard input. Mutually exclusive with
  147. .Em stdin .
  148. .It Ic stdout Ar string
  149. Path to the file where the command's standard output if written.
  150. .It Ic stderr Ar string
  151. Path to the file where the command's standard error output if written.
  152. .El
  153. .It Ic group
  154. Array of table allowing to group several hooks as one. A group is considered as new hook.
  155. .Bl -tag
  156. .It Cm name Ar string
  157. The name the group is registered under. This name is considered as a hook name. Must be unique.
  158. .It Cm hooks Ar array
  159. Array containing the names of the hooks that are grouped. The hooks are guaranteed to be called sequentially in the declaration order.
  160. .El
  161. .It Ic account
  162. Array of table representing an account on one or several endpoint.
  163. .Bl -tag
  164. .It Ic name Ar string
  165. The name the account is registered under. Must be unique.
  166. .It Ic contacts Ar array
  167. 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:
  168. .Bl -tag
  169. .It Ic mailto Ar string
  170. A mailto URI as defined by
  171. .Em RFC 6068 .
  172. This URI cannot contains neither "hfields" nor more than one "addr-spec" in the "to" component.
  173. .El
  174. .It Cm key_type Ar string
  175. Name of the asymmetric cryptography algorithm used to generate the key pair. Possible values are :
  176. .Bl -dash -compact
  177. .It
  178. rsa2048
  179. .It
  180. rsa4096
  181. .It
  182. ecdsa_p256
  183. .Aq default
  184. .It
  185. ecdsa_p384
  186. .El
  187. .It Cm signature_algorithm Ar string
  188. Name of the signature algorithm used to sign the messages sent to the endpoint as defined in
  189. .Em RFC 7518 .
  190. The default value is derived from the key type. Possible values are:
  191. .Bl -dash -compact
  192. .It
  193. RS256
  194. .It
  195. ES256
  196. .It
  197. ES384
  198. .El
  199. .It Ic env Ar table
  200. Table of environment variables that will be accessible from hooks.
  201. .It Ic hooks Ar array
  202. 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.
  203. .El
  204. .It Ic certificate
  205. Array of table representing a certificate that will be requested to a CA.
  206. .Pp
  207. Note that 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.
  208. .Bl -tag
  209. .It Ic account Ar string
  210. Name of the account to use.
  211. .It Ic endpoint Ar string
  212. Name of the endpoint to use.
  213. .It Ic env Ar table
  214. Table of environment variables that will be accessible from hooks.
  215. .It Ic identifiers Ar array
  216. Array of tables listing the identifiers that should be included in the certificate along with the challenge to use for each one. The
  217. .Em dns
  218. and
  219. .Em ip
  220. fields are mutually exclusive.
  221. .Bl -tag
  222. .It Ic challenge Ar string
  223. The name of the challenge to use to prove the identifier's ownership. Possible values are:
  224. .Bl -dash -compact
  225. .It
  226. http-01
  227. .It
  228. dns-01
  229. .It
  230. tls-alpn-01
  231. .El
  232. .It Ic dns Ar string
  233. The domain name.
  234. .It Ic ip Ar string
  235. The IP address.
  236. .It Ic env Ar table
  237. Table of environment variables that will be accessible from hooks.
  238. .El
  239. .It Ic key_type Ar string
  240. Name of the asymmetric cryptography algorithm used to generate the certificate's key pair. Possible values are :
  241. .Bl -dash -compact
  242. .It
  243. rsa2048
  244. .Aq default
  245. .It
  246. rsa4096
  247. .It
  248. ecdsa_p256
  249. .It
  250. ecdsa_p384
  251. .El
  252. .It Ic csr_digest Ar string
  253. Name of the certificate's signing request digest algorithm. Possible values are :
  254. .Bl -dash -compact
  255. .It
  256. sha256
  257. .Aq default
  258. .It
  259. sha384
  260. .It
  261. sha512
  262. .El
  263. .It Ic kp_reuse Ar boolean
  264. Set whether or not the private key should be reused when renewing the certificate. Default is false.
  265. .It Ic directory Ar string
  266. Path to the directory where certificates and their associated private keys are stored.
  267. .It Ic hooks Ar array
  268. Names of hooks that will be called when requesting a new certificate. The hooks are guaranteed to be called sequentially in the declaration order.
  269. .It Cm renew_delay Ar string
  270. Period of time between the certificate renewal and its expiration date. The format is described in the
  271. .Sx TIME PERIODS
  272. section. Default is the value defined in the associated endpoint.
  273. .El
  274. .Sh WRITING A HOOK
  275. 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.
  276. .Pp
  277. In order to allow full automation of the three above steps without imposing arbitrary restrictions or methods,
  278. .Xr acmed 8
  279. 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.
  280. .Pp
  281. 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.
  282. .Pp
  283. 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.
  284. .Pp
  285. When writing a hook, the values of
  286. .Em args ,
  287. .Em stdin ,
  288. .Em stdin_str ,
  289. .Em stdout
  290. and
  291. .Em stderr
  292. are considered as template strings whereas
  293. .Em cmd
  294. is not. The template syntax is
  295. .Em Handlebars .
  296. See the
  297. .Sx STANDARDS
  298. section for a link to the
  299. .Em Handlebars
  300. specifications.
  301. .Pp
  302. The available types and the associated template variable are described below.
  303. .Bl -tag
  304. .It Ic challenge-http-01
  305. Invoked when the ownership of an identifier must be proved using the
  306. .Em http-01
  307. challenge. The available template variables are:
  308. .Bl -tag -compact
  309. .It Cm challenge Ar string
  310. The name of the challenge type
  311. .Aq http-01 .
  312. Mostly used in hooks with multiple types.
  313. .It Cm identifier Ar string
  314. The identifier name whom ownership is currently being validated.
  315. .It Cm identifier_tls_alpn Ar string
  316. The identifier name whom ownership is currently being validated, in a form suitable for the TLS ALPN challenge.
  317. .It Cm env Ar array
  318. Array containing all the environment variables.
  319. .It Cm file_name Ar string
  320. Name of the file containing the proof. This is not a full path and does not include the
  321. .Ql .well-known/acme-challenge/
  322. prefix.
  323. .It Cm is_clean_hook Ar bool
  324. False
  325. .It Cm proof Ar string
  326. The content of the proof that must be written to
  327. .Em file_name .
  328. .El
  329. .It Ic challenge-http-01-clean
  330. Invoked once an identifier ownership has been proven using the
  331. .Em http-01
  332. 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
  333. .Em challenge-http-01
  334. hook, excepted
  335. .Em is_clean_hook
  336. which is set to
  337. .Em true .
  338. .It Ic challenge-dns-01
  339. Invoked when the ownership of an identifier must be proved using the
  340. .Em dns-01
  341. challenge. The available template variables are:
  342. .Bl -tag -compact
  343. .It Cm challenge Ar string
  344. The name of the challenge type
  345. .Aq dns-01 .
  346. Mostly used in hooks with multiple types.
  347. .It Cm identifier Ar string
  348. The identifier name whom ownership is currently being validated.
  349. .It Cm identifier_tls_alpn Ar string
  350. The identifier name whom ownership is currently being validated, in a form suitable for the TLS ALPN challenge.
  351. .It Cm env Ar array
  352. Array containing all the environment variables.
  353. .It Cm is_clean_hook Ar bool
  354. False
  355. .It Cm proof Ar string
  356. The content of the proof that must be written to a
  357. .Ql TXT
  358. entry of the DNS zone for the
  359. .Ql _acme-challenge
  360. subdomain.
  361. .El
  362. .It Ic challenge-dns-01-clean
  363. Invoked once an identifier ownership has been proven using the
  364. .Em dns-01
  365. 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
  366. .Em challenge-dns-01
  367. hook, excepted
  368. .Em is_clean_hook
  369. which is set to
  370. .Em true .
  371. .It Ic challenge-tls-alpn-01
  372. Invoked when the ownership of an identifier must be proved using the
  373. .Em tls-alpn-01
  374. challenge. The available template variables are:
  375. .Bl -tag -compact
  376. .It Cm challenge Ar string
  377. The name of the challenge type
  378. .Aq tls-alpn-01 .
  379. Mostly used in hooks with multiple types.
  380. .It Cm identifier Ar string
  381. The identifier name whom ownership is currently being validated.
  382. .It Cm identifier_tls_alpn Ar string
  383. The identifier name whom ownership is currently being validated, in a form suitable for the TLS ALPN challenge.
  384. .It Cm env Ar array
  385. Array containing all the environment variables.
  386. .It Cm is_clean_hook Ar bool
  387. False
  388. .It Cm proof Ar string
  389. Plain-text representation of the
  390. .Em acmeIdentifier
  391. extension that should be used in the self-signed certificate presented when a TLS connection is initiated with the
  392. .Qd acme-tls/1
  393. ALPN extension value.
  394. .Xr acmed 8
  395. will not generate the certificate itself since it can be done using
  396. .Xr tacd 8 .
  397. .El
  398. .It Ic challenge-tls-alpn-01-clean
  399. Invoked once an identifier ownership has been proven using the
  400. .Em tls-alpn-01
  401. 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
  402. .Em challenge-tls-alpn-01
  403. hook, excepted
  404. .Em is_clean_hook
  405. which is set to
  406. .Em true .
  407. .It Ic file-pre-create
  408. Invoked
  409. .Em before
  410. a non-existent file
  411. .Em created .
  412. The available template variables are:
  413. .Bl -tag -compact
  414. .It Cm env Ar array
  415. Array containing all the environment variables.
  416. .It Cm file_directory Ar string
  417. Name of the directory where the impacted file is located.
  418. .It Cm file_name Ar string
  419. Name of the impacted file.
  420. .It Cm file_path Ar string
  421. Full path to the impacted file.
  422. .El
  423. .It Ic file-pre-edit
  424. Invoked
  425. .Em before
  426. an existent file
  427. .Em modified .
  428. The available template variables are the same as those available for the
  429. .Em file-pre-create
  430. type.
  431. .It Ic file-post-create
  432. Invoked
  433. .Em after
  434. a non-existent file
  435. .Em created .
  436. The available template variables are the same as those available for the
  437. .Em file-pre-create
  438. type.
  439. .It Ic file-post-edit
  440. Invoked
  441. .Em after
  442. an existent file
  443. .Em modified .
  444. The available template variables are the same as those available for the
  445. .Em file-pre-create
  446. type.
  447. .It Ic post-operation
  448. Invoked at the end of the certificate request process. The available template variables are:
  449. .Bl -tag -compact
  450. .It Cm key_type Ar string
  451. Name of the asymmetric cryptography algorithm used to generate the certificate's key pair.
  452. .It Cm identifiers Ar string
  453. Array containing the identifiers included in the requested certificate.
  454. .It Cm env Ar array
  455. Array containing all the environment variables.
  456. .It Cm is_success Ar boolean
  457. True if the certificate request is successful.
  458. .It Cm status Ar string
  459. Human-readable status. If the certificate request failed, it contains the error description.
  460. .El
  461. .El
  462. .Sh DEFAULT HOOKS
  463. 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.
  464. .Bl -tag
  465. .It Pa git
  466. This hook uses
  467. .Xr git 1
  468. to archive private keys, public keys and certificates. It is possible to customize the commit username and email by using respectively the
  469. .Ev GIT_USERNAME
  470. and
  471. .Ev GIT_EMAIL
  472. environment variables.
  473. .It Pa http-01-echo
  474. This hook is designed to solve the http-01 challenge. For this purpose, it will write the proof into
  475. .Pa {{env.HTTP_ROOT}}/{{identifier}}/.well-known/acme-challenge/{{file_name}} .
  476. .Pp
  477. The web server must be configured so the file
  478. .Pa http://{{identifier}}/.well-known/acme-challenge/{{file_name}}
  479. can be accessed from the CA.
  480. .Pp
  481. If
  482. .Ev HTTP_ROOT
  483. is not specified, it will be set to
  484. .Pa /var/www .
  485. .It Pa tls-alpn-01-tacd-tcp
  486. This hook is designed to solve the tls-alpn-01 challenge using
  487. .Xr tacd 8 .
  488. It requires
  489. .Xr pkill 1
  490. to support the
  491. .Em Ar -F
  492. option.
  493. .Pp
  494. .Xr tacd 8
  495. will listen on the host defined by the
  496. .Ev TACD_HOST
  497. environment variable (default is the identifier to be validated) and on the port defined by the
  498. .Ev TACD_PORT
  499. environment variable (default is 5001).
  500. .Pp
  501. .Xr tacd 8
  502. will store its pid into
  503. .Pa {{TACD_PID_ROOT}}/tacd_{{identifier}}.pid .
  504. If
  505. .Ev TACD_PID_ROOT
  506. is not specified, it will be set to
  507. .Pa /run .
  508. .It Pa tls-alpn-01-tacd-unix
  509. This hook is designed to solve the tls-alpn-01 challenge using
  510. .Xr tacd 8 .
  511. It requires
  512. .Xr pkill 1
  513. to support the
  514. .Em Ar -F
  515. option.
  516. .Pp
  517. .Xr tacd 8
  518. will listen on the unix socket
  519. .Pa {{env.TACD_SOCK_ROOT}}/tacd_{{identifier}}.sock .
  520. If
  521. .Ev TACD_SOCK_ROOT
  522. is not specified, it will be set to
  523. .Pa /run .
  524. .Pp
  525. .Xr tacd 8
  526. will store its pid into
  527. .Pa {{TACD_PID_ROOT}}/tacd_{{identifier}}.pid .
  528. If
  529. .Ev TACD_PID_ROOT
  530. is not specified, it will be set to
  531. .Pa /run .
  532. .El
  533. .Sh TIME PERIODS
  534. ACMEd uses its own time period format, which is vaguely inspired by the ISO 8601 one. Periods are formatted as
  535. .Ar PM[PM...]
  536. where
  537. .Ar M
  538. is case sensitive character representing a length and
  539. .Ar P
  540. is an integer representing a multiplayer for the following length. The authorized length are:
  541. .Bl -dash -compact
  542. .It
  543. .Ar s :
  544. second
  545. .It
  546. .Ar m :
  547. minute
  548. .It
  549. .Ar h :
  550. hour
  551. .It
  552. .Ar d :
  553. day
  554. .It
  555. .Ar w :
  556. week
  557. .El
  558. The
  559. .Ar PM
  560. couples can be specified multiple times and in any order.
  561. .Pp
  562. For example,
  563. .Dq 1d42s and
  564. .Dq 40s20h4h2s
  565. both represents a period of one day and forty-two seconds.
  566. .Sh FILES
  567. .Bl -tag
  568. .It Pa /etc/acmed/acmed.toml
  569. Default
  570. .Xr acmed 8
  571. configuration file.
  572. .It Pa /etc/acmed/accounts
  573. Default accounts private and public keys directory.
  574. .It Pa /etc/acmed/certs
  575. Default certificates and associated private keys directory.
  576. .Sh EXAMPLES
  577. The following example defines a typical endpoint, account and certificate for a domain, several subdomains and an IP address.
  578. .Bd -literal -offset indent
  579. [[endpoint]]
  580. name = "example name"
  581. url = "https://acme.example.org/directory"
  582. tos_agreed = true
  583. [[account]]
  584. name = "my test account"
  585. email = "certs@exemple.net"
  586. [[certificate]]
  587. endpoint = "example name"
  588. account = "my test account"
  589. identifiers = [
  590. { dns = "exemple.net", challenge = "http-01"},
  591. { dns = "1.exemple.net", challenge = "dns-01"},
  592. { dns = "2.exemple.net", challenge = "tls-alpn-01", env.TACD_PORT="5010"},
  593. { dns = "3.exemple.net", challenge = "tls-alpn-01", env.TACD_PORT="5011"},
  594. { ip = "203.0.113.1", challenge = "http-01"},
  595. ]
  596. hooks = ["git", "http-01-echo", "tls-alpn-01-tacd-tcp", "some-dns-01-hook"]
  597. env.HTTP_ROOT = "/srv/http"
  598. .Ed
  599. .Pp
  600. It is possible to use
  601. .Xr echo 1
  602. to solve the
  603. .Em http-01
  604. challenge and
  605. .Xr rm 1
  606. to clean it.
  607. .Xr mkdir 1
  608. and
  609. .Xr chmod 1
  610. are used to prevent issues related to file access.
  611. .Bd -literal -offset indent
  612. [[hook]]
  613. name = "http-01-echo-mkdir"
  614. type = ["challenge-http-01"]
  615. cmd = "mkdir"
  616. args = [
  617. "-m", "0755",
  618. "-p", "{{%if env.HTTP_ROOT}}{{env.HTTP_ROOT}}{{else}}/var/www{{/if}}/{{identifier}}/.well-known/acme-challenge"
  619. ]
  620. [[hook]]
  621. name = "http-01-echo-echo"
  622. type = ["challenge-http-01"]
  623. cmd = "echo"
  624. args = ["{{proof}}"]
  625. stdout = "{{%if env.HTTP_ROOT}}{{env.HTTP_ROOT}}{{else}}/var/www{{/if}}/{{identifier}}/.well-known/acme-challenge/{{file_name}}"
  626. [[hook]]
  627. name = "http-01-echo-chmod"
  628. type = ["challenge-http-01-clean"]
  629. cmd = "chmod"
  630. args = [
  631. "a+r",
  632. "{{%if env.HTTP_ROOT}}{{env.HTTP_ROOT}}{{else}}/var/www{{/if}}/{{identifier}}/.well-known/acme-challenge/{{file_name}}"
  633. ]
  634. [[hook]]
  635. name = "http-01-echo-clean"
  636. type = ["challenge-http-01-clean"]
  637. cmd = "rm"
  638. args = [
  639. "-f",
  640. "{{%if env.HTTP_ROOT}}{{env.HTTP_ROOT}}{{else}}/var/www{{/if}}/{{identifier}}/.well-known/acme-challenge/{{file_name}}"
  641. ]
  642. .Ed
  643. .Pp
  644. The hooks from the previous example can be grouped in order to reduce the number of hooks to define in the certificate.
  645. .Bd -literal -offset indent
  646. [[group]]
  647. name = "http-01-echo-var-www"
  648. hooks = [
  649. "http-01-echo-mkdir",
  650. "http-01-echo-echo",
  651. "http-01-echo-chmod",
  652. "http-01-echo-clean"
  653. ]
  654. [[certificate]]
  655. # Some fields omitted
  656. hooks = ["http-01-echo"]
  657. env.HTTP_ROOT = "/srv/http"
  658. .Ed
  659. .Pp
  660. It is also possible to use
  661. .Xr sendmail 8
  662. in a hook in order to notif someone when the certificate request process is done.
  663. .Bd -literal -offset indent
  664. [[hook]]
  665. name = "email-report"
  666. type = ["post-operation"]
  667. cmd = "sendmail"
  668. args = [
  669. "-f", "noreply.certs@example.net",
  670. "contact@example.net"
  671. ]
  672. stdin_str = """Subject: Certificate renewal {{#if is_success}}succeeded{{else}}failed{{/if}} for {{identifiers.[0]}}
  673. The following certificate has {{#unless is_success}}*not* {{/unless}}been renewed.
  674. identifiers: {{#each identifiers}}{{#if @index}}, {{/if}}{{this}}{{/each}}
  675. key type: {{key_type}}
  676. status: {{status}}"""
  677. .Ed
  678. .Sh SEE ALSO
  679. .Xr acmed 8 ,
  680. .Xr tacd 8
  681. .Sh STANDARDS
  682. .Bl
  683. .It
  684. .Rs
  685. .%A Tom Preston-Werner
  686. .%D July 2018
  687. .%T TOML v0.5.0
  688. .%U https://github.com/toml-lang/toml
  689. .Re
  690. .It
  691. .Rs
  692. .%A Yehuda Katz
  693. .%T Handlebars
  694. .%U https://handlebarsjs.com/
  695. .Re
  696. .It
  697. .Rs
  698. .%A M. Jones
  699. .%D May 2015
  700. .%R RFC 7518
  701. .%T JSON Web Algorithms (JWA)
  702. .Re
  703. .El
  704. .Sh AUTHORS
  705. .An Rodolphe Bréard
  706. .Aq rodolphe@breard.tf