Commit 7bd72465 authored by Stefan Eissing's avatar Stefan Eissing
Browse files

* 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
parent 02d43756
Loading
Loading
Loading
Loading
+3 −3
Changes for docs/manual/mod/mod_md.xml: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -391,15 +391,15 @@ MDCertificateAgreement https://letsencrypt.org/documents/LE-SA-v1.2-November-15-
    <directivesynopsis>
        <name>MDNotifyCmd</name>
        <description>Run a program when Managed Domain are ready.</description>
        <syntax>MDNotifyCmd <var>path</var></syntax>
        <syntax>MDNotifyCmd <var>path</var> [ <var>args</var> ]</syntax>
        <contextlist>
            <context>server config</context>
        </contextlist>
        <usage>
            <p>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.
            </p>
        </usage>
    </directivesynopsis>
+2 −2
Changes for modules/md/md_version.h: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -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"

+8 −3
Changes for modules/md/mod_md.c: 8 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -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);
+5 −5
Changes for modules/md/mod_md_config.c: 5 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -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."),