@@ -10,9 +10,9 @@ certificate management ([ACME]) protocol.
10
10
11
11
### Requirements
12
12
13
- * Regular nginx build dependencies
14
- * System-wide installation of OpenSSL 1.1.1 or later
15
- * Rust toolchain (1.81.0 or later)
13
+ - Regular nginx build dependencies
14
+ - System-wide installation of OpenSSL 1.1.1 or later
15
+ - Rust toolchain (1.81.0 or later)
16
16
17
17
### Commands
18
18
@@ -25,24 +25,224 @@ cd nginx-acme
25
25
export NGINX_BUILD_DIR=$( realpath ../nginx/objs)
26
26
cargo build --release
27
27
```
28
+
28
29
The result will be located at ` target/release/libnginx_acme.so ` .
29
30
30
31
Another way is to use the provided config script:
32
+
31
33
``` sh
32
34
# in the nginx source directory
33
35
auto/configure \
34
36
--with-compat \
35
37
--with-http_ssl_module \
36
38
--add-[dynamic-]module=/path/to/nginx-acme
37
39
```
40
+
38
41
The result will be located at ` $NGX_OBJS/ngx_http_acme_module.so ` .
39
42
40
43
Currently this method produces a slightly larger library, as we don't instruct
41
- the linker to perform dead code elimination.
44
+ the linker to perform LTO and dead code elimination.
42
45
43
46
## How to Use
44
47
45
- To be added later.
48
+ Add the moduel to the nginx configuration and configure as described below.
49
+
50
+ ## Example Configuration
51
+
52
+
53
+ ``` nginx
54
+ resolver 127.0.0.1;
55
+
56
+ acme_issuer example {
57
+ uri https://acme.example.com/directory;
58
+
59
+ state_path /var/lib/nginx/acme-example;
60
+ }
61
+
62
+ acme_shared_zone 1M;
63
+
64
+ server {
65
+ server_name .example.test;
66
+
67
+ acme_certificate .example.test
68
+ issuer=example;
69
+
70
+ ssl_certificate $acme_certificate;
71
+ ssl_certificate_key $acme_certificate_key;
72
+ }
73
+
74
+ ```
75
+
76
+ ## Directives
77
+
78
+ ### acme_issuer
79
+
80
+ ** Syntax:** acme_issuer ` name `
81
+
82
+ ** Default:** -
83
+
84
+ ** Context:** http
85
+
86
+ Defines an ACME certificate issuer object.
87
+
88
+ ### uri
89
+
90
+ ** Syntax:** uri ` uri `
91
+
92
+ ** Default:** -
93
+
94
+ ** Context:** acme_issuer
95
+
96
+ The [ directory URL] ( https://www.rfc-editor.org/rfc/rfc8555#section-7.1.1 )
97
+ of the ACME server. This is the only mandatory parameter in the
98
+ [ ] ( #acme_issuer ) block.
99
+
100
+ ### account_key
101
+
102
+ ** Syntax:** account_key ` alg[:size] ` | ` file `
103
+
104
+ ** Default:** -
105
+
106
+ ** Context:** acme_issuer
107
+
108
+ The account's private key used for request authentication.
109
+ Accepted values:
110
+
111
+ - ` ecdsa:256/384/521 ` for ` ES256 ` / ` ES384 ` / ` ES512 ` JSON Web Signature algorithms
112
+ - ` rsa:2048..4096 ` for ` RS256 ` .
113
+ - File path for an existing key, using one of the algorithms above.
114
+
115
+ The generated account keys are preserved across reloads, but will be lost on
116
+ restart unless [ ] ( #state_path ) is configured.
117
+
118
+ ### contact
119
+
120
+ ** Syntax:** contact ` url `
121
+
122
+ ** Default:** -
123
+
124
+ ** Context:** acme_issuer
125
+
126
+ An array of URLs that the ACME server can use to contact the client for issues
127
+ related to this account.
128
+
129
+ Can be specified multiple times.
130
+
131
+ ### resolver
132
+
133
+ ** Syntax:** resolver ` address ` ... [ ` valid ` = ` time ` ] [ ` ipv4 ` = ` on ` | ` off ` ] [ ` ipv6 ` = ` on ` | ` off ` ] [ ` status_zone ` = ` zone ` ]
134
+
135
+ ** Default:** -
136
+
137
+ ** Context:** acme_issuer
138
+
139
+ Configures name servers used to resolve names of upstream servers into
140
+ addresses.
141
+ See [ resolver] ( https://nginx.org/en/docs/http/ngx_http_core_module.html#resolver )
142
+ for the parameter reference.
143
+
144
+ Required, but can be inherited from the ` http ` block.
145
+ ### resolver_timeout
146
+
147
+ ** Syntax:** resolver_timeout ` time `
148
+
149
+ ** Default:** 30s
150
+
151
+ ** Context:** acme_issuer
152
+
153
+ Sets a timeout for name resolution, for example:
154
+
155
+ ``` nginx
156
+ resolver_timeout 5s;
157
+
158
+ ```
159
+
160
+ ### ssl_trusted_certificate
161
+
162
+ ** Syntax:** ssl_trusted_certificate ` file `
163
+
164
+ ** Default:** system CA bundle
165
+
166
+ ** Context:** acme_issuer
167
+
168
+ Specifies a ` file ` with trusted CA certificates in the PEM format
169
+ used to [ verify] ( #ssl_verify )
170
+ the certificate of the ACME server.
171
+
172
+ ### ssl_verify
173
+
174
+ ** Syntax:** ssl_verify ` on ` | ` off `
175
+
176
+ ** Default:** on
177
+
178
+ ** Context:** acme_issuer
179
+
180
+ Enables or disables verification of the ACME servier certificate.
181
+
182
+ ### state_path
183
+
184
+ ** Syntax:** state_path ` path `
185
+
186
+ ** Default:** -
187
+
188
+ ** Context:** acme_issuer
189
+
190
+ Defines a directory for storing the module data that can be persisted across
191
+ restarts. This could greatly improve the time until the server is ready and
192
+ help with rate-limiting ACME servers.
193
+
194
+ The directory, if configured, will contain sensitive content:
195
+ the account key, the issued certificates and private keys.
196
+
197
+ ### acme_shared_zone
198
+
199
+ ** Syntax:** acme_shared_zone ` size `
200
+
201
+ ** Default:** 262k
202
+
203
+ ** Context:** http
204
+
205
+ An optional directive that allows increasing the size of in-memory storage of
206
+ the module.
207
+ The shared memory zone will be used to store the issued certificates, keys and
208
+ challenge data for all the configured certificate issuers.
209
+
210
+ ### acme_certificate
211
+
212
+ ** Syntax:** acme_certificate ` identifier ` ... ` issuer ` = ` issuer_name ` [ ` key ` = ` alg[:size] ` | ` file ` ]
213
+
214
+ ** Default:** -
215
+
216
+ ** Context:** server
217
+
218
+ Defines a certificate with the list of ` identifier ` s requested from
219
+ issuer ` issuer_name ` .
220
+ The ` key ` parameter sets the type of generated private key or a
221
+ path to an existing file. Supported key algorithms and sizes:
222
+ ` ecdsa:256 ` (default), ` ecdsa:384 ` ,
223
+ ` ecdsa:521 ` ,
224
+ ` rsa:2048 ` .. ` rsa:4096 ` .
225
+
226
+ > Since 1.27.2, the ` key ` parameter supports the additional schemes implemented in the
227
+ > [ ssl_certificate_key] ( https://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_certificate_key )
228
+ > directive: ` data: ` , ` engine: ` and more recently ` store: ` ,
229
+ > with a caveat that password-protected keys are not supported.
230
+
231
+ ## Embedded Variables
232
+
233
+ The ` ngx_http_acme_module ` module defines following embedded
234
+ variables, valid in the ` server ` block with the
235
+ [ acme_certificate] ( #acme_certificate ) directive:
236
+
237
+ ### `` $acme_certificate ``
238
+
239
+ SSL certificate that can be passed to the
240
+ [ ssl_certificate] ( https://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_certificate ) .
241
+
242
+ ### `` $acme_certificate_key ``
243
+
244
+ SSL certificate private key that can be passed to the
245
+ [ ssl_certificate_key] ( https://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_certificate_key ) .
46
246
47
247
## License
48
248
0 commit comments