Skip to content

Commit 20666cf

Browse files
committed
Merge /httpd/httpd/trunk:r1927807,1927874,1928039,1928839,1928861
mod_md: update to version 2.6.2 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1929515 13f79535-47bb-0310-9956-ffa450edef68
1 parent db3f223 commit 20666cf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+720
-798
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ SET(mod_md_extra_sources
502502
modules/md/md_ocsp.c modules/md/md_util.c
503503
modules/md/mod_md_config.c modules/md/mod_md_drive.c
504504
modules/md/mod_md_os.c modules/md/mod_md_status.c
505-
modules/md/mod_md_ocsp.c modules/md/md_tailscale.c
505+
modules/md/mod_md_ocsp.c
506506
)
507507
SET(mod_optional_hook_export_extra_defines AP_DECLARE_EXPORT) # bogus reuse of core API prefix
508508
SET(mod_proxy_extra_defines PROXY_DECLARE_EXPORT)

STATUS

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -178,18 +178,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
178178
PATCHES PROPOSED TO BACKPORT FROM TRUNK:
179179
[ New proposals should be added at the end of the list ]
180180

181-
*) mod_md: update to version 2.6.2
182-
trunk patch:
183-
http://svn.apache.org/r1927807
184-
http://svn.apache.org/r1927874
185-
http://svn.apache.org/r1928039
186-
http://svn.apache.org/r1928839
187-
2.4.x patch: svn merge -c 1927807,1927874,1928039,1928839 ^/httpd/httpd/trunk .
188-
Might need some resolving in test code, as trunk and 2.4.x
189-
are not in sync.
190-
+1: icing, rpluem, jorton
191-
rpluem says: Don't we need to add r1928861 as well to fix the LOGNO's?
192-
193181
*) various: Update DOCTYPE tags in server-generated HTML to 4.01
194182
Trunk version of patch:
195183
https://svn.apache.org/r1873397

changes-entries/md_v2.6.1.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
*) mod_md: update to version 2.6.1
2+
- Increasing default `MDRetryDelay` to 30 seconds to generate less bursty
3+
traffic on errored renewals for the ACME CA. This leads to error retries
4+
of 30s, 1 minute, 2, 4, etc. up to daily attempts.
5+
- Checking that configuring `MDRetryDelay` will result in a positive
6+
duration. A delay of 0 is not accepted.
7+
- Fix a bug in checking Content-Type of responses from the ACME server.
8+
- Added ACME ARI support (rfc9773) to the module. Enabled by default. New
9+
directive "MDRenewViaARI on|off" for controlling this.
10+
- Removing tailscale support. It has not been working for a long time
11+
as the company decided to change their APIs. Away with the dead code,
12+
documentation and tests.
13+
- Fixed a compilation issue with pre-industrial versions of libcurl.

changes-entries/md_v2.6.2.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*) mod_md: update to version 2.6.2
2+
- Fix error retry delay calculation to not already doubling the wait
3+
on the first error.

docs/manual/mod/mod_md.xml

Lines changed: 27 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -285,44 +285,6 @@ MDChallengeDns01 /usr/bin/acme-setup-dns
285285
</p>
286286
</note>
287287

288-
<note><title>tailscale</title>
289-
<p>
290-
Since version 2.4.14 of the module, you can use it to get certificates
291-
for your <a href="https://tailscale.com">tailscale</a> domains.
292-
</p>
293-
<highlight language="config">
294-
&lt;MDomain mydomain.some-thing.ts.net>
295-
MDCertificateProtocol tailscale
296-
MDCertificateAuthority file://localhost/var/run/tailscale/tailscaled.sock",
297-
&lt;/MDomain>
298-
</highlight>
299-
<p>
300-
Tailscale provides secure networking between your machines, where ever
301-
they are, and can provide domain names in the *.ts.net space for them.
302-
For those, it will then provide Let's Encrypt certificates as well, so
303-
you can open these domains in your browser securely.
304-
</p>
305-
<p>
306-
The directives listed above tell Apache to contact the local tailscale
307-
demon for obtaining and renewing certificates. This will only work for
308-
the domain name that tailscale assigns to your machine.
309-
</p>
310-
<p>
311-
Otherwise, these certificates work exactly like the ones retrieved
312-
via the ACME protocol from Lets Encrypt. You see them in status reporting
313-
and MDMessageCmd directives are executed for them as well.
314-
</p>
315-
<p>
316-
More details are <a href="https://github.com/icing/mod_md#tailscale">
317-
available at the mod_md github documentation</a>.
318-
</p>
319-
<p>
320-
Note that this feature only works on machines where the tailscale
321-
demon provides a unix domain socket. This, so far, seems only the
322-
case on *nix systems.
323-
</p>
324-
</note>
325-
326288
</summary>
327289

