@@ -16,7 +16,7 @@ certificate management ([ACMEv2]) protocol.
1616
1717### Requirements
1818
19- - Regular NGINX build dependencies: C compliler , make, PCRE2, Zlib
19+ - Regular NGINX build dependencies: C compiler , make, PCRE2, Zlib
2020- System-wide installation of OpenSSL 1.1.1 or later
2121- Rust toolchain (1.81.0 or later)
2222- [ libclang] for rust-bindgen
@@ -25,11 +25,11 @@ certificate management ([ACMEv2]) protocol.
2525
2626### Building
2727
28- One way to build the module is to export a path to a pre-built nginx source
28+ One way to build the module is to export a path to a pre-built NGINX source
2929tree and run ` cargo ` .
3030
3131``` sh
32- # checkout, configure and build nginx at ../nginx
32+ # checkout, configure and build NGINX at ../nginx
3333cd nginx-acme
3434export NGINX_BUILD_DIR=$( realpath ../nginx/objs)
3535cargo build --release
@@ -40,7 +40,7 @@ The result will be located at `target/release/libnginx_acme.so`.
4040Another way is to use the provided config script:
4141
4242``` sh
43- # in the nginx source directory
43+ # in the NGINX source directory
4444auto/configure \
4545 --with-compat \
4646 --with-http_ssl_module \
@@ -52,9 +52,29 @@ The result will be located at `objs/ngx_http_acme_module.so`.
5252Currently this method produces a slightly larger library, as we don't instruct
5353the linker to perform LTO and remove unused code.
5454
55+ ### Testing
56+
57+ The repository contains an integration test suite based on the [ nginx-tests] .
58+ The following command will build the module and run the tests:
59+
60+ ``` sh
61+ # Path to the nginx source checkout, defaults to ../nginx if not specified.
62+ export NGINX_SOURCE_DIR=$( realpath ../nginx)
63+ # Path to the nginx-tests checkout; defaults to ../nginx/tests if not specified.
64+ export NGINX_TESTS_DIR=$( realpath ../nginx-tests)
65+
66+ make test
67+ ```
68+
69+ Most of the tests require [ pebble] test server binary in the path, or in a
70+ location specified via ` TEST_NGINX_PEBBLE_BINARY ` environment variable.
71+
72+ [ nginx-tests ] : https://github.com/nginx/nginx-tests
73+ [ pebble ] : https://github.com/letsencrypt/pebble
74+
5575## How to Use
5676
57- Add the module to the nginx configuration and configure as described below.
77+ Add the module to the NGINX configuration and configure as described below.
5878Note that this module requires a [ resolver] configuration in the ` http ` block.
5979
6080[ resolver ] : https://nginx.org/en/docs/http/ngx_http_core_module.html#resolver
@@ -66,12 +86,12 @@ resolver 127.0.0.1:53;
6686
6787acme_issuer example {
6888 uri https://acme.example.com/directory;
69- 70- state_path /var/lib /nginx/acme-example;
89+ 90+ state_path /var/cache /nginx/acme-example;
7191 accept_terms_of_service;
7292}
7393
74- acme_shared_zone zone=acme_shared :1M;
94+ acme_shared_zone zone=ngx_acme_shared :1M;
7595
7696server {
7797 listen 443 ssl;
@@ -82,6 +102,7 @@ server {
82102 ssl_certificate $acme_certificate;
83103 ssl_certificate_key $acme_certificate_key;
84104
105+ # do not parse the certificate on each request
85106 ssl_certificate_cache max=2;
86107}
87108
@@ -116,8 +137,8 @@ Defines an ACME certificate issuer object.
116137** Context:** acme_issuer
117138
118139The [ directory URL] ( https://www.rfc-editor.org/rfc/rfc8555#section-7.1.1 )
119- of the ACME server. This is the only mandatory parameter in the
120- [ ] ( #acme_issuer ) block.
140+ of the ACME server. This is the only mandatory directive in the
141+ [ acme_issuer ] ( #acme_issuer ) block.
121142
122143### account_key
123144
@@ -128,14 +149,16 @@ of the ACME server. This is the only mandatory parameter in the
128149** Context:** acme_issuer
129150
130151The account's private key used for request authentication.
152+
131153Accepted values:
132154
133- - ` ecdsa:256/384/521 ` for ` ES256 ` / ` ES384 ` / ` ES512 ` JSON Web Signature algorithms
134- - ` rsa:2048..4096 ` for ` RS256 ` .
155+ - ` ecdsa:256/384/521 ` for ` ES256 ` , ` ES384 ` or ` ES512 ` JSON Web Signature
156+ algorithms
157+ - ` rsa:2048..4096 ` for ` RS256 ` .
135158- File path for an existing key, using one of the algorithms above.
136159
137160The generated account keys are preserved across reloads, but will be lost on
138- restart unless [ ] ( #state_path ) is configured.
161+ restart unless [ state_path ] ( #state_path ) is configured.
139162
140163### contact
141164
@@ -145,12 +168,11 @@ restart unless [](#state_path) is configured.
145168
146169** Context:** acme_issuer
147170
148- An array of URLs that the ACME server can use to contact the client for issues
149- related to this account. The ` mailto: ` scheme will be assumed unless specified
171+ Sets an array of URLs that the ACME server can use to contact the client
172+ regarding account issues.
173+ The ` mailto: ` scheme will be assumed unless specified
150174explicitly.
151175
152- Can be specified multiple times.
153-
154176### ssl_trusted_certificate
155177
156178** Syntax:** ssl_trusted_certificate ` file `
@@ -171,7 +193,7 @@ the certificate of the ACME server.
171193
172194** Context:** acme_issuer
173195
174- Enables or disables verification of the ACME servier certificate.
196+ Enables or disables verification of the ACME server certificate.
175197
176198### state_path
177199
@@ -182,11 +204,11 @@ Enables or disables verification of the ACME servier certificate.
182204** Context:** acme_issuer
183205
184206Defines a directory for storing the module data that can be persisted across
185- restarts. This could greatly improve the time until the server is ready and
186- help with rate-limiting ACME servers.
207+ restarts. This can significantly improve the time until the server is ready
208+ and help with rate-limiting ACME servers.
187209
188- The directory, if configured, will contain sensitive content:
189- the account key, the issued certificates and private keys.
210+ The directory contains sensitive content, such as the account key, issued
211+ certificates, and private keys.
190212
191213### accept_terms_of_service
192214
@@ -196,11 +218,10 @@ the account key, the issued certificates and private keys.
196218
197219** Context:** acme_issuer
198220
199- Agree to the terms under which the ACME server is to be used.
200-
201- Some servers require the user to agree with the terms of service before
202- registering an account. The text is usually available on the ACME server's
203- website and the URL will be printed to the error log if necessary.
221+ Agrees to the terms of service under which the ACME server will be used.
222+ Some servers require accepting the terms of service before account registration.
223+ The terms are usually available on the ACME server's website and the URL will
224+ be printed to the error log if necessary.
204225
205226### acme_shared_zone
206227
@@ -210,11 +231,13 @@ website and the URL will be printed to the error log if necessary.
210231
211232** Context:** http
212233
213- An optional directive that allows increasing the size of in-memory storage of
214- the module.
234+ Allows increasing the size of in-memory storage of the module.
215235The shared memory zone will be used to store the issued certificates, keys and
216236challenge data for all the configured certificate issuers.
217237
238+ The default zone size is sufficient to hold ~ 50 ECDSA prime256v1 keys or
239+ ~ 35 RSA 2048 keys.
240+
218241### acme_certificate
219242
220243** Syntax:** acme_certificate ` issuer ` [ ` identifier ` ...] [ ` key ` = ` alg[:size] ` ]
@@ -226,15 +249,15 @@ challenge data for all the configured certificate issuers.
226249Defines a certificate with the list of ` identifier ` s requested from
227250issuer ` issuer ` .
228251
229- The explicit list of identifiers can be omitted. In this case the identifiers
252+ The explicit list of identifiers can be omitted. In this case, the identifiers
230253will be taken from the [ server_name] directive in the same ` server ` block.
231- Not all the values accepted by [ server_name] are valid certificate identifiers:
254+ Not all values accepted in the [ server_name] are valid certificate identifiers:
232255regular expressions and wildcards are not supported.
233256
234257[ server_name ] : https://nginx.org/en/docs/http/ngx_http_core_module.html#server_name
235258
236- The ` key ` parameter sets the type of a generated private key. Supported key
237- algorithms and sizes:
259+ The ` key ` parameter sets the type of a generated private key.
260+ Supported key algorithms and sizes:
238261` ecdsa:256 ` (default), ` ecdsa:384 ` ,
239262` ecdsa:521 ` ,
240263` rsa:2048 ` .. ` rsa:4096 ` .
@@ -245,12 +268,12 @@ The `ngx_http_acme_module` module defines following embedded
245268variables, valid in the ` server ` block with the
246269[ acme_certificate] ( #acme_certificate ) directive:
247270
248- ### `` $acme_certificate ` `
271+ ### ` $acme_certificate `
249272
250273SSL certificate that can be passed to the
251274[ ssl_certificate] ( https://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_certificate ) .
252275
253- ### `` $acme_certificate_key ` `
276+ ### ` $acme_certificate_key `
254277
255278SSL certificate private key that can be passed to the
256279[ ssl_certificate_key] ( https://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_certificate_key ) .
0 commit comments