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.

230 lines
14 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. [//]: # (Copyright 2019-2020 Rodolphe Bréard <rodolphe@breard.tf>)
  2. [//]: # (Copying and distribution of this file, with or without modification,)
  3. [//]: # (are permitted in any medium without royalty provided the copyright)
  4. [//]: # (notice and this notice are preserved. This file is offered as-is,)
  5. [//]: # (without any warranty.)
  6. # ACMEd
  7. [![Build Status](https://github.com/breard-r/acmed/actions/workflows/ci.yml/badge.svg)](https://github.com/breard-r/acmed/actions/workflows/ci.yml)
  8. ![License MIT OR Apache 2.0](https://img.shields.io/badge/license-MIT%20OR%20Apache--2.0-blue)
  9. The Automatic Certificate Management Environment (ACME), is an internet standard ([RFC 8555](https://tools.ietf.org/html/rfc8555)) which allows to automate X.509 certificates signing by a Certification Authority (CA). ACMEd is one of the many clients for this protocol.
  10. ## Key features
  11. - http-01, dns-01 and [tls-alpn-01](https://tools.ietf.org/html/rfc8737) challenges
  12. - IP identifier validation extension [RFC 8738](https://tools.ietf.org/html/rfc8738)
  13. - RSA 2048, RSA 4096, ECDSA P-256, ECDSA P-384, ECDSA P-521, Ed25519 and Ed448 certificates and account keys
  14. - Internationalized domain names support
  15. - Fully customizable challenge validation action
  16. - Fully customizable archiving method (yes, you can use git or anything else)
  17. - Nice and simple configuration file
  18. - A pre-built set of hooks that can be used in most circumstances
  19. - Run as a deamon: no need to set-up timers, crontab or other time-triggered process
  20. - Retry of HTTPS request rejected with a badNonce or other recoverable errors
  21. - Customizable HTTPS requests rate limits
  22. - External account binding
  23. - Optional key pair reuse (useful for [HPKP](https://en.wikipedia.org/wiki/HTTP_Public_Key_Pinning))
  24. - For a given certificate, each domain name may be validated using a different challenge
  25. - A standalone server dedicated to the tls-alpn-01 challenge validation (tacd)
  26. ## Planned features
  27. - STAR certificates [RFC 8739](https://tools.ietf.org/html/rfc8739)
  28. - Daemon and certificates management via the `acmectl` tool
  29. - HTTP/2 support
  30. ## Project status
  31. This project is usable, but is still a work in progress. Each release should works well and accordingly to its documentation.
  32. Because the API has not been stabilized yet, breaking changes may occur. Therefore, before any upgrade, you are invited to read the [CHANGELOG](CHANGELOG.md) and check if any change can break your setup.
  33. Please keep in mind this software has neither been subject to a peer review nor to a security audit.
  34. ## Documentation
  35. The [wiki](https://github.com/breard-r/acmed/wiki) will provides you with an overview as well as guides. You may contribute to it by creating a PR on the [acmed-wiki](https://github.com/breard-r/acmed-wiki) repository.
  36. For exhaustive references, the following man pages are available:
  37. - acmed (8)
  38. - acmed.toml (5)
  39. - tacd (8)
  40. An easy way to read those pages without installing ACMEd is to downloads and pipe them to the man utility:
  41. ```
  42. curl -sSf "https://raw.githubusercontent.com/breard-r/acmed/main/man/en/acmed.8" | man -l -
  43. curl -sSf "https://raw.githubusercontent.com/breard-r/acmed/main/man/en/acmed.toml.5" | man -l -
  44. curl -sSf "https://raw.githubusercontent.com/breard-r/acmed/main/man/en/tacd.8" | man -l -
  45. ```
  46. Alternatively, using zsh, you can use the following variants. Useful on system where man is unable to read from stdin (yes BSD, that's you).
  47. ```
  48. man =(curl -sSf "https://raw.githubusercontent.com/breard-r/acmed/main/man/en/acmed.8")
  49. man =(curl -sSf "https://raw.githubusercontent.com/breard-r/acmed/main/man/en/acmed.toml.5")
  50. man =(curl -sSf "https://raw.githubusercontent.com/breard-r/acmed/main/man/en/tacd.8")
  51. ```
  52. ## Build from source
  53. In order to compile ACMEd, you will need the [Rust](https://www.rust-lang.org/) compiler and its package manager, Cargo. The minimum supported Rust version(MSRV) is 1.74, although it is recommended to use the latest stable one.
  54. ACMEd depends OpenSSL 1.1.0 or higher.
  55. On systems based on Debian/Ubuntu, you may need to install the `libssl-dev`, `build-essential` and `pkg-config` packages.
  56. On Alpine Linux, you may need to install the `openssl-dev` and `alpine-sdk` packages.
  57. ```
  58. $ make
  59. $ make install
  60. ```
  61. To build ACMEd and tacd inside a temporary Docker container, use the `contrib/docker/build-docker.sh` helper script. It currently supports Debian Buster / Stretch.
  62. You can also build a container image for some k8s deployement, use the `contrib/docker/build-docker-image.sh` script. It supports the same targets as the build-docker.sh script.
  63. When build succeed, you can start the container with `docker run --rm -v /path/to/conf/dir:/etc/acmed acmed:buster`.
  64. ### Advanced options
  65. You can specify a space or comma separated list of features to activate in the `FEATURE` variable. The possible features are:
  66. - `openssl_dyn` (default): use OpenSSL as the cryptographic library, dynamically linked (mutually exclusive with `openssl_vendored`).
  67. - `openssl_vendored`: use OpenSSL as the cryptographic library, statically linked (mutually exclusive with `openssl_dyn`).
  68. You can also specify the [target triple](https://doc.rust-lang.org/nightly/rustc/platform-support.html) to build for in the `TARGET` variable. Please note that, if used, this variable must be specified for both `make` and `make install`.
  69. For example, you can build statically linked binaries using the `openssl_vendored` feature and the `x86_64-unknown-linux-musl` target.
  70. ```
  71. make FEATURES="openssl_vendored" TARGET="x86_64-unknown-linux-musl"
  72. ```
  73. The following environment variables can be used to change default values at compile and/or install time:
  74. - `PREFIX` (install): system user prefix (default to `/usr`)
  75. - `BINDIR` (install): system binary directory (default to `$PREFIX/bin`)
  76. - `DATADIR` (install): system data directory (default to `$PREFIX/share`)
  77. - `MAN5DIR` (install): system directory where pages 5 manuals are located (default to `$DATADIR/man/man5`)
  78. - `MAN8DIR` (install): system directory where pages 8 manuals are located (default to `$DATADIR/man/man8`)
  79. - `SYSCONFDIR` (compile and install): system configuration directory (default to `/etc`)
  80. - `VARLIBDIR` (compile and install): directory for persistent data modified by ACMEd (default to `/var/lib`)
  81. - `RUNSTATEDIR` (compile): system run-time variable data (default to `/run`)
  82. - `ACMED_DEFAULT_ACCOUNTS_DIR` (compile): directory where account files are stored (default to `$VARLIBDIR/acmed/accounts`)
  83. - `ACMED_DEFAULT_CERT_DIR` (compile): directory where certificates and private keys are stored (default to `$VARLIBDIR/acmed/certs`)
  84. - `ACMED_DEFAULT_CERT_FORMAT` (compile): format for certificates and private keys files names (default to `{ name }_{ key_type }.{ file_type }.{ ext }`)
  85. - `ACMED_DEFAULT_CONFIG_FILE` (compile): main configuration file (default to `$SYSCONFDIR/acmed/acmed.toml`)
  86. - `ACMED_DEFAULT_PID_FILE` (compile): PID file for the main acmed process (default to `$RUNSTATEDIR/acmed.pid`)
  87. - `TACD_DEFAULT_PID_FILE` (compile): PID file for the tacd process (default to `$RUNSTATEDIR/tacd.pid`)
  88. For example, the following will compile a binary that will use the `/usr/share/etc/acmed/acmed.toml` configuration file and will be installed in the `/usr/local/bin` directory :
  89. ```
  90. make SYSCONFDIR="/usr/share/etc"
  91. make BINDIR="/usr/local/bin" install
  92. ```
  93. ### Packaging
  94. Most of the time, when packaging, you want to install the program in a dedicated directory. This is possible using the `DESTDIR` variable.
  95. ```
  96. make DESTDIR="/path/to/my/package/directory" install
  97. ```
  98. Packager tip: If you package ACMEd in a way it does not run as root, you might want to create another package that provides the Polkit rule file located in the `contrib/polkit` directory. This package should depends on both acmed and Polkit.
  99. ## Frequently Asked Questions
  100. ### Why this project?
  101. After testing multiple ACME clients, I found out none of them supported all the features I expected (see the key features above). It may have been possible to contribute or fork an existing project, however I believe those project made architectural choices incompatible with what i wanted, and therefore it would be as much or less work to start a new project from scratch.
  102. ### Is it free and open-source software?
  103. Yes, ACMEd is dual-licensed under the MIT and Apache 2.0 terms. See [LICENSE-MIT.txt](LICENSE-MIT.txt) and [LICENSE-APACHE-2.0.txt](LICENSE-APACHE-2.0.txt) for details.
  104. The man pages, the default hooks configuration file, the `CHANGELOG.md` and the `README.md` files are released under the [GNU All-Permissive License](https://www.gnu.org/prep/maintain/html_node/License-Notices-for-Other-Files.html).
  105. ### Can it automatically change my server configuration?
  106. Short answer: No.
  107. Long answer: At some points in a certificate's life, ACMEd triggers some hooks in order to let you customize how some actions are done, therefore you can use those hooks to modify any server configuration you wish. However, this may not be what you are looking for since it cannot proactively detect which certificates should be emitted since ACMEd only manages certificates that have already been declared in the configuration files.
  108. ### How should I configure my TLS server?
  109. You decide. ACMEd only retrieve the certificate for you, it does not impose any specific configuration or limitation on how to use it. For the record, if you are looking for security recommendations on TLS deployment, you can follow the [ANSSI TLS guide](https://www.ssi.gouv.fr/en/guide/security-recommendations-for-tls/) (the english version might not be the latest version of this document, if possible use [the french one](https://www.ssi.gouv.fr/entreprise/guide/recommandations-de-securite-relatives-a-tls/)).
  110. ### Is it suitable for beginners?
  111. It depends on your definition of a beginner. This software is intended to be used by system administrators with a certain knowledge of their environment. Furthermore, it is also expected to know the bases of the ACME protocol. Let's Encrypt wrote a nice article about [how it works](https://letsencrypt.org/how-it-works/).
  112. ### It doesn't work!
  113. ACMEd releases do work properly. Knowing that new users tend to shoot themselves in the foot with hooks, you might want to check those before considering moving away to a different software. Files path and permissions are very common traps, you definitely want to check those.
  114. By the way, don't forget to change the log verbosity using `--log-level trace`.
  115. ### Should ACMEd run as root?
  116. Running ACMEd as root is the simplest configuration since you do not have to worry about access rights, especially within hooks (Eg: restart a service).
  117. However, if you are concerned with safety, you should create a dedicated user for ACMEd. Before doing so, please consider the following points:
  118. * Will my services be able to read both the private key and the certificate?
  119. * Will the ACMEd user be able to execute the hooks?
  120. The last one could be achieved using either sudo or Polkit (see the `contrib/polkit` directory).
  121. ### Why is there no option to run ACMEd as a specific user or group?
  122. The reason some services has such an option is because at startup they may have to load data only accessible by root, hence they have to change the user themselves after those data are loaded. For example, this is wildly used in web servers so they load a private key, which should only be accessible by root. Since ACMEd does not have such requirement, it should be run directly as the correct user.
  123. ### How can I run ACMEd with systemd?
  124. The `contrib/systemd` contains examples of a service file as well as a `sysusers.d` and a `tmpfiles.d` file. Those files might need adjustments in order to work on your system (e.g. paths, user, group,...), but it's probably a good starting point.
  125. ### Does ACMEd uses any threading or parallelization?
  126. Yes, ACMEd is [asynchronous](https://en.wikipedia.org/wiki/Asynchrony_(computer_programming)) and uses a multi-thread runtime. In order to check the number of threads, you may run the following command:
  127. ```
  128. ps -T -p "$(pgrep acmed)"
  129. ```
  130. ### Can I use the same account on different endpoints?
  131. Yes, that is possible. However, you should aware that some certificate authorities (e.g. Let's Encrypt) have policies restricting the use multiple accounts. Please check your CA's documentation.
  132. ### Why is RSA 2048 the default certificate key type?
  133. Short answer: it is sufficiently secured, has good performances and is wildly supported.
  134. Before choosing a different algorithm for your certificate's signature, you might want to consider all of those three points.
  135. * For security, you may refer to the table 2 of the [NIST SP 800-57 Part 1](https://csrc.nist.gov/publications/detail/sp/800-57-part-1/rev-5/final).
  136. * For performances, you can launch the following command on your machine: `openssl speed rsa2048 rsa3072 rsa4096 ecdsap256 ecdsap384 ecdsap521 ed25519 ed448`. Your server will be affected by the signature performances and the clients connecting to it will be affected by the verification performances.
  137. * Nowadays, every client support ECDSA. Therefore, unless you have very specific requirements, you can safely use it. At time of writing, EdDSA certificates are not yet supported, but it might become a thing in the future.
  138. Currently, security and client support aren't the main concerns since every possible type of certificates is good enough on those two points. The performances clearly favors ECDSA P-256, Ed25519 and RSA 2048. The later has been chosen as the default because it's the most wildly used as Certification Authorities root and intermediate certificates. This choice may change in favor of ECDSA since Let's Encrypt issued [a full ECDSA certificates chain](https://letsencrypt.org/2020/09/17/new-root-and-intermediates.html).
  139. ### Why is ECDSA P-256 the default account key type?
  140. RFC 8555 section 6.2 defines ECDSA P-256 as the only account key type that any ACME servers must implement. It is therefore the best choice for the default value.
  141. ### Why can I chose the CSR's digest type but not the certificate's?
  142. Well, you sign the CSR, so obviously you can chose which digest to use. However, the certificate is signed by the certificate authority, so its digest choice is up to your CA. I agree that being able to chose the CSR's digest type is of low importance, sorry if it gave you false hopes about the certificate.