328290
<directivesynopsis>
@@ -1393,7 +1355,7 @@ MDMessageCmd /etc/apache/md-message
13931355
<name>MDRetryDelay</name>
13941356
<description>Time length for first retry, doubled on every consecutive error.</description>
13951357
<syntax>MDRetryDelay <var>duration</var></syntax>
1396-
<default>MDRetryDelay 5s</default>
1358+
<default>MDRetryDelay 30s</default>
13971359
<contextlist>
13981360
<context>server config</context>
13991361
</contextlist>
@@ -1408,6 +1370,10 @@ MDMessageCmd /etc/apache/md-message
14081370
It is kept separate for each certificate renewal. Meaning an error
14091371
on one MDomain does not delay the renewals of other domains.
14101372
</p>
1373+
<p>
1374+
In mod_md v2.6.1, the default delay has been increased from 5
1375+
seconds to 30.
1376+
</p>
14111377
</usage>
14121378
</directivesynopsis>
14131379

@@ -1594,4 +1560,26 @@ MDMessageCmd /etc/apache/md-message
15941560
</p>
15951561
</usage>
15961562
</directivesynopsis>
1563+
1564+
<directivesynopsis>
1565+
<name>MDRenewViaARI</name>
1566+
<description>usage of the ACME ARI extension (rfc9773).</description>
1567+
<syntax>MDRenewViaARI on|off</syntax>
1568+
<default>MDRenewViaARI on</default>
1569+
<contextlist>
1570+
<context>server config</context>
1571+
</contextlist>
1572+
<usage>
1573+
<p>
1574+
En-/Disable certificate renewals triggered via the ACME ARI
1575+
extension (rfc9773). These renewals happen *in addition* to
1576+
the mechanism controlled by <directive>MDRenewWindow</directive>.
1577+
</p><p>
1578+
ACME ARI allows an ACME CA to somewhat shape incoming renewal
1579+
traffic. More importantly though, it can inform clients of
1580+
urgent renewals, e.g. when a certificate or part of its chain
1581+
has been revoked.
1582+
</p>
1583+
</usage>
1584+
</directivesynopsis>
15971585
</modulesynopsis>

modules/md/config2.m4

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,6 @@ md_reg.lo dnl
264264
md_status.lo dnl
265265
md_store.lo dnl
266266
md_store_fs.lo dnl
267-
md_tailscale.lo dnl
268267
md_time.lo dnl
269268
md_util.lo dnl
270269
mod_md.lo dnl

