7
7
# nginx-acme
8
8
9
9
nginx-acme is an [ NGINX] module with the implementation of the automatic
10
- certificate management ([ ACMEv2] ) protocol.
10
+ certificate management (ACMEv2) protocol.
11
+
12
+ The module implements following specifications:
13
+
14
+ * [ RFC8555] (Automatic Certificate Management Environment) with limitations:
15
+ * Only HTTP-01 challenge type is supported
16
+ * External account binding is not supported
11
17
12
18
[ NGINX ] : https://nginx.org/
13
- [ ACMEv2 ] : https://www.rfc-editor.org/rfc/rfc8555.html
19
+ [ RFC8555 ] : https://www.rfc-editor.org/rfc/rfc8555.html
14
20
15
21
## Getting Started
16
22
17
23
### Requirements
18
24
19
- - Regular NGINX build dependencies: C compliler , make, PCRE2, Zlib
25
+ - Regular NGINX build dependencies: C compiler , make, PCRE2, Zlib
20
26
- System-wide installation of OpenSSL 1.1.1 or later
21
27
- Rust toolchain (1.81.0 or later)
22
28
- [ libclang] for rust-bindgen
@@ -25,11 +31,11 @@ certificate management ([ACMEv2]) protocol.
25
31
26
32
### Building
27
33
28
- One way to build the module is to export a path to a pre-built nginx source
34
+ One way to build the module is to export a path to a configured NGINX source
29
35
tree and run ` cargo ` .
30
36
31
37
``` sh
32
- # checkout, configure and build nginx at ../nginx
38
+ # checkout, configure and build NGINX at ../nginx
33
39
cd nginx-acme
34
40
export NGINX_BUILD_DIR=$( realpath ../nginx/objs)
35
41
cargo build --release
@@ -40,7 +46,7 @@ The result will be located at `target/release/libnginx_acme.so`.
40
46
Another way is to use the provided config script:
41
47
42
48
``` sh
43
- # in the nginx source directory
49
+ # in the NGINX source directory
44
50
auto/configure \
45
51
--with-compat \
46
52
--with-http_ssl_module \
@@ -52,9 +58,29 @@ The result will be located at `objs/ngx_http_acme_module.so`.
52
58
Currently this method produces a slightly larger library, as we don't instruct
53
59
the linker to perform LTO and remove unused code.
54
60
61
+ ### Testing
62
+
63
+ The repository contains an integration test suite based on the [ nginx-tests] .
64
+ The following command will build the module and run the tests:
65
+
66
+ ``` sh
67
+ # Path to the nginx source checkout, defaults to ../nginx if not specified.
68
+ export NGINX_SOURCE_DIR=$( realpath ../nginx)
69
+ # Path to the nginx-tests checkout; defaults to ../nginx/tests if not specified.
70
+ export NGINX_TESTS_DIR=$( realpath ../nginx-tests)
71
+
72
+ make test
73
+ ```
74
+
75
+ Most of the tests require [ pebble] test server binary in the path, or in a
76
+ location specified via ` TEST_NGINX_PEBBLE_BINARY ` environment variable.
77
+
78
+ [ nginx-tests ] : https://github.com/nginx/nginx-tests
79
+ [ pebble ] : https://github.com/letsencrypt/pebble
80
+
55
81
## How to Use
56
82
57
- Add the module to the nginx configuration and configure as described below.
83
+ Add the module to the NGINX configuration and configure as described below.
58
84
Note that this module requires a [ resolver] configuration in the ` http ` block.
59
85
60
86
[ resolver ] : https://nginx.org/en/docs/http/ngx_http_core_module.html#resolver
@@ -66,12 +92,12 @@ resolver 127.0.0.1:53;
66
92
67
93
acme_issuer example {
68
94
uri https://acme.example.com/directory;
69
-
70
- state_path /var/lib /nginx/acme-example;
95
+
96
+ state_path /var/cache /nginx/acme-example;
71
97
accept_terms_of_service;
72
98
}
73
99
74
- acme_shared_zone zone=acme_shared :1M;
100
+ acme_shared_zone zone=ngx_acme_shared :1M;
75
101
76
102
server {
77
103
listen 443 ssl;
@@ -82,6 +108,7 @@ server {
82
108
ssl_certificate $acme_certificate;
83
109
ssl_certificate_key $acme_certificate_key;
84
110
111
+ # do not parse the certificate on each request
85
112
ssl_certificate_cache max=2;
86
113
}
87
114
@@ -116,8 +143,8 @@ Defines an ACME certificate issuer object.
116
143
** Context:** acme_issuer
117
144
118
145
The [ 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.
146
+ of the ACME server. This is the only mandatory directive in the
147
+ [ acme_issuer ] ( #acme_issuer ) block.
121
148
122
149
### account_key
123
150
@@ -128,14 +155,16 @@ of the ACME server. This is the only mandatory parameter in the
128
155
** Context:** acme_issuer
129
156
130
157
The account's private key used for request authentication.
158
+
131
159
Accepted values:
132
160
133
- - ` ecdsa:256/384/521 ` for ` ES256 ` / ` ES384 ` / ` ES512 ` JSON Web Signature algorithms
134
- - ` rsa:2048..4096 ` for ` RS256 ` .
161
+ - ` ecdsa:256/384/521 ` for ` ES256 ` , ` ES384 ` or ` ES512 ` JSON Web Signature
162
+ algorithms
163
+ - ` rsa:2048/3072/4096 ` for ` RS256 ` .
135
164
- File path for an existing key, using one of the algorithms above.
136
165
137
166
The generated account keys are preserved across reloads, but will be lost on
138
- restart unless [ ] ( #state_path ) is configured.
167
+ restart unless [ state_path ] ( #state_path ) is configured.
139
168
140
169
### contact
141
170
@@ -145,12 +174,11 @@ restart unless [](#state_path) is configured.
145
174
146
175
** Context:** acme_issuer
147
176
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
177
+ Sets an array of URLs that the ACME server can use to contact the client
178
+ regarding account issues.
179
+ The ` mailto: ` scheme will be assumed unless specified
150
180
explicitly.
151
181
152
- Can be specified multiple times.
153
-
154
182
### ssl_trusted_certificate
155
183
156
184
** Syntax:** ssl_trusted_certificate ` file `
@@ -171,7 +199,7 @@ the certificate of the ACME server.
171
199
172
200
** Context:** acme_issuer
173
201
174
- Enables or disables verification of the ACME servier certificate.
202
+ Enables or disables verification of the ACME server certificate.
175
203
176
204
### state_path
177
205
@@ -182,11 +210,11 @@ Enables or disables verification of the ACME servier certificate.
182
210
** Context:** acme_issuer
183
211
184
212
Defines 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.
213
+ restarts. This can significantly improve the time until the server is ready
214
+ and help with rate-limiting ACME servers.
187
215
188
- The directory, if configured, will contain sensitive content:
189
- the account key, the issued certificates and private keys.
216
+ The directory contains sensitive content, such as the account key, issued
217
+ certificates, and private keys.
190
218
191
219
### accept_terms_of_service
192
220
@@ -196,11 +224,10 @@ the account key, the issued certificates and private keys.
196
224
197
225
** Context:** acme_issuer
198
226
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.
227
+ Agrees to the terms of service under which the ACME server will be used.
228
+ Some servers require accepting the terms of service before account registration.
229
+ The terms are usually available on the ACME server's website and the URL will
230
+ be printed to the error log if necessary.
204
231
205
232
### acme_shared_zone
206
233
@@ -210,11 +237,13 @@ website and the URL will be printed to the error log if necessary.
210
237
211
238
** Context:** http
212
239
213
- An optional directive that allows increasing the size of in-memory storage of
214
- the module.
240
+ Allows increasing the size of in-memory storage of the module.
215
241
The shared memory zone will be used to store the issued certificates, keys and
216
242
challenge data for all the configured certificate issuers.
217
243
244
+ The default zone size is sufficient to hold ~ 50 ECDSA prime256v1 keys or
245
+ ~ 35 RSA 2048 keys.
246
+
218
247
### acme_certificate
219
248
220
249
** Syntax:** acme_certificate ` issuer ` [ ` identifier ` ...] [ ` key ` = ` alg[:size] ` ]
@@ -226,31 +255,30 @@ challenge data for all the configured certificate issuers.
226
255
Defines a certificate with the list of ` identifier ` s requested from
227
256
issuer ` issuer ` .
228
257
229
- The explicit list of identifiers can be omitted. In this case the identifiers
258
+ The explicit list of identifiers can be omitted. In this case, the identifiers
230
259
will 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:
260
+ Not all values accepted in the [ server_name] are valid certificate identifiers:
232
261
regular expressions and wildcards are not supported.
233
262
234
263
[ server_name ] : https://nginx.org/en/docs/http/ngx_http_core_module.html#server_name
235
264
236
- The ` key ` parameter sets the type of a generated private key. Supported key
237
- algorithms and sizes:
238
- ` ecdsa:256 ` (default), ` ecdsa:384 ` ,
239
- ` ecdsa:521 ` ,
240
- ` rsa:2048 ` .. ` rsa:4096 ` .
265
+ The ` key ` parameter sets the type of a generated private key.
266
+ Supported key algorithms and sizes:
267
+ ` ecdsa:256 ` (default), ` ecdsa:384 ` , ` ecdsa:521 ` ,
268
+ ` rsa:2048 ` , ` rsa:3072 ` , ` rsa:4096 ` .
241
269
242
270
## Embedded Variables
243
271
244
272
The ` ngx_http_acme_module ` module defines following embedded
245
273
variables, valid in the ` server ` block with the
246
274
[ acme_certificate] ( #acme_certificate ) directive:
247
275
248
- ### `` $acme_certificate ` `
276
+ ### ` $acme_certificate `
249
277
250
278
SSL certificate that can be passed to the
251
279
[ ssl_certificate] ( https://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_certificate ) .
252
280
253
- ### `` $acme_certificate_key ` `
281
+ ### ` $acme_certificate_key `
254
282
255
283
SSL certificate private key that can be passed to the
256
284
[ ssl_certificate_key] ( https://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_certificate_key ) .
0 commit comments