• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.drone/H16-Oct-2019-

.travis/H16-Oct-2019-

_doc/H16-Oct-2019-

cli/H16-Oct-2019-

cmd/acmetool/H16-Oct-2019-

fdb/H16-Oct-2019-

hooks/H16-Oct-2019-

interaction/H16-Oct-2019-

redirector/H16-Oct-2019-

responder/H16-Oct-2019-

solver/H16-Oct-2019-

storage/H16-Oct-2019-

storageops/H16-Oct-2019-

util/H16-Oct-2019-

.drone.ymlH A D16-Oct-2019383

.gitignoreH A D16-Oct-201962

.travis.ymlH A D16-Oct-20194.2 KiB

MakefileH A D16-Oct-20192.8 KiB

README.mdH A D16-Oct-201916.5 KiB

main.goH A D16-Oct-201984

README.md

1# <div align="center"><img src="https://hlandau.github.io/acmetool/img/acmetool-logo-black.png" alt="acmetool" /></div>
2
3<p align="center"><a
4href="https://webchat.freenode.net/?channels=%23acmetool"><img
5src="https://img.shields.io/badge/webchat-freenode%20%23acmetool-blue.svg"
6alt="[webchat: freenode #acmetool]" /></a> <br/> <a
7href="https://github.com/hlandau/acme/releases"><img
8src="https://img.shields.io/github/downloads/hlandau/acme/total.svg"
9alt="[download count]" /></a> <a
10href="https://github.com/hlandau/acme/releases"><img
11src="https://img.shields.io/github/release/hlandau/acme.svg" alt="[version]"
12/></a><br/> <a
13href="https://launchpad.net/~hlandau/+archive/ubuntu/rhea/+packages"><img
14src="https://img.shields.io/badge/ppa-debian%2Fubuntu-lightgrey.svg" alt="[ppa
15debian/ubuntu]"/></a>
16<a href="https://drone.io/hlandau/acmetool"><img
17src="https://img.shields.io/drone/build/hlandau/acmetool" alt="Build Status"
18/></a></p>
19
20acmetool is an easy-to-use command line tool for automatically acquiring
21certificates from ACME servers (such as Let's Encrypt). Designed to flexibly
22integrate into your webserver setup to enable automatic verification. Unlike
23the official Let's Encrypt client, this doesn't modify your web server
24configuration.
25
26<p>:white_check_mark: Zero-downtime autorenewal<br/>
27:white_check_mark: Supports any webserver<br/>
28:white_check_mark: Fully automatable<br/>
29:white_check_mark: Single-file dependency-free binary<br/>
30:white_check_mark: Idempotent<br/>
31:white_check_mark: Fast setup</p>
32
33You can perform verifications using port 80 or 443 (if you don't yet have a
34server running on one of them); via webroot; by configuring your webserver to
35proxy requests for `/.well-known/acme-challenge/` to a special port (402) which
36acmetool can listen on; or by configuring your webserver not to listen on port
3780, and instead running acmetool's built in HTTPS redirector (and challenge
38responder) on port 80. This is useful if all you want to do with port 80 is
39redirect people to port 443.
40
41You can run acmetool on a cron job to renew certificates automatically (`acmetool --batch`).  The
42preferred certificate for a given hostname is always at
43`/var/lib/acme/live/HOSTNAME/{cert,chain,fullchain,privkey}`. You can configure
44acmetool to reload your webserver automatically when it renews a certificate.
45
46acmetool is intended to be "magic-free". All of acmetool's state is stored in a
47simple, comprehensible directory of flat files. [The schema for this directory
48is documented.](https://github.com/hlandau/acme/blob/master/_doc/SCHEMA.md)
49
50acmetool is intended to work like "make". The state directory expresses target
51domain names, and whenever acmetool is invoked, it ensures that valid
52certificates are available to meet those names. Certificates which will expire
53soon are renewed. acmetool is thus idempotent and minimises the use of state.
54
55acmetool can optionally be used [without running it as
56root.](https://hlandau.github.io/acmetool/userguide#annex-root-configured-non-root-operation) If you have
57existing certificates issued using the official client, acmetool can import
58those certificates, keys and account keys (`acmetool import-le`).
59
60acmetool supports both RSA and ECDSA keys and certificates. acmetool's
61notification hooks system allows you to write arbitrary shell scripts to be
62executed when new certificates are obtained. By default, this is used to reload
63webservers automatically, but it can also be used to distribute certificates to
64other servers or for other purposes.
65
66## Getting Started
67
68**Binary releases:** [Binary releases are available.](https://github.com/hlandau/acme/releases)
69
70Download the release appropriate for your platform and simply copy the
71`acmetool` binary to `/usr/bin`.
72
73`_cgo` releases are preferred over non-`_cgo` releases where available, but
74non-`_cgo` releases may be more compatible with older OSes.
75
76**Ubuntu users:** A binary release PPA, `ppa:hlandau/rhea` (package `acmetool`) is available.
77```bash
78$ sudo add-apt-repository ppa:hlandau/rhea
79$ sudo apt-get update
80$ sudo apt-get install acmetool
81```
82
83You can also [download .deb files manually.](https://launchpad.net/~hlandau/+archive/ubuntu/rhea/+packages)
84
85(Note: There is no difference between the .deb files for different Ubuntu release codenames; they are interchangeable and completely equivalent.)
86
87**Debian users:** The Ubuntu binary release PPA also works with Debian:
88```
89# echo 'deb http://ppa.launchpad.net/hlandau/rhea/ubuntu xenial main' > /etc/apt/sources.list.d/rhea.list
90# apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9862409EF124EC763B84972FF5AC9651EDB58DFA
91# apt-get update
92# apt-get install acmetool
93```
94
95You can also [download .deb files manually.](https://launchpad.net/~hlandau/+archive/ubuntu/rhea/+packages)
96
97(Note: There is no difference between the .deb files for different Ubuntu release codenames; they are interchangeable and completely equivalent.)
98
99**RPM-based distros:** [A copr RPM repository is available.](https://copr.fedorainfracloud.org/coprs/hlandau/acmetool/)
100
101If you have `dnf` installed:
102```bash
103$ sudo dnf copr enable hlandau/acmetool
104$ sudo dnf install acmetool
105```
106
107Otherwise use the `.repo` files on the [repository
108page](https://copr.fedorainfracloud.org/coprs/hlandau/acmetool/) and use `yum`,
109or download RPMs and use `rpm` directly.
110
111**Void Linux users:** `acmetool` is in the repositories:
112
113```bash
114$ sudo xbps-install acmetool
115```
116
117**Arch Linux users:** [An AUR PKGBUILD for building from source is available.](https://aur.archlinux.org/packages/acmetool-git/)
118
119```bash
120$ wget https://aur.archlinux.org/cgit/aur.git/snapshot/acmetool-git.tar.gz
121$ tar xvf acmetool-git.tar.gz
122$ cd acmetool-git
123$ makepkg -s
124$ sudo pacman -U ./acmetool*.pkg.tar.xz
125```
126
127**Alpine Linux users:** [An APKBUILD for building from source is available.](_doc/APKBUILD)
128
129**FreeBSD users:** [FreeBSD port is available.](http://www.freshports.org/security/acmetool/)
130
131**Building from source:** You will need Go installed to build from source.
132
133If you are on Linux, you will need to make sure the development files for
134`libcap` are installed. This is probably a package for your distro called
135`libcap-dev` or `libcap-devel` or similar.
136
137```bash
138# This is necessary to work around a change in Git's default configuration
139# which hasn't yet been accounted for in some places.
140$ git config --global http.followRedirects true
141
142$ git clone https://github.com/hlandau/acme
143$ cd acme
144$ make && sudo make install
145
146  # (People familiar with Go with a GOPATH setup can alternatively use go get/go install:)
147  $ git config --global http.followRedirects true
148  $ go get github.com/hlandau/acme/cmd/acmetool
149```
150
151### After installation
152
153```bash
154# Run the quickstart wizard. Sets up account, cronjob, etc.
155# (If you want to use ECDSA keys or set RSA key size, pass "--expert".)
156$ sudo acmetool quickstart
157
158# Configure your webserver to serve challenges if necessary.
159# See https://hlandau.github.io/acmetool/userguide#web-server-configuration
160$ ...
161
162# Request the hostnames you want:
163$ sudo acmetool want example.com www.example.com
164
165# Now you have certificates:
166$ ls -l /var/lib/acme/live/example.com/
167```
168
169The `quickstart` subcommand is a recommended wizard which guides you through
170the setup of ACME on your system.
171
172The `want` subcommand states that you want a certificate for the given hostnames.
173(If you want separate certificates for each of the hostnames, run the want
174subcommand separately for each hostname.)
175
176The default subcommand, `reconcile`, is like "make" and makes sure all desired
177hostnames are satisfied by valid certificates which aren't soon to expire.
178`want` calls `reconcile` automatically.
179
180If you run `acmetool reconcile` on a cronjob to facilitate automatic renewal,
181pass `--batch` to ensure it doesn't attempt to interact with a terminal.
182
183You can increase logging severity for debugging purposes by passing
184`--xlog.severity=debug`.
185
186## Validation Options
187
188<img src="https://i.imgur.com/h1rtdek.png" align="right" alt="[screenshot]" />
189
190**Webroot:** acmetool can place challenge files in a given directory, allowing your normal
191web server to serve them. The files must be served from the path you specify at
192`/.well-known/acme-challenge/`.
193
194[Information on configuring your web server.](https://hlandau.github.io/acmetool/userguide#web-server-configuration-challenges)
195
196**Proxy:** acmetool can respond to validation challenges by serving them on port 402. In
197order for this to be useful, you must configure your webserver to proxy
198requests under `/.well-known/acme-challenge/` to
199`http://127.0.0.1:402/.well-known/acme-challenge`.
200
201[Information on configuring your web server.](https://hlandau.github.io/acmetool/userguide#web-server-configuration-challenges)
202
203**Stateless:** You configure your webserver to respond statelessly to
204challenges for a given account key without consulting acmetool. This requires
205nothing more than a one-time web server configuration change and no "moving
206parts". [Information on
207configuring stateless
208challenges.](https://hlandau.github.io/acmetool/userguide#web-server-configuration-challenges)
209
210**Redirector:** `acmetool redirector` starts an HTTP server on port 80 which redirects all
211requests to HTTPS, as well as serving any necessary validation responses. The
212`acmetool quickstart` wizard can set it up for you if you use systemd.
213Otherwise, you'll need to configure your system to run `acmetool redirector
214--service.uid=USERNAME --service.daemon=1` as a service, where `USERNAME` is
215the username you want the daemon to drop to.
216
217Make sure your web server is not listening on port 80.
218
219**Listen:** If you are for some reason not running anything on port 80 or 443, acmetool
220will use those ports. Either port being available is sufficient. This is only
221really useful for development purposes.
222
223**Hook:** You can write custom shell scripts (or binary executables) which
224acmetool invokes to provision challenge files at the desired location. For
225example, you could rsync challenge files to a directory on a remote server. [More information.](https://hlandau.github.io/acmetool/userguide#challenge-hooks)
226
227## Renewal
228
229acmetool will try to renew certificates automatically once they are 30 days
230from expiry, or 66% through their validity period, whichever is lower.
231Note that Let's Encrypt currently issues 90 day certificates.
232
233acmetool will exit with an error message with nonzero exit status if it cannot
234renew a certificate, so it is suitable for use in a cronjob. Ensure your system
235is configured so that you get notifications of failing cronjobs.
236
237If a cronjob fails, you should intervene manually to see what went wrong by
238running `acmetool` (possibly with `--xlog.severity=debug` for verbose logging).
239
240## Library
241
242The [client library which these utilities use](https://github.com/hlandau/acme/tree/master/acmeapi) can be used independently by any Go code. [README and source code.](https://github.com/hlandau/acme/tree/master/acmeapi) [Godoc.](https://godoc.org/github.com/hlandau/acme/acmeapi)
243
244## Comparison with...
245
246**certbot:** A heavyweight Python implementation which is a bit too “magic” for
247my tastes. Tries to mutate your webserver configuration automatically.
248
249acmetool is a single-file binary which only depends on basic system libraries
250(on Linux, these are libc, libpthread, libcap, libattr). It doesn't do anything
251to your webserver; it just places certificates at a standard location and can
252also reload your webserver (whichever webserver it is) by executing hook shell
253scripts.
254
255acmetool isn't based around individual transactions for obtaining certificates;
256it's about satisfying expressed requirements by any means necessary. Its
257comprehensible, magic-free state directory makes it as stateless and idempotent
258as possible.
259
260**lego:** Like acmetool, [xenolf/lego](https://github.com/xenolf/lego) provides
261a library and client utility. The utility provides commands for creating
262certificates, but doesn't provide a compelling system for managing the lifetime
263of the short-lived certificates offered by Let's Encrypt. The user is expected
264to generate and install all certificates manually.
265
266**gethttpsforfree:**
267[diafygi/gethttpsforfree](https://github.com/diafygi/gethttpsforfree) provides
268an HTML file which uses JavaScript to make requests to an ACME server and
269obtain certificates. It's a functional user interface, but like lego it
270provides no answer for the automation issue, and is thus impractical given the
271short lifetime of certificates issued by Let's Encrypt.
272
273### Comparison, list of client implementations
274
275<table>
276<tr><td></td><th>acmetool</th><th><a href="https://github.com/certbot/certbot">certbot</a></th><th><a href="https://github.com/xenolf/lego">lego</a></th><th><a href="https://github.com/diafygi/gethttpsforfree">gethttpsforfree</a></th></tr>
277<tr><td>Automatic renewal</td><td>Yes</td><td>Not yet</td><td>No</td><td>No</td></tr>
278<tr><td>SAN support</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
279<tr><td>ECC support</td><td>Yes</td><td>No</td><td>No</td><td>No</td></tr>
280<tr><td>OCSP Must Staple support</td><td><a href="https://hlandau.github.io/acmetool/userguide#the-state-storage-schema">Yes</a></td><td>No</td><td>No</td><td>No</td></tr>
281<tr><td>Revocation support</td><td>Yes</td><td>Yes</td><td>Yes</td><td>No</td></tr>
282<tr><td>State management</td><td>Yes†</td><td>Yes</td><td>—</td><td>—</td></tr>
283<tr><td>Single-file binary</td><td>Yes</td><td>No</td><td>Yes</td><td>Yes</td></tr>
284<tr><td>Quickstart wizard</td><td>Yes</td><td>Yes</td><td>No</td><td>No</td></tr>
285<tr><td>Modifies webserver config</td><td>No</td><td>By default</td><td>No</td><td>No</td></tr>
286<tr><td>Non-root support</td><td><a href="https://hlandau.github.io/acmetool/userguide#annex-root-configured-non-root-operation">Optional</a></td><td>Optional</td><td>Optional</td><td>—</td></tr>
287<tr><td>Supports Apache</td><td>Yes</td><td>Yes</td><td>—</td><td>—</td></tr>
288<tr><td>Supports nginx</td><td>Yes</td><td>Experimental</td><td>—</td><td>—</td></tr>
289<tr><td>Supports HAProxy</td><td>Yes</td><td>No</td><td>—</td><td>—</td></tr>
290<tr><td>Supports Hitch</td><td>Yes</td><td>No</td><td>—</td><td>—</td></tr>
291<tr><td>Supports any web server</td><td>Yes</td><td>Webroot‡</td><td>—</td><td>—</td></tr>
292<tr><td>Authorization via webroot</td><td>Yes</td><td>Yes</td><td>—</td><td>Manual</td></tr>
293<tr><td>Authorization via port 80 redirector</td><td>Yes</td><td>No</td><td>No</td><td>No</td></tr>
294<tr><td>Authorization via proxy</td><td>Yes</td><td>No</td><td>No</td><td>No</td></tr>
295<tr><td>Authorization via listener§</td><td>Yes</td><td>Yes</td><td>Yes</td><td>No</td></tr>
296<tr><td>Authorization via DNS</td><td><a href="https://hlandau.github.io/acmetool/userguide#dns-hook-scripts">Hook only</a></td><td>No</td><td>Yes</td><td>No</td></tr>
297<tr><td>Authorization via custom hook</td><td><a href="https://hlandau.github.io/acmetool/userguide#challenge-hooks">Yes</a></td><td>No</td><td>No</td><td>No</td></tr>
298<tr><td>Import state from official client</td><td>Yes</td><td>—</td><td>—</td><td>—</td></tr>
299<tr><td>Windows (basic) support</td><td>No</td><td>No</td><td>Yes</td><td>—</td></tr>
300<tr><td>Windows integration support</td><td>No</td><td>No</td><td>No</td><td>—</td></tr>
301</table>
302
303† acmetool has a different philosophy to state management and configuration to
304the Let's Encrypt client; see the beginning of this README.
305
306‡ The webroot method does not appear to provide any means of reloading the
307webserver once the certificate has been changed, which means auto-renewal
308requires manual intervention.
309
310§ Requires downtime.
311
312This table is maintained in good faith; I believe the above comparison to be
313accurate. If notified of any inaccuracies, I will rectify the table and publish
314a notice of correction here:
315
316  - This table previously stated that the official Let's Encrypt client doesn't
317    support non-root operation. This was incorrect; it can be installed at user
318    level and be configured to use user-writable directories.
319
320## Documentation & Support
321
322For more documentation see:
323- [User Guide](https://hlandau.github.io/acmetool/userguide)
324- [Troubleshooting](https://hlandau.github.io/acmetool/userguide#troubleshooting)
325- [FAQ](https://hlandau.github.io/acmetool/userguide#faq)
326- [manpage](https://hlandau.github.io/acmetool/acmetool.8)
327
328If your question or issue isn't resolved by any of the above, file an issue.
329
330IRC: [#acmetool](irc://chat.freenode.net/#acmetool) on [Freenode](http://freenode.net/) ([webchat](https://webchat.freenode.net/?channels=%23acmetool)).
331
332
333## Licence
334
335    © 2015—2016 Hugo Landau <hlandau@devever.net>    MIT License
336
337[Licenced under the licence with SHA256 hash
338`fd80a26fbb3f644af1fa994134446702932968519797227e07a1368dea80f0bc`, a copy of
339which can be found
340here.](https://raw.githubusercontent.com/hlandau/rilts/master/licences/COPYING.MIT)
341