modules/md/md.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ struct md_t {
9494
const char *ca_eab_hmac; /* optional HMAC for external account binding */
9595
const char *profile; /* optional cert profile to order */
9696
int profile_mandatory; /* if profile, when given, is mandatory */
97+
int ari_renewals; /* if ACME ARI (RFC 9773) can trigger renewals */
9798

9899
const char *state_descr; /* description of state of NULL */
99100

@@ -119,6 +120,8 @@ struct md_t {
119120
#define MD_KEY_ACTIVATION_DELAY "activation-delay"
120121
#define MD_KEY_ACTIVITY "activity"
121122
#define MD_KEY_AGREEMENT "agreement"
123+
#define MD_KEY_ARI_CERT_ID "ari-cert-id"
124+
#define MD_KEY_ARI_RENEWALS "ari-renewals"
122125
#define MD_KEY_AUTHORIZATIONS "authorizations"
123126
#define MD_KEY_BITS "bits"
124127
#define MD_KEY_CA "ca"

modules/md/md_acme.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ static apr_status_t problem_status_get(const char *type) {
8181
}
8282

8383
for(i = 0; i < (sizeof(Problems)/sizeof(Problems[0])); ++i) {
84-
if (!apr_strnatcasecmp(type, Problems[i].type)) {
84+
if (!apr_cstr_casecmp(type, Problems[i].type)) {
8585
return Problems[i].rv;
8686
}
8787
}
@@ -100,7 +100,7 @@ int md_acme_problem_is_input_related(const char *problem) {
100100
}
101101

102102
for(i = 0; i < (sizeof(Problems)/sizeof(Problems[0])); ++i) {
103-
if (!apr_strnatcasecmp(problem, Problems[i].type)) {
103+
if (!apr_cstr_casecmp(problem, Problems[i].type)) {
104104
return Problems[i].input_related;
105105
}
106106
}
@@ -332,7 +332,7 @@ static apr_status_t acmev2_GET_as_POST_init(md_acme_req_t *req, void *baton)
332332
return md_acme_req_body_init(req, NULL);
333333
}
334334

335-
static apr_status_t md_acme_req_send(md_acme_req_t *req)
335+
static apr_status_t md_acme_req_send(md_acme_req_t *req, int get_as_post)
336336
{
337337
apr_status_t rv;
338338
md_acme_t *acme = req->acme;
@@ -352,7 +352,7 @@ static apr_status_t md_acme_req_send(md_acme_req_t *req)
352352
if (APR_SUCCESS != rv) goto leave;
353353
}
354354

355-
if (!strcmp("GET", req->method) && !req->on_init && !req->req_json) {
355+
if (get_as_post && !strcmp("GET", req->method) && !req->on_init && !req->req_json) {
356356
/* See <https://ietf-wg-acme.github.io/acme/draft-ietf-acme-acme.html#rfc.section.6.3>
357357
* and <https://mailarchive.ietf.org/arch/msg/acme/sotffSQ0OWV-qQJodLwWYWcEVKI>
358358
* and <https://community.letsencrypt.org/t/acme-v2-scheduled-deprecation-of-unauthenticated-resource-gets/74380>
@@ -420,7 +420,7 @@ static apr_status_t md_acme_req_send(md_acme_req_t *req)
420420

421421
if (APR_EAGAIN == rv && req->max_retries > 0) {
422422
--req->max_retries;
423-
rv = md_acme_req_send(req);
423+
rv = md_acme_req_send(req, 1);
424424
}
425425
req = NULL;
426426

@@ -449,14 +449,15 @@ apr_status_t md_acme_POST(md_acme_t *acme, const char *url,
449449
req->on_err = on_err;
450450
req->baton = baton;
451451

452-
return md_acme_req_send(req);
452+
return md_acme_req_send(req, 1);
453453
}
454454

455455
apr_status_t md_acme_GET(md_acme_t *acme, const char *url,
456456
md_acme_req_init_cb *on_init,
457457
md_acme_req_json_cb *on_json,
458458
md_acme_req_res_cb *on_res,
459-
md_acme_req_err_cb *on_err,
459+
md_acme_req_err_cb *on_err,
460+
int get_as_post,
460461
void *baton)
461462
{
462463
md_acme_req_t *req;
@@ -472,7 +473,7 @@ apr_status_t md_acme_GET(md_acme_t *acme, const char *url,
472473
req->on_err = on_err;
473474
req->baton = baton;
474475

475-
return md_acme_req_send(req);
476+
return md_acme_req_send(req, get_as_post);
476477
}
477478

478479
void md_acme_report_result(md_acme_t *acme, apr_status_t rv, struct md_result_t *result)
@@ -507,15 +508,15 @@ static apr_status_t on_got_json(md_acme_t *acme, apr_pool_t *p, const apr_table_
507508
}
508509

509510
apr_status_t md_acme_get_json(struct md_json_t **pjson, md_acme_t *acme,
510-
const char *url, apr_pool_t *p)
511+
const char *url, int get_as_post, apr_pool_t *p)
511512
{
512513
apr_status_t rv;
513514
json_ctx ctx;
514515

515516
ctx.pool = p;
516517
ctx.json = NULL;
517518

518-
rv = md_acme_GET(acme, url, NULL, on_got_json, NULL, NULL, &ctx);
519+
rv = md_acme_GET(acme, url, NULL, on_got_json, NULL, NULL, get_as_post, &ctx);
519520
*pjson = (APR_SUCCESS == rv)? ctx.json : NULL;
520521
return rv;
521522
}
@@ -720,6 +721,7 @@ static apr_status_t update_directory(const md_http_response_t *res, void *data)
720721
acme->api.v2.revoke_cert = md_json_dups(acme->p, json, "revokeCert", NULL);
721722
acme->api.v2.key_change = md_json_dups(acme->p, json, "keyChange", NULL);
722723
acme->api.v2.new_nonce = md_json_dups(acme->p, json, "newNonce", NULL);
724+
acme->api.v2.renewal_info = md_json_dups(acme->p, json, "renewalInfo", NULL);
723725
/* RFC 8555 only requires "directory" and "newNonce" resources.
724726
* mod_md uses "newAccount" and "newOrder" so check for them.
725727
* But mod_md does not use the "revokeCert" or "keyChange"

modules/md/md_acme.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ struct md_acme_t {
118118
const char *key_change;
119119
const char *revoke_cert;
120120
const char *new_nonce;
121+
const char *renewal_info;
121122
struct apr_array_header_t *profiles;
122123
} v2;
123124
} api;
@@ -275,6 +276,7 @@ apr_status_t md_acme_GET(md_acme_t *acme, const char *url,
275276
md_acme_req_json_cb *on_json,
276277
md_acme_req_res_cb *on_res,
277278
md_acme_req_err_cb *on_err,
279+
int get_as_post,
278280
void *baton);
279281
/**
280282
* Perform a POST against the ACME url. If a on_json callback is given and
@@ -301,7 +303,7 @@ apr_status_t md_acme_POST(md_acme_t *acme, const char *url,
301303
* Retrieve a JSON resource from the ACME server
302304
*/
303305
apr_status_t md_acme_get_json(struct md_json_t **pjson, md_acme_t *acme,
304-
const char *url, apr_pool_t *p);
306+
const char *url, int get_as_post, apr_pool_t *p);
305307

306308

307309
apr_status_t md_acme_req_body_init(md_acme_req_t *req, struct md_json_t *jpayload);

modules/md/md_acme_authz.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ apr_status_t md_acme_authz_update(md_acme_authz_t *authz, md_acme_t *acme, apr_p
131131
err = "unable to parse response";
132132
log_level = MD_LOG_ERR;
133133

134-
if (APR_SUCCESS == (rv = md_acme_get_json(&json, acme, authz->url, p))
134+
if (APR_SUCCESS == (rv = md_acme_get_json(&json, acme, authz->url, 1, p))
135135
&& (s = md_json_gets(json, MD_KEY_STATUS, NULL))) {
136136

137137
authz->domain = md_json_gets(json, MD_KEY_IDENTIFIER, MD_KEY_VALUE, NULL);
@@ -594,7 +594,7 @@ static apr_status_t find_type(void *baton, size_t index, md_json_t *json)
594594
cha_find_ctx *ctx = baton;
595595

596596
const char *ctype = md_json_gets(json, MD_KEY_TYPE, NULL);
597-
if (ctype && !apr_strnatcasecmp(ctx->type, ctype)) {
597+
if (ctype && !apr_cstr_casecmp(ctx->type, ctype)) {
598598
ctx->accepted = cha_from_json(ctx->p, index, json);
599599
return 0;
600600
}
@@ -644,7 +644,7 @@ apr_status_t md_acme_authz_respond(md_acme_authz_t *authz, md_acme_t *acme, md_s
644644

645645
if (fctx.accepted) {
646646
for (j = 0; j < (int)CHA_TYPES_LEN; ++j) {
647-
if (!apr_strnatcasecmp(CHA_TYPES[j].name, fctx.accepted->type)) {
647+
if (!apr_cstr_casecmp(CHA_TYPES[j].name, fctx.accepted->type)) {
648648
md_result_activity_printf(result, "Setting up challenge '%s' for domain %s",
649649
fctx.accepted->type, authz->domain);
650650
rv = CHA_TYPES[j].setup(fctx.accepted, authz, acme, store, key_specs,
@@ -702,7 +702,7 @@ apr_status_t md_acme_authz_teardown(struct md_store_t *store, const char *token,
702702
domain = strchr(challenge, ':');
703703
*domain = '\0'; domain++;
704704
for (i = 0; i < (int)CHA_TYPES_LEN; ++i) {
705-
if (!apr_strnatcasecmp(CHA_TYPES[i].name, challenge)) {
705+
if (!apr_cstr_casecmp(CHA_TYPES[i].name, challenge)) {
706706
if (CHA_TYPES[i].teardown) {
707707
return CHA_TYPES[i].teardown(store, domain, md, env, p);
708708
}

0 commit comments

Comments
 (0)