@@ -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,223 @@ 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 .example.test;
68
+
69
+ ssl_certificate $acme_certificate;
70
+ ssl_certificate_key $acme_certificate_key;
71
+ }
72
+
73
+ ```
74
+
75
+ ## Directives
76
+
77
+ ### acme_issuer
78
+
79
+ ** Syntax:** acme_issuer ` name `
80
+
81
+ ** Default:** -
82
+
83
+ ** Context:** http
84
+
85
+ Defines an ACME certificate issuer object.
86
+
87
+ ### uri
88
+
89
+ ** Syntax:** uri ` uri `
90
+
91
+ ** Default:** -
92
+
93
+ ** Context:** acme_issuer
94
+
95
+ The [ directory URL] ( https://www.rfc-editor.org/rfc/rfc8555#section-7.1.1 )
96
+ of the ACME server. This is the only mandatory parameter in the
97
+ [ ] ( #acme_issuer ) block.
98
+
99
+ ### account_key
100
+
101
+ ** Syntax:** account_key ` alg[:size] ` | ` file `
102
+
103
+ ** Default:** -
104
+
105
+ ** Context:** acme_issuer
106
+
107
+ The account's private key used for request authentication.
108
+ Accepted values:
109
+
110
+ - ` ecdsa:256/384/521 ` for ` ES256 ` / ` ES384 ` / ` ES512 ` JSON Web Signature algorithms
111
+ - ` rsa:2048..4096 ` for ` RS256 ` .
112
+ - File path for an existing key, using one of the algorithms above.
113
+
114
+ The generated account keys are preserved across reloads, but will be lost on
115
+ restart unless [ ] ( #state_path ) is configured.
116
+
117
+ ### contact
118
+
119
+ ** Syntax:** contact ` url `
120
+
121
+ ** Default:** -
122
+
123
+ ** Context:** acme_issuer
124
+
125
+ An array of URLs that the ACME server can use to contact the client for issues
126
+ related to this account.
127
+
128
+ Can be specified multiple times.
129
+
130
+ ### resolver
131
+
132
+ ** Syntax:** resolver ` address ` ... [ ` valid ` = ` time ` ] [ ` ipv4 ` = ` on ` | ` off ` ] [ ` ipv6 ` = ` on ` | ` off ` ] [ ` status_zone ` = ` zone ` ]
133
+
134
+ ** Default:** -
135
+
136
+ ** Context:** acme_issuer
137
+
138
+ Configures name servers used to resolve names of upstream servers into
139
+ addresses.
140
+ See [ resolver] ( https://nginx.org/en/docs/http/ngx_http_core_module.html#resolver )
141
+ for the parameter reference.
142
+
143
+ Required, but can be inherited from the ` http ` block.
144
+ ### resolver_timeout
145
+
146
+ ** Syntax:** resolver_timeout ` time `
147
+
148
+ ** Default:** 30s
149
+
150
+ ** Context:** acme_issuer
151
+
152
+ Sets a timeout for name resolution, for example:
153
+
154
+ ``` nginx
155
+ resolver_timeout 5s;
156
+
157
+ ```
158
+
159
+ ### ssl_trusted_certificate
160
+
161
+ ** Syntax:** ssl_trusted_certificate ` file `
162
+
163
+ ** Default:** system CA bundle
164
+
165
+ ** Context:** acme_issuer
166
+
167
+ Specifies a ` file ` with trusted CA certificates in the PEM format
168
+ used to [ verify] ( #ssl_verify )
169
+ the certificate of the ACME server.
170
+
171
+ ### ssl_verify
172
+
173
+ ** Syntax:** ssl_verify ` on ` | ` off `
174
+
175
+ ** Default:** on
176
+
177
+ ** Context:** acme_issuer
178
+
179
+ Enables or disables verification of the ACME servier certificate.
180
+
181
+ ### state_path
182
+
183
+ ** Syntax:** state_path ` path `
184
+
185
+ ** Default:** -
186
+
187
+ ** Context:** acme_issuer
188
+
189
+ Defines a directory for storing the module data that can be persisted across
190
+ restarts. This could greatly improve the time until the server is ready and
191
+ help with rate-limiting ACME servers.
192
+
193
+ The directory, if configured, will contain sensitive content:
194
+ the account key, the issued certificates and private keys.
195
+
196
+ ### acme_shared_zone
197
+
198
+ ** Syntax:** acme_shared_zone ` size `
199
+
200
+ ** Default:** 262k
201
+
202
+ ** Context:** http
203
+
204
+ An optional directive that allows increasing the size of in-memory storage of
205
+ the module.
206
+ The shared memory zone will be used to store the issued certificates, keys and
207
+ challenge data for all the configured certificate issuers.
208
+
209
+ ### acme_certificate
210
+
211
+ ** Syntax:** acme_certificate ` issuer ` ` identifier ` ... [ ` key ` = ` alg[:size] ` | ` file ` ]
212
+
213
+ ** Default:** -
214
+
215
+ ** Context:** server
216
+
217
+ Defines a certificate with the list of ` identifier ` s requested from
218
+ issuer ` issuer ` .
219
+ The ` key ` parameter sets the type of generated private key or a
220
+ path to an existing file. Supported key algorithms and sizes:
221
+ ` ecdsa:256 ` (default), ` ecdsa:384 ` ,
222
+ ` ecdsa:521 ` ,
223
+ ` rsa:2048 ` .. ` rsa:4096 ` .
224
+
225
+ > Since 1.27.2, the ` key ` parameter supports the additional schemes implemented in the
226
+ > [ ssl_certificate_key] ( https://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_certificate_key )
227
+ > directive: ` data: ` , ` engine: ` and more recently ` store: ` ,
228
+ > with a caveat that password-protected keys are not supported.
229
+
230
+ ## Embedded Variables
231
+
232
+ The ` ngx_http_acme_module ` module defines following embedded
233
+ variables, valid in the ` server ` block with the
234
+ [ acme_certificate] ( #acme_certificate ) directive:
235
+
236
+ ### `` $acme_certificate ``
237
+
238
+ SSL certificate that can be passed to the
239
+ [ ssl_certificate] ( https://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_certificate ) .
240
+
241
+ ### `` $acme_certificate_key ``
242
+
243
+ SSL certificate private key that can be passed to the
244
+ [ ssl_certificate_key] ( https://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_certificate_key ) .
46
245
47
246
## License
48
247
0 commit comments