From: Stefan Eissing Date: Tue, 5 Jun 2018 12:43:08 +0000 (+0000) Subject: * integrating latest changes from microgrit X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=94f43561000d70856267b542365c3a715473a585;p=apache * integrating latest changes from microgrit * MDNotifyCmd can now specify arguments to the command git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1832935 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/mod/mod_md.xml b/docs/manual/mod/mod_md.xml index e93645a2bb..cd5b6e5576 100644 --- a/docs/manual/mod/mod_md.xml +++ b/docs/manual/mod/mod_md.xml @@ -391,15 +391,15 @@ MDCertificateAgreement https://letsencrypt.org/documents/LE-SA-v1.2-November-15- MDNotifyCmd Run a program when Managed Domain are ready. - MDNotifyCmd path + MDNotifyCmd path [ args ] server config

The configured executable is run when Managed Domains have signed up or renewed their certificates. It is given the names of the processed MDs as - arguments. It should return status code 0 to indicate that it has - run successfully. + additional arguments (after the parameters specified here). It should + return status code 0 to indicate that it has run successfully.

diff --git a/modules/md/md_version.h b/modules/md/md_version.h index 6cf20ea444..8dbbaa3666 100644 --- a/modules/md/md_version.h +++ b/modules/md/md_version.h @@ -27,7 +27,7 @@ * @macro * Version number of the md module as c string */ -#define MOD_MD_VERSION "1.1.10" +#define MOD_MD_VERSION "1.1.12" /** * @macro @@ -35,7 +35,7 @@ * release. This is a 24 bit number with 8 bits for major number, 8 bits * for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203. */ -#define MOD_MD_VERSION_NUM 0x01010a +#define MOD_MD_VERSION_NUM 0x01010c #define MD_ACME_DEF_URL "https://acme-v01.api.letsencrypt.org/directory" diff --git a/modules/md/mod_md.c b/modules/md/mod_md.c index 0b4af20318..bb02566334 100644 --- a/modules/md/mod_md.c +++ b/modules/md/mod_md.c @@ -823,8 +823,12 @@ static apr_status_t run_watchdog(int state, void *baton, apr_pool_t *ptemp) wd->mc->notify_cmd, exit_code); } else { + if (APR_EINCOMPLETE == rv && exit_code) { + rv = 0; + } ap_log_error(APLOG_MARK, APLOG_ERR, rv, wd->s, APLOGNO(10109) - "executing configured MDNotifyCmd %s", wd->mc->notify_cmd); + "executing MDNotifyCmd %s returned %d", + wd->mc->notify_cmd, exit_code); notified = 0; } } @@ -1305,7 +1309,8 @@ static int md_http_challenge_pr(request_rec *r) int configured; apr_status_t rv; - if (!strncmp(ACME_CHALLENGE_PREFIX, r->parsed_uri.path, sizeof(ACME_CHALLENGE_PREFIX)-1)) { + if (r->parsed_uri.path + && !strncmp(ACME_CHALLENGE_PREFIX, r->parsed_uri.path, sizeof(ACME_CHALLENGE_PREFIX)-1)) { sc = ap_get_module_config(r->server->module_config, &md_module); if (sc && sc->mc) { configured = (NULL != md_get_by_domain(sc->mc->mds, r->hostname)); @@ -1371,7 +1376,7 @@ static int md_require_https_maybe(request_rec *r) const char *s; int status; - if (opt_ssl_is_https + if (opt_ssl_is_https && r->parsed_uri.path && strncmp(WELL_KNOWN_PREFIX, r->parsed_uri.path, sizeof(WELL_KNOWN_PREFIX)-1)) { sc = ap_get_module_config(r->server->module_config, &md_module); diff --git a/modules/md/mod_md_config.c b/modules/md/mod_md_config.c index 40ae6c4744..336a21ba5c 100644 --- a/modules/md/mod_md_config.c +++ b/modules/md/mod_md_config.c @@ -771,7 +771,7 @@ static const char *md_config_set_pkeys(cmd_parms *cmd, void *dc, return apr_pstrcat(cmd->pool, "unsupported private key type \"", ptype, "\"", NULL); } -static const char *md_config_set_notify_cmd(cmd_parms *cmd, void *arg, const char *value) +static const char *md_config_set_notify_cmd(cmd_parms *cmd, void *mconfig, const char *arg) { md_srv_conf_t *sc = md_config_get(cmd->server); const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); @@ -779,8 +779,8 @@ static const char *md_config_set_notify_cmd(cmd_parms *cmd, void *arg, const cha if (err) { return err; } - sc->mc->notify_cmd = value; - (void)arg; + sc->mc->notify_cmd = arg; + (void)mconfig; return NULL; } @@ -837,8 +837,8 @@ const command_rec md_cmds[] = { "Time length for renewal before certificate expires (defaults to days)"), AP_INIT_TAKE1( MD_CMD_REQUIREHTTPS, md_config_set_require_https, NULL, RSRC_CONF, "Redirect non-secure requests to the https: equivalent."), - AP_INIT_TAKE1( MD_CMD_NOTIFYCMD, md_config_set_notify_cmd, NULL, RSRC_CONF, - "set the command to run when signup/renew of domain is complete."), + AP_INIT_RAW_ARGS(MD_CMD_NOTIFYCMD, md_config_set_notify_cmd, NULL, RSRC_CONF, + "set the command and optional arguments to run when signup/renew of domain is complete."), AP_INIT_TAKE1( MD_CMD_BASE_SERVER, md_config_set_base_server, NULL, RSRC_CONF, "allow managing of base server outside virtual hosts."),