Simple ACME client written in C
ACME (Automatic Certificate Management Environment) is a protocol specified by RFC 8555 that is widely used for obtaining Let's Encrypt and other certificates automatically. A user (ACME client machine, usually automated) can request a certificate for a domain it has control over by sending a request to an ACME server. The ACME server will then generate challenges for the client which have to be fulfilled in order to prove control over the requested domains. A challenge is a random token that the client needs to serve via HTTP or DNS TXT record. If the conditions are met and the challenges are fulfilled before timeout, the server will issue the certificate and make it available for the client.
- Single or multidomain certificate requests to an ACME-enabled CA, such as Let's Encrypt
- HTTP-01 validation
- Automatic HTTP challenge validation, no user interaction required
Usage: acme-client [OPTION...]
Simple ACME client written in C
-a, --account-key=KEYFILE Account private key
-c, --cert=CERTFILE CA certificate file used by the ACME server
-d, --domain=DOMAIN Domain for which to request the certificate. Can
be used multiple times.
-p, --port=PORT Port number the HTTP server should bind to
-u, --dir=DIR_URL Directory URL of the ACME server that should be
used.
-v, --verbose Produce verbose output
-y, --agree-tos Always agree to the terms of service
-?, --help Give this help list
--usage Give a short usage message
-V, --version Print program version
-
Stop your webserver, so acme-client can bind to Port 80. For instance if you're using nginx and systemd:
systemctl stop nginx
-
Run acme-client
./acme-client --domain <YOUR-DOMAIN-NAME>
-
Copy client.key and cert.crt to the right location & restart webserver
systemctl start nginx
A binary release is planned as soon as acme-client is more stable. For now, you have to compile it yourself. Linux only.
acme-client comes in two configurations: Debug and Release. The debug build contains all the tests that are also used in the Github testing CI pipeline. It has some unit tests and does testing against a local ACME testing server. It uses Valgrind to spot memory leaks and other memory-related issues.
Besides a standard GCC installation you need the following packages. For the release build:
- OpenSSL >= 3.0.0
- cURL
- cJSON
- CMake >= 3.20
sudo apt-get install libcurl4-openssl-dev libcjson-dev openssl libssl-dev cmake
Needed additionally for testing (debug build):
- Pebble
- Python >= 3.9
- Valgrind
sudo apt-get install libcurl4-openssl-dev libcjson-dev openssl libssl-dev cmake valgrind pebble
Get the sources:
git clone https://github.com/stgloorious/acme-client && cd acme-client
Compile (Release build):
cmake -DCMAKE_BUILD_TYPE=Release -B build
cd build && make
Compile and test (Debug build):
cmake -DCMAKE_BUILD_TYPE=Debug -B build
cd build && make all test