Apache HTTPD
mod_md_config.c
Go to the documentation of this file.
1/* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include <assert.h>
18
19#include <apr_lib.h>
20#include <apr_strings.h>
21
22#include <httpd.h>
23#include <http_core.h>
24#include <http_config.h>
25#include <http_log.h>
26#include <http_vhost.h>
27
28#include "md.h"
29#include "md_acme.h"
30#include "md_crypt.h"
31#include "md_log.h"
32#include "md_json.h"
33#include "md_util.h"
34#include "mod_md_private.h"
35#include "mod_md_config.h"
36
37#define MD_CMD_MD_SECTION "<MDomainSet"
38#define MD_CMD_MD2_SECTION "<MDomain"
39
40#define DEF_VAL (-1)
41
42#ifndef MD_DEFAULT_BASE_DIR
43#define MD_DEFAULT_BASE_DIR "md"
44#endif
45
50
55
56/* Default settings for the global conf */
58 NULL, /* list of mds */
59#if AP_MODULE_MAGIC_AT_LEAST(20180906, 2)
60 NULL, /* base dirm by default state-dir-relative */
61#else
63#endif
64 NULL, /* proxy url for outgoing http */
65 NULL, /* md_reg_t */
66 NULL, /* md_ocsp_reg_t */
67 80, /* local http: port */
68 443, /* local https: port */
69 -1, /* can http: */
70 -1, /* can https: */
71 0, /* manage base server */
72 MD_HSTS_MAX_AGE_DEFAULT, /* hsts max-age */
73 NULL, /* hsts headers */
74 NULL, /* unused names */
75 NULL, /* init errors hash */
76 NULL, /* notify cmd */
77 NULL, /* message cmd */
78 NULL, /* env table */
79 0, /* dry_run flag */
80 1, /* server_status_enabled */
81 1, /* certificate_status_enabled */
82 &def_ocsp_keep_window, /* default time to keep ocsp responses */
83 &def_ocsp_renew_window, /* default time to renew ocsp responses */
84 "crt.sh", /* default cert checker site name */
85 "https://crt.sh?q=", /* default cert checker site url */
86 NULL, /* CA cert file to use */
87 apr_time_from_sec(MD_SECS_PER_DAY/2), /* default time between cert checks */
88 apr_time_from_sec(5), /* minimum delay for retries */
89 13, /* retry_failover after 14 errors, with 5s delay ~ half a day */
90 0, /* store locks, disabled by default */
91 apr_time_from_sec(5), /* max time to wait to obaint a store lock */
92 MD_MATCH_ALL, /* match vhost severname and aliases */
93};
94
103
104/* Default server specific setting */
106 "default", /* name */
107 NULL, /* server_rec */
108 &defmc, /* mc */
109 1, /* transitive */
110 MD_REQUIRE_OFF, /* require https */
111 MD_RENEW_AUTO, /* renew mode */
112 0, /* must staple */
113 NULL, /* pkey spec */
114 &def_renew_window, /* renew window */
115 &def_warn_window, /* warn window */
116 NULL, /* ca urls */
117 NULL, /* ca contact (email) */
118 MD_PROTO_ACME, /* ca protocol */
119 NULL, /* ca agreemnent */
120 NULL, /* ca challenges array */
121 NULL, /* ca eab kid */
122 NULL, /* ca eab hmac */
123 0, /* stapling */
124 1, /* staple others */
125 NULL, /* dns01_cmd */
126 NULL, /* currently defined md */
127 NULL, /* assigned md, post config */
128 0, /* is_ssl, set during mod_ssl post_config */
129};
130
132
134{
135 (void)dummy;
137 return APR_SUCCESS;
138}
139
141{
142 if (mod_md_config) {
143 return mod_md_config; /* reused for lifetime of the pool */
144 }
145
146 if (create) {
149 mod_md_config->mds = apr_array_make(pool, 5, sizeof(const md_t *));
150 mod_md_config->unused_names = apr_array_make(pool, 5, sizeof(const md_t *));
153
155 }
156
157 return mod_md_config;
158}
159
160#define CONF_S_NAME(s) (s && s->server_hostname? s->server_hostname : "default")
161
163{
164 sc->transitive = DEF_VAL;
166 sc->renew_mode = DEF_VAL;
167 sc->must_staple = DEF_VAL;
168 sc->pks = NULL;
169 sc->renew_window = NULL;
170 sc->warn_window = NULL;
171 sc->ca_urls = NULL;
172 sc->ca_contact = NULL;
173 sc->ca_proto = NULL;
174 sc->ca_agreement = NULL;
175 sc->ca_challenges = NULL;
176 sc->ca_eab_kid = NULL;
177 sc->ca_eab_hmac = NULL;
178 sc->stapling = DEF_VAL;
180 sc->dns01_cmd = NULL;
181}
182
184{
185 to->transitive = from->transitive;
186 to->require_https = from->require_https;
187 to->renew_mode = from->renew_mode;
188 to->must_staple = from->must_staple;
189 to->pks = from->pks;
190 to->warn_window = from->warn_window;
191 to->renew_window = from->renew_window;
192 to->ca_urls = from->ca_urls;
193 to->ca_contact = from->ca_contact;
194 to->ca_proto = from->ca_proto;
195 to->ca_agreement = from->ca_agreement;
196 to->ca_challenges = from->ca_challenges;
197 to->ca_eab_kid = from->ca_eab_kid;
198 to->ca_eab_hmac = from->ca_eab_hmac;
199 to->stapling = from->stapling;
200 to->staple_others = from->staple_others;
201 to->dns01_cmd = from->dns01_cmd;
202}
203
204static void srv_conf_props_apply(md_t *md, const md_srv_conf_t *from, apr_pool_t *p)
205{
207 if (from->transitive != DEF_VAL) md->transitive = from->transitive;
208 if (from->renew_mode != DEF_VAL) md->renew_mode = from->renew_mode;
209 if (from->must_staple != DEF_VAL) md->must_staple = from->must_staple;
210 if (from->pks) md->pks = md_pkeys_spec_clone(p, from->pks);
211 if (from->renew_window) md->renew_window = from->renew_window;
212 if (from->warn_window) md->warn_window = from->warn_window;
213 if (from->ca_urls) md->ca_urls = apr_array_copy(p, from->ca_urls);
214 if (from->ca_proto) md->ca_proto = from->ca_proto;
215 if (from->ca_agreement) md->ca_agreement = from->ca_agreement;
216 if (from->ca_contact) {
218 APR_ARRAY_PUSH(md->contacts, const char *) =
219 md_util_schemify(p, from->ca_contact, "mailto");
220 }
222 if (from->ca_eab_kid) md->ca_eab_kid = from->ca_eab_kid;
223 if (from->ca_eab_hmac) md->ca_eab_hmac = from->ca_eab_hmac;
224 if (from->stapling != DEF_VAL) md->stapling = from->stapling;
225 if (from->dns01_cmd) md->dns01_cmd = from->dns01_cmd;
226}
227
229{
231
232 conf->name = apr_pstrcat(pool, "srv[", CONF_S_NAME(s), "]", NULL);
233 conf->s = s;
234 conf->mc = md_mod_conf_get(pool, 1);
235
237
238 return conf;
239}
240
241static void *md_config_merge(apr_pool_t *pool, void *basev, void *addv)
242{
246 char *name = apr_pstrcat(pool, "[", CONF_S_NAME(add->s), ", ", CONF_S_NAME(base->s), "]", NULL);
247
249 nsc->name = name;
250 nsc->mc = add->mc? add->mc : base->mc;
251
252 nsc->transitive = (add->transitive != DEF_VAL)? add->transitive : base->transitive;
253 nsc->require_https = (add->require_https != MD_REQUIRE_UNSET)? add->require_https : base->require_https;
254 nsc->renew_mode = (add->renew_mode != DEF_VAL)? add->renew_mode : base->renew_mode;
255 nsc->must_staple = (add->must_staple != DEF_VAL)? add->must_staple : base->must_staple;
256 nsc->pks = (!md_pkeys_spec_is_empty(add->pks))? add->pks : base->pks;
257 nsc->renew_window = add->renew_window? add->renew_window : base->renew_window;
258 nsc->warn_window = add->warn_window? add->warn_window : base->warn_window;
259
260 nsc->ca_urls = add->ca_urls? apr_array_copy(pool, add->ca_urls)
261 : (base->ca_urls? apr_array_copy(pool, base->ca_urls) : NULL);
262 nsc->ca_contact = add->ca_contact? add->ca_contact : base->ca_contact;
263 nsc->ca_proto = add->ca_proto? add->ca_proto : base->ca_proto;
264 nsc->ca_agreement = add->ca_agreement? add->ca_agreement : base->ca_agreement;
265 nsc->ca_challenges = (add->ca_challenges? apr_array_copy(pool, add->ca_challenges)
266 : (base->ca_challenges? apr_array_copy(pool, base->ca_challenges) : NULL));
267 nsc->ca_eab_kid = add->ca_eab_kid? add->ca_eab_kid : base->ca_eab_kid;
268 nsc->ca_eab_hmac = add->ca_eab_hmac? add->ca_eab_hmac : base->ca_eab_hmac;
269 nsc->stapling = (add->stapling != DEF_VAL)? add->stapling : base->stapling;
270 nsc->staple_others = (add->staple_others != DEF_VAL)? add->staple_others : base->staple_others;
271 nsc->dns01_cmd = (add->dns01_cmd)? add->dns01_cmd : base->dns01_cmd;
272 nsc->current = NULL;
273
274 return nsc;
275}
276
278{
279 return md_config_merge(pool, basev, addv);
280}
281
282static int inside_section(cmd_parms *cmd, const char *section) {
284 for (d = cmd->directive->parent; d; d = d->parent) {
285 if (!ap_cstr_casecmp(d->directive, section)) {
286 return 1;
287 }
288 }
289 return 0;
290}
291
295
296static const char *md_section_check(cmd_parms *cmd) {
297 if (!inside_md_section(cmd)) {
298 return apr_pstrcat(cmd->pool, cmd->cmd->name, " is only valid inside a '",
299 MD_CMD_MD_SECTION, "' context, not here", NULL);
300 }
301 return NULL;
302}
303
304#define MD_LOC_GLOBAL (0x01)
305#define MD_LOC_MD (0x02)
306#define MD_LOC_ELSE (0x04)
307#define MD_LOC_ALL (0x07)
308#define MD_LOC_NOT_MD (0x102)
309
310static const char *md_conf_check_location(cmd_parms *cmd, int flags)
311{
312 if (MD_LOC_GLOBAL == flags) {
314 }
316 return apr_pstrcat(cmd->pool, cmd->cmd->name, " is not allowed inside an '",
317 MD_CMD_MD_SECTION, "' context", NULL);
318 }
319 if (MD_LOC_MD == flags) {
320 return md_section_check(cmd);
321 }
322 else if ((MD_LOC_MD & flags) && inside_md_section(cmd)) {
323 return NULL;
324 }
326}
327
328static const char *set_on_off(int *pvalue, const char *s, apr_pool_t *p)
329{
330 if (!apr_strnatcasecmp("off", s)) {
331 *pvalue = 0;
332 }
333 else if (!apr_strnatcasecmp("on", s)) {
334 *pvalue = 1;
335 }
336 else {
337 return apr_pstrcat(p, "unknown '", s,
338 "', supported parameter values are 'on' and 'off'", NULL);
339 }
340 return NULL;
341}
342
343
344static void add_domain_name(apr_array_header_t *domains, const char *name, apr_pool_t *p)
345{
346 if (md_array_str_index(domains, name, 0, 0) < 0) {
348 }
349}
350
351static const char *set_transitive(int *ptransitive, const char *value)
352{
353 if (!apr_strnatcasecmp("auto", value)) {
354 *ptransitive = 1;
355 return NULL;
356 }
357 else if (!apr_strnatcasecmp("manual", value)) {
358 *ptransitive = 0;
359 return NULL;
360 }
361 return "unknown value, use \"auto|manual\"";
362}
363
364static const char *md_config_sec_start(cmd_parms *cmd, void *mconfig, const char *arg)
365{
366 md_srv_conf_t *sc;
367 md_srv_conf_t save;
368 const char *endp;
369 const char *err, *name;
370 apr_array_header_t *domains;
371 md_t *md;
372 int transitive = -1;
373
374 (void)mconfig;
376 return err;
377 }
378
379 sc = md_config_get(cmd->server);
380 endp = ap_strrchr_c(arg, '>');
381 if (endp == NULL) {
382 return MD_CMD_MD_SECTION "> directive missing closing '>'";
383 }
384
385 arg = apr_pstrndup(cmd->pool, arg, (apr_size_t)(endp-arg));
386 if (!arg || !*arg) {
387 return MD_CMD_MD_SECTION " > section must specify a unique domain name";
388 }
389
390 name = ap_getword_conf(cmd->pool, &arg);
391 domains = apr_array_make(cmd->pool, 5, sizeof(const char *));
392 add_domain_name(domains, name, cmd->pool);
393 while (*arg != '\0') {
394 name = ap_getword_conf(cmd->pool, &arg);
395 if (NULL != set_transitive(&transitive, name)) {
396 add_domain_name(domains, name, cmd->pool);
397 }
398 }
399
400 if (domains->nelts == 0) {
401 return "needs at least one domain name";
402 }
403
404 md = md_create(cmd->pool, domains);
405 if (transitive >= 0) {
406 md->transitive = transitive;
407 }
408
409 /* Save the current settings in this srv_conf and apply+restore at the
410 * end of this section */
411 memcpy(&save, sc, sizeof(save));
413 sc->current = md;
414
415 if (NULL == (err = ap_walk_config(cmd->directive->first_child, cmd, cmd->context))) {
416 srv_conf_props_apply(md, sc, cmd->pool);
417 APR_ARRAY_PUSH(sc->mc->mds, const md_t *) = md;
418 }
419
420 sc->current = NULL;
421 srv_conf_props_copy(sc, &save);
422
423 return err;
424}
425
426static const char *md_config_sec_add_members(cmd_parms *cmd, void *dc,
427 int argc, char *const argv[])
428{
429 md_srv_conf_t *sc = md_config_get(cmd->server);
430 const char *err;
431 int i;
432
433 (void)dc;
434 if (NULL != (err = md_section_check(cmd))) {
435 if (argc == 1) {
436 /* only these values are allowed outside a section */
437 return set_transitive(&sc->transitive, argv[0]);
438 }
439 return err;
440 }
441
442 assert(sc->current);
443 for (i = 0; i < argc; ++i) {
444 if (NULL != set_transitive(&sc->transitive, argv[i])) {
446 }
447 }
448 return NULL;
449}
450
451static const char *md_config_set_names(cmd_parms *cmd, void *dc,
452 int argc, char *const argv[])
453{
454 md_srv_conf_t *sc = md_config_get(cmd->server);
455 apr_array_header_t *domains = apr_array_make(cmd->pool, 5, sizeof(const char *));
456 const char *err;
457 md_t *md;
458 int i, transitive = -1;
459
460 (void)dc;
462 return err;
463 }
464
465 for (i = 0; i < argc; ++i) {
466 if (NULL != set_transitive(&transitive, argv[i])) {
467 add_domain_name(domains, argv[i], cmd->pool);
468 }
469 }
470
471 if (domains->nelts == 0) {
472 return "needs at least one domain name";
473 }
474 md = md_create(cmd->pool, domains);
475
476 if (transitive >= 0) {
477 md->transitive = transitive;
478 }
479
480 if (cmd->config_file) {
481 md->defn_name = cmd->config_file->name;
482 md->defn_line_number = cmd->config_file->line_number;
483 }
484
485 APR_ARRAY_PUSH(sc->mc->mds, md_t *) = md;
486
487 return NULL;
488}
489
490static const char *md_config_set_ca(cmd_parms *cmd, void *dc,
491 int argc, char *const argv[])
492{
493 md_srv_conf_t *sc = md_config_get(cmd->server);
494 const char *err, *url;
495 int i;
496
497 (void)dc;
499 return err;
500 }
501 if (!sc->ca_urls) {
502 sc->ca_urls = apr_array_make(cmd->pool, 3, sizeof(const char *));
503 }
504 else {
506 }
507 for (i = 0; i < argc; ++i) {
508 if (APR_SUCCESS != md_get_ca_url_from_name(&url, cmd->pool, argv[i])) {
509 return url;
510 }
511 APR_ARRAY_PUSH(sc->ca_urls, const char *) = url;
512 }
513 return NULL;
514}
515
516static const char *md_config_set_contact(cmd_parms *cmd, void *dc, const char *value)
517{
518 md_srv_conf_t *sc = md_config_get(cmd->server);
519 const char *err;
520
521 (void)dc;
523 return err;
524 }
525 sc->ca_contact = value;
526 return NULL;
527}
528
529static const char *md_config_set_ca_proto(cmd_parms *cmd, void *dc, const char *value)
530{
531 md_srv_conf_t *config = md_config_get(cmd->server);
532 const char *err;
533
534 (void)dc;
536 return err;
537 }
538 config->ca_proto = value;
539 return NULL;
540}
541
542static const char *md_config_set_agreement(cmd_parms *cmd, void *dc, const char *value)
543{
544 md_srv_conf_t *config = md_config_get(cmd->server);
545 const char *err;
546
547 (void)dc;
549 return err;
550 }
551 config->ca_agreement = value;
552 return NULL;
553}
554
555static const char *md_config_set_renew_mode(cmd_parms *cmd, void *dc, const char *value)
556{
557 md_srv_conf_t *config = md_config_get(cmd->server);
558 const char *err;
559 md_renew_mode_t renew_mode;
560
561 (void)dc;
562 if (!apr_strnatcasecmp("auto", value) || !apr_strnatcasecmp("automatic", value)) {
563 renew_mode = MD_RENEW_AUTO;
564 }
565 else if (!apr_strnatcasecmp("always", value)) {
566 renew_mode = MD_RENEW_ALWAYS;
567 }
568 else if (!apr_strnatcasecmp("manual", value) || !apr_strnatcasecmp("stick", value)) {
569 renew_mode = MD_RENEW_MANUAL;
570 }
571 else {
572 return apr_pstrcat(cmd->pool, "unknown MDDriveMode ", value, NULL);
573 }
574
576 return err;
577 }
578 config->renew_mode = renew_mode;
579 return NULL;
580}
581
582static const char *md_config_set_must_staple(cmd_parms *cmd, void *dc, const char *value)
583{
584 md_srv_conf_t *config = md_config_get(cmd->server);
585 const char *err;
586
587 (void)dc;
589 return err;
590 }
591 return set_on_off(&config->must_staple, value, cmd->pool);
592}
593
594static const char *md_config_set_stapling(cmd_parms *cmd, void *dc, const char *value)
595{
596 md_srv_conf_t *config = md_config_get(cmd->server);
597 const char *err;
598
599 (void)dc;
601 return err;
602 }
603 return set_on_off(&config->stapling, value, cmd->pool);
604}
605
606static const char *md_config_set_staple_others(cmd_parms *cmd, void *dc, const char *value)
607{
608 md_srv_conf_t *config = md_config_get(cmd->server);
609 const char *err;
610
611 (void)dc;
613 return err;
614 }
615 return set_on_off(&config->staple_others, value, cmd->pool);
616}
617
618static const char *md_config_set_base_server(cmd_parms *cmd, void *dc, const char *value)
619{
620 md_srv_conf_t *config = md_config_get(cmd->server);
622
623 (void)dc;
624 if (err) return err;
625 return set_on_off(&config->mc->manage_base_server, value, cmd->pool);
626}
627
628static const char *md_config_set_check_interval(cmd_parms *cmd, void *dc, const char *value)
629{
630 md_srv_conf_t *config = md_config_get(cmd->server);
632 apr_time_t interval;
633
634 (void)dc;
635 if (err) return err;
636 if (md_duration_parse(&interval, value, "s") != APR_SUCCESS) {
637 return "unrecognized duration format";
638 }
639 if (interval < apr_time_from_sec(1)) {
640 return "check interval cannot be less than one second";
641 }
642 config->mc->check_interval = interval;
643 return NULL;
644}
645
646static const char *md_config_set_min_delay(cmd_parms *cmd, void *dc, const char *value)
647{
648 md_srv_conf_t *config = md_config_get(cmd->server);
651
652 (void)dc;
653 if (err) return err;
654 if (md_duration_parse(&delay, value, "s") != APR_SUCCESS) {
655 return "unrecognized duration format";
656 }
657 config->mc->min_delay = delay;
658 return NULL;
659}
660
661static const char *md_config_set_retry_failover(cmd_parms *cmd, void *dc, const char *value)
662{
663 md_srv_conf_t *config = md_config_get(cmd->server);
665 int retry_failover;
666
667 (void)dc;
668 if (err) return err;
669 retry_failover = atoi(value);
670 if (retry_failover <= 0) {
671 return "invalid argument, must be a number > 0";
672 }
673 config->mc->retry_failover = retry_failover;
674 return NULL;
675}
676
677static const char *md_config_set_store_locks(cmd_parms *cmd, void *dc, const char *s)
678{
679 md_srv_conf_t *config = md_config_get(cmd->server);
681 int use_store_locks;
683
684 (void)dc;
685 if (err) {
686 return err;
687 }
688 else if (!apr_strnatcasecmp("off", s)) {
689 use_store_locks = 0;
690 }
691 else if (!apr_strnatcasecmp("on", s)) {
692 use_store_locks = 1;
693 }
694 else {
695 if (md_duration_parse(&wait_time, s, "s") != APR_SUCCESS) {
696 return "neither 'on', 'off' or a duration specified";
697 }
698 use_store_locks = (wait_time != 0);
699 }
700 config->mc->use_store_locks = use_store_locks;
701 if (wait_time) {
702 config->mc->lock_wait_timeout = wait_time;
703 }
704 return NULL;
705}
706
707static const char *md_config_set_match_mode(cmd_parms *cmd, void *dc, const char *s)
708{
709 md_srv_conf_t *config = md_config_get(cmd->server);
711
712 (void)dc;
713 if (err) {
714 return err;
715 }
716 else if (!apr_strnatcasecmp("all", s)) {
717 config->mc->match_mode = MD_MATCH_ALL;
718 }
719 else if (!apr_strnatcasecmp("servernames", s)) {
721 }
722 else {
723 return "invalid argument, must be a 'all' or 'servernames'";
724 }
725 return NULL;
726}
727
728static const char *md_config_set_require_https(cmd_parms *cmd, void *dc, const char *value)
729{
730 md_srv_conf_t *config = md_config_get(cmd->server);
731 const char *err;
732
734 return err;
735 }
736 (void)dc;
737 if (!apr_strnatcasecmp("off", value)) {
739 }
742 }
745 }
746 else {
747 return apr_pstrcat(cmd->pool, "unknown '", value,
748 "', supported parameter values are 'temporary' and 'permanent'", NULL);
749 }
750 return NULL;
751}
752
753static const char *md_config_set_renew_window(cmd_parms *cmd, void *dc, const char *value)
754{
755 md_srv_conf_t *config = md_config_get(cmd->server);
756 const char *err;
757
758 (void)dc;
760 return err;
761 }
763 if (!err && config->renew_window->norm
764 && (config->renew_window->len >= config->renew_window->norm)) {
765 err = "a length of 100% or more is not allowed.";
766 }
767 if (err) return apr_psprintf(cmd->pool, "MDRenewWindow %s", err);
768 return NULL;
769}
770
771static const char *md_config_set_warn_window(cmd_parms *cmd, void *dc, const char *value)
772{
773 md_srv_conf_t *config = md_config_get(cmd->server);
774 const char *err;
775
776 (void)dc;
778 return err;
779 }
781 if (!err && config->warn_window->norm
782 && (config->warn_window->len >= config->warn_window->norm)) {
783 err = "a length of 100% or more is not allowed.";
784 }
785 if (err) return apr_psprintf(cmd->pool, "MDWarnWindow %s", err);
786 return NULL;
787}
788
789static const char *md_config_set_proxy(cmd_parms *cmd, void *arg, const char *value)
790{
791 md_srv_conf_t *sc = md_config_get(cmd->server);
792 const char *err;
793
795 return err;
796 }
798 if (err) {
799 return err;
800 }
801 sc->mc->proxy_url = value;
802 (void)arg;
803 return NULL;
804}
805
806static const char *md_config_set_store_dir(cmd_parms *cmd, void *arg, const char *value)
807{
808 md_srv_conf_t *sc = md_config_get(cmd->server);
809 const char *err;
810
812 return err;
813 }
814 sc->mc->base_dir = value;
815 (void)arg;
816 return NULL;
817}
818
819static const char *set_port_map(md_mod_conf_t *mc, const char *value)
820{
821 int net_port, local_port;
822 const char *endp;
823
824 if (!strncmp("http:", value, sizeof("http:") - 1)) {
825 net_port = 80; endp = value + sizeof("http") - 1;
826 }
827 else if (!strncmp("https:", value, sizeof("https:") - 1)) {
828 net_port = 443; endp = value + sizeof("https") - 1;
829 }
830 else {
831 net_port = (int)apr_strtoi64(value, (char**)&endp, 10);
832 if (errno) {
833 return "unable to parse first port number";
834 }
835 }
836 if (!endp || *endp != ':') {
837 return "no ':' after first port number";
838 }
839 ++endp;
840 if (*endp == '-') {
841 local_port = 0;
842 }
843 else {
844 local_port = (int)apr_strtoi64(endp, (char**)&endp, 10);
845 if (errno) {
846 return "unable to parse second port number";
847 }
849 return "invalid number for port map, must be in ]0,65535]";
850 }
851 }
852 switch (net_port) {
853 case 80:
854 mc->local_80 = local_port;
855 break;
856 case 443:
857 mc->local_443 = local_port;
858 break;
859 default:
860 return "mapped port number must be 80 or 443";
861 }
862 return NULL;
863}
864
865static const char *md_config_set_port_map(cmd_parms *cmd, void *arg,
866 const char *v1, const char *v2)
867{
868 md_srv_conf_t *sc = md_config_get(cmd->server);
869 const char *err;
870
871 (void)arg;
873 err = set_port_map(sc->mc, v1);
874 }
875 if (!err && v2) {
876 err = set_port_map(sc->mc, v2);
877 }
878 return err;
879}
880
881static const char *md_config_set_cha_tyes(cmd_parms *cmd, void *dc,
882 int argc, char *const argv[])
883{
884 md_srv_conf_t *config = md_config_get(cmd->server);
885 apr_array_header_t **pcha, *ca_challenges;
886 const char *err;
887 int i;
888
889 (void)dc;
891 return err;
892 }
893 pcha = &config->ca_challenges;
894
895 ca_challenges = *pcha;
896 if (ca_challenges) {
897 apr_array_clear(ca_challenges);
898 }
899 else {
900 *pcha = ca_challenges = apr_array_make(cmd->pool, 5, sizeof(const char *));
901 }
902 for (i = 0; i < argc; ++i) {
903 APR_ARRAY_PUSH(ca_challenges, const char *) = argv[i];
904 }
905
906 return NULL;
907}
908
909static const char *md_config_set_pkeys(cmd_parms *cmd, void *dc,
910 int argc, char *const argv[])
911{
912 md_srv_conf_t *config = md_config_get(cmd->server);
913 const char *err, *ptype;
914 apr_int64_t bits;
915 int i;
916
917 (void)dc;
919 return err;
920 }
921 if (argc <= 0) {
922 return "needs to specify the private key type";
923 }
924
925 config->pks = md_pkeys_spec_make(cmd->pool);
926 for (i = 0; i < argc; ++i) {
927 ptype = argv[i];
928 if (!apr_strnatcasecmp("Default", ptype)) {
929 if (argc > 1) {
930 return "'Default' allows no other parameter";
931 }
933 }
934 else if (strlen(ptype) > 3
935 && (ptype[0] == 'R' || ptype[0] == 'r')
936 && (ptype[1] == 'S' || ptype[1] == 's')
937 && (ptype[2] == 'A' || ptype[2] == 'a')
938 && isdigit(ptype[3])) {
939 bits = (int)apr_atoi64(ptype+3);
940 if (bits < MD_PKEY_RSA_BITS_MIN) {
941 return apr_psprintf(cmd->pool,
942 "must be %d or higher in order to be considered safe.",
944 }
945 if (bits >= INT_MAX) {
946 return apr_psprintf(cmd->pool, "is too large for an RSA key length.");
947 }
948 if (md_pkeys_spec_contains_rsa(config->pks)) {
949 return "two keys of type 'RSA' are not possible.";
950 }
951 md_pkeys_spec_add_rsa(config->pks, (unsigned int)bits);
952 }
953 else if (!apr_strnatcasecmp("RSA", ptype)) {
954 if (i+1 >= argc || !isdigit(argv[i+1][0])) {
956 }
957 else {
958 ++i;
959 bits = (int)apr_atoi64(argv[i]);
960 if (bits < MD_PKEY_RSA_BITS_MIN) {
961 return apr_psprintf(cmd->pool,
962 "must be %d or higher in order to be considered safe.",
964 }
965 if (bits >= INT_MAX) {
966 return apr_psprintf(cmd->pool, "is too large for an RSA key length.");
967 }
968 }
969 if (md_pkeys_spec_contains_rsa(config->pks)) {
970 return "two keys of type 'RSA' are not possible.";
971 }
972 md_pkeys_spec_add_rsa(config->pks, (unsigned int)bits);
973 }
974 else {
975 if (md_pkeys_spec_contains_ec(config->pks, argv[i])) {
976 return apr_psprintf(cmd->pool, "two keys of type '%s' are not possible.", argv[i]);
977 }
978 md_pkeys_spec_add_ec(config->pks, argv[i]);
979 }
980 }
981 return NULL;
982}
983
984static const char *md_config_set_notify_cmd(cmd_parms *cmd, void *mconfig, const char *arg)
985{
986 md_srv_conf_t *sc = md_config_get(cmd->server);
987 const char *err;
988
990 return err;
991 }
992 sc->mc->notify_cmd = arg;
993 (void)mconfig;
994 return NULL;
995}
996
997static const char *md_config_set_msg_cmd(cmd_parms *cmd, void *mconfig, const char *arg)
998{
999 md_srv_conf_t *sc = md_config_get(cmd->server);
1000 const char *err;
1001
1003 return err;
1004 }
1005 sc->mc->message_cmd = arg;
1006 (void)mconfig;
1007 return NULL;
1008}
1009
1010static const char *md_config_set_dns01_cmd(cmd_parms *cmd, void *mconfig, const char *arg)
1011{
1012 md_srv_conf_t *sc = md_config_get(cmd->server);
1013 const char *err;
1014
1016 return err;
1017 }
1018
1019 if (inside_md_section(cmd)) {
1020 sc->dns01_cmd = arg;
1021 } else {
1023 }
1024
1025 (void)mconfig;
1026 return NULL;
1027}
1028
1029static const char *md_config_set_dns01_version(cmd_parms *cmd, void *mconfig, const char *value)
1030{
1031 md_srv_conf_t *sc = md_config_get(cmd->server);
1032 const char *err;
1033
1034 (void)mconfig;
1036 return err;
1037 }
1038 if (!strcmp("1", value) || !strcmp("2", value)) {
1040 }
1041 else {
1042 return "Only versions `1` and `2` are supported";
1043 }
1044 return NULL;
1045}
1046
1047static const char *md_config_add_cert_file(cmd_parms *cmd, void *mconfig, const char *arg)
1048{
1049 md_srv_conf_t *sc = md_config_get(cmd->server);
1050 const char *err, *fpath;
1051
1052 (void)mconfig;
1053 if ((err = md_conf_check_location(cmd, MD_LOC_MD))) return err;
1054 assert(sc->current);
1056 if (!fpath) return apr_psprintf(cmd->pool, "certificate file not found: %s", arg);
1057 if (!sc->current->cert_files) {
1058 sc->current->cert_files = apr_array_make(cmd->pool, 3, sizeof(char*));
1059 }
1060 APR_ARRAY_PUSH(sc->current->cert_files, const char*) = fpath;
1061 return NULL;
1062}
1063
1064static const char *md_config_add_key_file(cmd_parms *cmd, void *mconfig, const char *arg)
1065{
1066 md_srv_conf_t *sc = md_config_get(cmd->server);
1067 const char *err, *fpath;
1068
1069 (void)mconfig;
1070 if ((err = md_conf_check_location(cmd, MD_LOC_MD))) return err;
1071 assert(sc->current);
1073 if (!fpath) return apr_psprintf(cmd->pool, "certificate key file not found: %s", arg);
1074 if (!sc->current->pkey_files) {
1075 sc->current->pkey_files = apr_array_make(cmd->pool, 3, sizeof(char*));
1076 }
1077 APR_ARRAY_PUSH(sc->current->pkey_files, const char*) = fpath;
1078 return NULL;
1079}
1080
1081static const char *md_config_set_server_status(cmd_parms *cmd, void *dc, const char *value)
1082{
1083 md_srv_conf_t *sc = md_config_get(cmd->server);
1084 const char *err;
1085
1086 (void)dc;
1088 return err;
1089 }
1090 return set_on_off(&sc->mc->server_status_enabled, value, cmd->pool);
1091}
1092
1093static const char *md_config_set_certificate_status(cmd_parms *cmd, void *dc, const char *value)
1094{
1095 md_srv_conf_t *sc = md_config_get(cmd->server);
1096 const char *err;
1097
1098 (void)dc;
1100 return err;
1101 }
1102 return set_on_off(&sc->mc->certificate_status_enabled, value, cmd->pool);
1103}
1104
1105static const char *md_config_set_ocsp_keep_window(cmd_parms *cmd, void *dc, const char *value)
1106{
1107 md_srv_conf_t *sc = md_config_get(cmd->server);
1108 const char *err;
1109
1110 (void)dc;
1112 return err;
1113 }
1115 if (err) return apr_psprintf(cmd->pool, "MDStaplingKeepResponse %s", err);
1116 return NULL;
1117}
1118
1119static const char *md_config_set_ocsp_renew_window(cmd_parms *cmd, void *dc, const char *value)
1120{
1121 md_srv_conf_t *sc = md_config_get(cmd->server);
1122 const char *err;
1123
1124 (void)dc;
1126 return err;
1127 }
1129 if (!err && sc->mc->ocsp_renew_window->norm
1130 && (sc->mc->ocsp_renew_window->len >= sc->mc->ocsp_renew_window->norm)) {
1131 err = "with a length of 100% or more is not allowed.";
1132 }
1133 if (err) return apr_psprintf(cmd->pool, "MDStaplingRenewWindow %s", err);
1134 return NULL;
1135}
1136
1137static const char *md_config_set_cert_check(cmd_parms *cmd, void *dc,
1138 const char *name, const char *url)
1139{
1140 md_srv_conf_t *sc = md_config_get(cmd->server);
1141 const char *err;
1142
1143 (void)dc;
1145 return err;
1146 }
1147 sc->mc->cert_check_name = name;
1148 sc->mc->cert_check_url = url;
1149 return NULL;
1150}
1151
1152static const char *md_config_set_activation_delay(cmd_parms *cmd, void *mconfig, const char *arg)
1153{
1154 md_srv_conf_t *sc = md_config_get(cmd->server);
1155 const char *err;
1157
1158 (void)mconfig;
1160 return err;
1161 }
1162 if (md_duration_parse(&delay, arg, "d") != APR_SUCCESS) {
1163 return "unrecognized duration format";
1164 }
1166 return NULL;
1167}
1168
1169static const char *md_config_set_ca_certs(cmd_parms *cmd, void *dc, const char *path)
1170{
1171 md_srv_conf_t *sc = md_config_get(cmd->server);
1172
1173 (void)dc;
1174 sc->mc->ca_certs = path;
1175 return NULL;
1176}
1177
1178static const char *md_config_set_eab(cmd_parms *cmd, void *dc,
1179 const char *keyid, const char *hmac)
1180{
1181 md_srv_conf_t *sc = md_config_get(cmd->server);
1182 const char *err;
1183
1184 (void)dc;
1186 return err;
1187 }
1188 if (!hmac) {
1189 if (!apr_strnatcasecmp("None", keyid)) {
1190 keyid = "none";
1191 }
1192 else {
1193 /* a JSON file keeping keyid and hmac */
1194 const char *fpath;
1195 apr_status_t rv;
1196 md_json_t *json;
1197
1198 /* If only dumping the config, don't verify the file */
1200 goto leave;
1201 }
1202
1204 if (!fpath) {
1205 return apr_pstrcat(cmd->pool, cmd->cmd->name,
1206 ": Invalid file path ", keyid, NULL);
1207 }
1208 if (!md_file_exists(fpath, cmd->pool)) {
1209 return apr_pstrcat(cmd->pool, cmd->cmd->name,
1210 ": file not found: ", fpath, NULL);
1211 }
1212
1213 rv = md_json_readf(&json, cmd->pool, fpath);
1214 if (APR_SUCCESS != rv) {
1215 return apr_pstrcat(cmd->pool, cmd->cmd->name,
1216 ": error reading JSON file ", fpath, NULL);
1217 }
1219 if (!keyid || !*keyid) {
1220 return apr_pstrcat(cmd->pool, cmd->cmd->name,
1221 ": JSON does not contain '", MD_KEY_KID,
1222 "' element in file ", fpath, NULL);
1223 }
1225 if (!hmac || !*hmac) {
1226 return apr_pstrcat(cmd->pool, cmd->cmd->name,
1227 ": JSON does not contain '", MD_KEY_HMAC,
1228 "' element in file ", fpath, NULL);
1229 }
1230 }
1231 }
1232leave:
1233 sc->ca_eab_kid = keyid;
1234 sc->ca_eab_hmac = hmac;
1235 return NULL;
1236}
1237
1239 AP_INIT_TAKE_ARGV("MDCertificateAuthority", md_config_set_ca, NULL, RSRC_CONF,
1240 "URL(s) or known name(s) of CA issuing the certificates"),
1241 AP_INIT_TAKE1("MDCertificateAgreement", md_config_set_agreement, NULL, RSRC_CONF,
1242 "either 'accepted' or the URL of CA Terms-of-Service agreement you accept"),
1244 "A list of challenge types to be used."),
1245 AP_INIT_TAKE1("MDCertificateProtocol", md_config_set_ca_proto, NULL, RSRC_CONF,
1246 "Protocol used to obtain/renew certificates"),
1248 "Email address used for account registration"),
1250 "deprecated, older name for MDRenewMode"),
1252 "Controls how renewal of Managed Domain certificates shall be handled."),
1254 "A group of server names with one certificate"),
1256 "Container for a managed domain with common settings and certificate."),
1258 "Short form for <MDomainSet> container."),
1260 "Define domain name(s) part of the Managed Domain. Use 'auto' or "
1261 "'manual' to enable/disable auto adding names from virtual hosts."),
1263 "Define domain name(s) part of the Managed Domain. Use 'auto' or "
1264 "'manual' to enable/disable auto adding names from virtual hosts."),
1266 "Enable/Disable the Must-Staple flag for new certificates."),
1268 "Declare the mapped ports 80 and 443 on the local server. E.g. 80:8000 "
1269 "to indicate that the server port 8000 is reachable as port 80 from the "
1270 "internet. Use 80:- to indicate that port 80 is not reachable from "
1271 "the outside."),
1273 "set the type and parameters for private key generation"),
1275 "URL of a HTTP(S) proxy to use for outgoing connections"),
1277 "the directory for file system storage of managed domain data."),
1279 "Time length for renewal before certificate expires (defaults to days)."),
1281 "Redirect non-secure requests to the https: equivalent."),
1283 "Set the command to run when signup/renew of domain is complete."),
1285 "Allow managing of base server outside virtual hosts."),
1287 "Set the command for setup/teardown of dns-01 challenges"),
1288 AP_INIT_TAKE1("MDChallengeDns01Version", md_config_set_dns01_version, NULL, RSRC_CONF,
1289 "Set the type of arguments to call `MDChallengeDns01` with"),
1290 AP_INIT_TAKE1("MDCertificateFile", md_config_add_cert_file, NULL, RSRC_CONF,
1291 "set the static certificate (chain) file to use for this domain."),
1292 AP_INIT_TAKE1("MDCertificateKeyFile", md_config_add_key_file, NULL, RSRC_CONF,
1293 "set the static private key file to use for this domain."),
1295 "On to see Managed Domains in server-status."),
1297 "On to see Managed Domain expose /.httpd/certificate-status."),
1299 "When less time remains for a certificate, send our/log a warning (defaults to days)"),
1301 "Set the command run when a message about a domain is issued."),
1303 "Enable/Disable OCSP Stapling for this/all Managed Domain(s)."),
1305 "Enable/Disable OCSP Stapling for certificates not in Managed Domains."),
1306 AP_INIT_TAKE1("MDStaplingKeepResponse", md_config_set_ocsp_keep_window, NULL, RSRC_CONF,
1307 "The amount of time to keep an OCSP response in the store."),
1308 AP_INIT_TAKE1("MDStaplingRenewWindow", md_config_set_ocsp_renew_window, NULL, RSRC_CONF,
1309 "Time length for renewal before OCSP responses expire (defaults to days)."),
1310 AP_INIT_TAKE2("MDCertificateCheck", md_config_set_cert_check, NULL, RSRC_CONF,
1311 "Set name and URL pattern for a certificate monitoring site."),
1313 "How long to delay activation of new certificates"),
1314 AP_INIT_TAKE1("MDCACertificateFile", md_config_set_ca_certs, NULL, RSRC_CONF,
1315 "Set the CA file to use for connections"),
1316 AP_INIT_TAKE12("MDExternalAccountBinding", md_config_set_eab, NULL, RSRC_CONF,
1317 "Set the external account binding keyid and hmac values to use at CA"),
1319 "Time length for first retry, doubled on every consecutive error."),
1321 "The number of errors before a failover to another CA is triggered."),
1323 "Configure locking of store for updates."),
1325 "Determines how DNS names are matched to vhosts."),
1327 "Time between certificate checks."),
1329};
1330
1332{
1333 md_srv_conf_t *sc;
1335
1336 sc = md_config_get(s);
1337 mc = sc->mc;
1338
1339 mc->hsts_header = NULL;
1340 if (mc->hsts_max_age > 0) {
1341 mc->hsts_header = apr_psprintf(p, "max-age=%d", mc->hsts_max_age);
1342 }
1343
1344#if AP_MODULE_MAGIC_AT_LEAST(20180906, 2)
1345 if (mc->base_dir == NULL) {
1347 }
1348#endif
1349
1350 return APR_SUCCESS;
1351}
1352
1354{
1355 md_srv_conf_t *sc = (md_srv_conf_t *)ap_get_module_config(s->module_config, &md_module);
1356 ap_assert(sc);
1357 if (sc->s != s && p) {
1358 sc = md_config_merge(p, &defconf, sc);
1359 sc->s = s;
1360 sc->name = apr_pstrcat(p, CONF_S_NAME(s), sc->name, NULL);
1361 sc->mc = md_mod_conf_get(p, 1);
1362 ap_set_module_config(s->module_config, &md_module, sc);
1363 }
1364 return sc;
1365}
1366
1371
1377
1379{
1380 return md_config_get(c->base_server);
1381}
1382
1384{
1385 switch (var) {
1387 return sc->ca_contact? sc->ca_contact : defconf.ca_contact;
1388 case MD_CONFIG_CA_PROTO:
1389 return sc->ca_proto? sc->ca_proto : defconf.ca_proto;
1390 case MD_CONFIG_BASE_DIR:
1391 return sc->mc->base_dir;
1392 case MD_CONFIG_PROXY:
1393 return sc->mc->proxy_url;
1397 return sc->mc->notify_cmd;
1398 default:
1399 return NULL;
1400 }
1401}
1402
1404{
1405 switch (var) {
1407 return (sc->renew_mode != DEF_VAL)? sc->renew_mode : defconf.renew_mode;
1409 return (sc->transitive != DEF_VAL)? sc->transitive : defconf.transitive;
1413 return (sc->must_staple != DEF_VAL)? sc->must_staple : defconf.must_staple;
1414 case MD_CONFIG_STAPLING:
1415 return (sc->stapling != DEF_VAL)? sc->stapling : defconf.stapling;
1418 default:
1419 return 0;
1420 }
1421}
1422
1424{
1425 switch (var) {
1428 break;
1431 break;
1432 default:
1433 break;
1434 }
1435}
1436
1437const md_t *md_get_for_domain(server_rec *s, const char *domain)
1438{
1439 md_srv_conf_t *sc;
1440 const md_t *md;
1441 int i;
1442
1443 sc = md_config_get(s);
1444 for (i = 0; sc && sc->assigned && i < sc->assigned->nelts; ++i) {
1445 md = APR_ARRAY_IDX(sc->assigned, i, const md_t*);
1446 if (md_contains(md, domain, 0)) goto leave;
1447 }
1448 md = NULL;
1449leave:
1450 return md;
1451}
1452
APR general purpose library routines.
apr_size_t const unsigned char unsigned int unsigned int d
Definition apr_siphash.h:72
APR Strings library.
#define AP_INIT_TAKE1(directive, func, mconfig, where, help)
#define ap_get_module_config(v, m)
#define AP_INIT_TAKE_ARGV(directive, func, mconfig, where, help)
ap_conf_vector_t * base
char * ap_server_root_relative(apr_pool_t *p, const char *fname)
Definition config.c:1594
#define AP_INIT_RAW_ARGS(directive, func, mconfig, where, help)
#define ap_set_module_config(v, m, val)
#define AP_INIT_TAKE12(directive, func, mconfig, where, help)
request_rec int int apr_table_t const char * path
ap_conf_vector_t const char * section
const char * ap_walk_config(ap_directive_t *conftree, cmd_parms *parms, ap_conf_vector_t *section_vector)
Definition config.c:1360
#define AP_INIT_TAKE2(directive, func, mconfig, where, help)
#define AP_SQ_RM_CONFIG_DUMP
Definition http_core.h:1065
int ap_state_query(int query_code)
Definition core.c:5378
#define AP_SQ_RUN_MODE
Definition http_core.h:1032
void * dummy
Definition http_vhost.h:62
void const char * arg
Definition http_vhost.h:63
apr_datum_t apr_datum_t * pvalue
Definition apr_dbm.h:128
const char apr_ssize_t int flags
Definition apr_encode.h:168
const char * url
Definition apr_escape.h:120
apr_memcache_t * mc
#define RSRC_CONF
#define OR_AUTHCFG
int ap_cstr_casecmp(const char *s1, const char *s2)
Definition util.c:3542
#define ap_strrchr_c(s, c)
Definition httpd.h:2357
#define ap_assert(exp)
Definition httpd.h:2271
char * ap_getword_conf(apr_pool_t *p, const char **line)
Definition util.c:833
#define NOT_IN_DIRECTORY
#define GLOBAL_ONLY
const char * ap_check_cmd_context(cmd_parms *cmd, unsigned forbidden)
Definition core.c:1301
#define NOT_IN_LOCATION
apr_size_t size
const char int apr_pool_t * pool
Definition apr_cstr.h:84
const char * value
Definition apr_env.h:51
#define APR_SUCCESS
Definition apr_errno.h:225
int apr_status_t
Definition apr_errno.h:44
apr_pool_t int argc
Definition apr_getopt.h:104
apr_vformatter_buff_t * c
Definition apr_lib.h:175
#define apr_pcalloc(p, size)
Definition apr_pools.h:465
int to
const char * s
Definition apr_strings.h:95
#define APR_ARRAY_PUSH(ary, type)
Definition apr_tables.h:150
#define APR_ARRAY_IDX(ary, i, type)
Definition apr_tables.h:141
apr_int32_t apr_int32_t apr_int32_t err
apr_cmdtype_e cmd
apr_int64_t apr_interval_time_t
Definition apr_time.h:55
apr_int64_t apr_time_t
Definition apr_time.h:45
#define apr_time_from_sec(sec)
Definition apr_time.h:78
Apache Configuration.
CORE HTTP Daemon.
Apache Logging library.
Virtual Host package.
HTTP Daemon routines.
#define MD_KEY_HMAC
Definition md.h:152
#define MD_PKEY_RSA_BITS_MIN
Definition md.h:36
#define MD_PKEY_RSA_BITS_DEF
Definition md.h:37
#define MD_TIME_OCSP_KEEP_NORM
Definition md.h:48
#define MD_TIME_LIFE_NORM
Definition md.h:45
#define MD_TIME_WARN_WINDOW_DEF
Definition md.h:47
#define MD_KEY_TEMPORARY
Definition md.h:199
#define MD_KEY_CMD_DNS01
Definition md.h:129
#define MD_KEY_KID
Definition md.h:158
#define MD_KEY_DNS01_VERSION
Definition md.h:130
md_t * md_create(apr_pool_t *p, struct apr_array_header_t *domains)
Definition md_core.c:196
#define MD_TIME_RENEW_WINDOW_DEF
Definition md.h:46
apr_status_t md_get_ca_url_from_name(const char **purl, apr_pool_t *p, const char *name)
Definition md_core.c:433
#define MD_KEY_PERMANENT
Definition md.h:174
md_renew_mode_t
Definition md.h:68
@ MD_RENEW_AUTO
Definition md.h:71
@ MD_RENEW_MANUAL
Definition md.h:70
@ MD_RENEW_ALWAYS
Definition md.h:72
#define MD_KEY_ACTIVATION_DELAY
Definition md.h:117
@ MD_REQUIRE_UNSET
Definition md.h:62
@ MD_REQUIRE_OFF
Definition md.h:63
@ MD_REQUIRE_TEMPORARY
Definition md.h:64
@ MD_REQUIRE_PERMANENT
Definition md.h:65
int md_contains(const md_t *md, const char *domain, int case_sensitive)
Definition md_core.c:35
#define MD_HSTS_MAX_AGE_DEFAULT
Definition md.h:41
#define MD_PROTO_ACME
Definition md_acme.h:33
int md_pkeys_spec_contains_rsa(md_pkeys_spec_t *pks)
Definition md_crypt.c:305
md_pkeys_spec_t * md_pkeys_spec_make(apr_pool_t *p)
Definition md_crypt.c:281
md_pkeys_spec_t * md_pkeys_spec_clone(apr_pool_t *p, const md_pkeys_spec_t *pks)
Definition md_crypt.c:538
void md_pkeys_spec_add_default(md_pkeys_spec_t *pks)
Definition md_crypt.c:296
void md_pkeys_spec_add_ec(md_pkeys_spec_t *pks, const char *curve)
Definition md_crypt.c:338
int md_pkeys_spec_is_empty(const md_pkeys_spec_t *pks)
Definition md_crypt.c:533
void md_pkeys_spec_add_rsa(md_pkeys_spec_t *pks, unsigned int bits)
Definition md_crypt.c:316
int md_pkeys_spec_contains_ec(md_pkeys_spec_t *pks, const char *curve)
Definition md_crypt.c:326
apr_pool_t * p
Definition md_event.c:32
const char * md_json_gets(const md_json_t *json,...)
Definition md_json.c:406
apr_status_t md_json_readf(md_json_t **pjson, apr_pool_t *p, const char *fpath)
Definition md_json.c:1156
apr_status_t md_duration_parse(apr_interval_time_t *ptimeout, const char *value, const char *def_unit)
Definition md_time.c:159
const char * md_duration_format(apr_pool_t *p, apr_interval_time_t duration)
Definition md_time.c:154
const char * md_timeslice_parse(md_timeslice_t **pts, apr_pool_t *p, const char *val, apr_interval_time_t norm)
Definition md_time.c:247
#define MD_SECS_PER_DAY
Definition md_time.h:23
char * md_util_str_tolower(char *s)
Definition md_util.c:240
const char * md_util_schemify(apr_pool_t *p, const char *s, const char *def_scheme)
Definition md_util.c:932
int md_array_str_index(const apr_array_header_t *array, const char *s, int start, int case_sensitive)
Definition md_util.c:250
int md_file_exists(const char *fname, apr_pool_t *p)
Definition md_util.c:411
apr_status_t md_util_abs_http_uri_check(apr_pool_t *p, const char *uri, const char **perr)
Definition md_util.c:1019
md_srv_conf_t * md_config_get(server_rec *s)
static md_mod_conf_t * md_mod_conf_get(apr_pool_t *pool, int create)
static const char * md_config_set_store_dir(cmd_parms *cmd, void *arg, const char *value)
static md_timeslice_t def_renew_window
static const char * md_config_set_activation_delay(cmd_parms *cmd, void *mconfig, const char *arg)
static void srv_conf_props_apply(md_t *md, const md_srv_conf_t *from, apr_pool_t *p)
static const char * md_config_set_notify_cmd(cmd_parms *cmd, void *mconfig, const char *arg)
const char * md_config_gets(const md_srv_conf_t *sc, md_config_var_t var)
static const char * md_config_set_ocsp_keep_window(cmd_parms *cmd, void *dc, const char *value)
#define MD_LOC_GLOBAL
static const char * md_config_set_ocsp_renew_window(cmd_parms *cmd, void *dc, const char *value)
static const char * md_config_set_ca(cmd_parms *cmd, void *dc, int argc, char *const argv[])
static int inside_md_section(cmd_parms *cmd)
static const char * md_config_set_renew_window(cmd_parms *cmd, void *dc, const char *value)
static const char * md_conf_check_location(cmd_parms *cmd, int flags)
static const char * md_config_set_proxy(cmd_parms *cmd, void *arg, const char *value)
#define MD_CMD_MD_SECTION
static const char * md_config_set_dns01_cmd(cmd_parms *cmd, void *mconfig, const char *arg)
static const char * md_config_set_store_locks(cmd_parms *cmd, void *dc, const char *s)
static const char * md_config_set_agreement(cmd_parms *cmd, void *dc, const char *value)
const command_rec md_cmds[]
static const char * md_config_add_cert_file(cmd_parms *cmd, void *mconfig, const char *arg)
md_srv_conf_t * md_config_cget(conn_rec *c)
static const char * set_transitive(int *ptransitive, const char *value)
static const char * set_port_map(md_mod_conf_t *mc, const char *value)
static const char * md_config_set_cert_check(cmd_parms *cmd, void *dc, const char *name, const char *url)
static const char * md_config_set_port_map(cmd_parms *cmd, void *arg, const char *v1, const char *v2)
static md_srv_conf_t * config_get_int(server_rec *s, apr_pool_t *p)
static md_timeslice_t def_warn_window
static const char * md_config_set_stapling(cmd_parms *cmd, void *dc, const char *value)
#define MD_LOC_NOT_MD
static const char * md_config_set_contact(cmd_parms *cmd, void *dc, const char *value)
static md_mod_conf_t * mod_md_config
static md_mod_conf_t defmc
#define DEF_VAL
static const char * md_config_set_eab(cmd_parms *cmd, void *dc, const char *keyid, const char *hmac)
static const char * md_config_set_match_mode(cmd_parms *cmd, void *dc, const char *s)
#define MD_DEFAULT_BASE_DIR
static md_timeslice_t def_ocsp_keep_window
#define CONF_S_NAME(s)
static md_srv_conf_t defconf
static const char * md_section_check(cmd_parms *cmd)
#define MD_LOC_ALL
static const char * md_config_set_pkeys(cmd_parms *cmd, void *dc, int argc, char *const argv[])
static const char * md_config_set_base_server(cmd_parms *cmd, void *dc, const char *value)
static const char * md_config_set_names(cmd_parms *cmd, void *dc, int argc, char *const argv[])
void md_config_get_timespan(md_timeslice_t **pspan, const md_srv_conf_t *sc, md_config_var_t var)
void * md_config_create_svr(apr_pool_t *pool, server_rec *s)
static const char * md_config_set_min_delay(cmd_parms *cmd, void *dc, const char *value)
static const char * md_config_set_ca_proto(cmd_parms *cmd, void *dc, const char *value)
static const char * md_config_set_server_status(cmd_parms *cmd, void *dc, const char *value)
static const char * md_config_sec_start(cmd_parms *cmd, void *mconfig, const char *arg)
static md_timeslice_t def_ocsp_renew_window
static void srv_conf_props_copy(md_srv_conf_t *to, const md_srv_conf_t *from)
md_srv_conf_t * md_config_get_unique(server_rec *s, apr_pool_t *p)
#define MD_LOC_MD
static apr_status_t cleanup_mod_config(void *dummy)
static const char * md_config_add_key_file(cmd_parms *cmd, void *mconfig, const char *arg)
static const char * md_config_set_ca_certs(cmd_parms *cmd, void *dc, const char *path)
static const char * md_config_set_staple_others(cmd_parms *cmd, void *dc, const char *value)
static int inside_section(cmd_parms *cmd, const char *section)
static void srv_conf_props_clear(md_srv_conf_t *sc)
apr_status_t md_config_post_config(server_rec *s, apr_pool_t *p)
static void * md_config_merge(apr_pool_t *pool, void *basev, void *addv)
static const char * md_config_set_cha_tyes(cmd_parms *cmd, void *dc, int argc, char *const argv[])
static const char * md_config_set_msg_cmd(cmd_parms *cmd, void *mconfig, const char *arg)
static const char * md_config_set_require_https(cmd_parms *cmd, void *dc, const char *value)
#define MD_CMD_MD2_SECTION
static const char * md_config_set_must_staple(cmd_parms *cmd, void *dc, const char *value)
static void add_domain_name(apr_array_header_t *domains, const char *name, apr_pool_t *p)
static const char * md_config_set_retry_failover(cmd_parms *cmd, void *dc, const char *value)
static const char * md_config_set_renew_mode(cmd_parms *cmd, void *dc, const char *value)
static const char * set_on_off(int *pvalue, const char *s, apr_pool_t *p)
static const char * md_config_sec_add_members(cmd_parms *cmd, void *dc, int argc, char *const argv[])
const md_t * md_get_for_domain(server_rec *s, const char *domain)
void * md_config_merge_svr(apr_pool_t *pool, void *basev, void *addv)
int md_config_geti(const md_srv_conf_t *sc, md_config_var_t var)
static const char * md_config_set_warn_window(cmd_parms *cmd, void *dc, const char *value)
static const char * md_config_set_check_interval(cmd_parms *cmd, void *dc, const char *value)
static const char * md_config_set_certificate_status(cmd_parms *cmd, void *dc, const char *value)
static const char * md_config_set_dns01_version(cmd_parms *cmd, void *mconfig, const char *value)
md_config_var_t
@ MD_CONFIG_MUST_STAPLE
@ MD_CONFIG_BASE_DIR
@ MD_CONFIG_CA_PROTO
@ MD_CONFIG_RENEW_WINDOW
@ MD_CONFIG_STAPLING
@ MD_CONFIG_CA_AGREEMENT
@ MD_CONFIG_STAPLE_OTHERS
@ MD_CONFIG_REQUIRE_HTTPS
@ MD_CONFIG_CA_CONTACT
@ MD_CONFIG_TRANSITIVE
@ MD_CONFIG_DRIVE_MODE
@ MD_CONFIG_PROXY
@ MD_CONFIG_NOTIFY_CMD
@ MD_CONFIG_WARN_WINDOW
@ MD_MATCH_SERVERNAMES
@ MD_MATCH_ALL
const char * argv[3]
return NULL
Definition mod_so.c:359
int i
Definition mod_so.c:347
char * name
Structure used to build the config tree.
apr_pool_t * pool
Definition apr_tables.h:64
Structure to store things which are per connection.
Definition httpd.h:1152
const char * cert_check_url
struct apr_hash_t * init_errors
md_timeslice_t * ocsp_keep_window
apr_array_header_t * mds
apr_time_t lock_wait_timeout
const char * cert_check_name
const char * proxy_url
const char * notify_cmd
int certificate_status_enabled
const char * message_cmd
struct apr_table_t * env
apr_time_t check_interval
int server_status_enabled
const char * base_dir
md_timeslice_t * ocsp_renew_window
const char * ca_certs
md_match_mode_t match_mode
apr_time_t min_delay
apr_array_header_t * unused_names
const char * ca_eab_kid
md_timeslice_t * renew_window
struct apr_array_header_t * ca_urls
const char * dns01_cmd
md_require_t require_https
struct apr_array_header_t * ca_challenges
md_timeslice_t * warn_window
struct apr_array_header_t * assigned
const char * ca_contact
const char * name
const char * ca_eab_hmac
const server_rec * s
const char * ca_proto
md_mod_conf_t * mc
const char * ca_agreement
struct md_pkeys_spec_t * pks
Definition md.h:76
md_timeslice_t * renew_window
Definition md.h:82
int transitive
Definition md.h:109
struct apr_array_header_t * domains
Definition md.h:78
const char * ca_eab_hmac
Definition md.h:94
md_timeslice_t * warn_window
Definition md.h:83
md_require_t require_https
Definition md.h:107
struct apr_array_header_t * pkey_files
Definition md.h:92
const char * defn_name
Definition md.h:102
unsigned defn_line_number
Definition md.h:103
int must_staple
Definition md.h:110
const char * ca_proto
Definition md.h:85
struct apr_array_header_t * ca_urls
Definition md.h:86
struct md_pkeys_spec_t * pks
Definition md.h:81
const char * ca_eab_kid
Definition md.h:93
const char * ca_agreement
Definition md.h:89
struct apr_array_header_t * contacts
Definition md.h:79
int renew_mode
Definition md.h:106
int stapling
Definition md.h:111
struct apr_array_header_t * cert_files
Definition md.h:91
struct apr_array_header_t * ca_challenges
Definition md.h:90
const char * dns01_cmd
Definition md.h:99
apr_interval_time_t len
Definition md_time.h:62
apr_interval_time_t norm
Definition md_time.h:61
A structure to store information for each virtual server.
Definition httpd.h:1322
#define var
typedef int(WSAAPI *apr_winapi_fpt_WSAPoll)(IN OUT LPWSAPOLLFD fdArray