MCPcopy Create free account
hub / github.com/apache/httpd / cha_http_01_setup

Function cha_http_01_setup

modules/md/md_acme_authz.c:243–295  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

241}
242
243static apr_status_t cha_http_01_setup(md_acme_authz_cha_t *cha, md_acme_authz_t *authz,
244 md_acme_t *acme, md_store_t *store,
245 md_pkeys_spec_t *key_specs,
246 apr_array_header_t *acme_tls_1_domains, const md_t *md,
247 apr_table_t *env, md_result_t *result,
248 const char **psetup_token, apr_pool_t *p)
249{
250 const char *data;
251 apr_status_t rv;
252 int notify_server;
253
254 (void)key_specs;
255 (void)env;
256 (void)acme_tls_1_domains;
257 (void)md;
258
259 if (APR_SUCCESS != (rv = setup_key_authz(cha, authz, acme, p, &notify_server))) {
260 goto out;
261 }
262
263 rv = md_store_load(store, MD_SG_CHALLENGES, authz->domain, MD_FN_HTTP01,
264 MD_SV_TEXT, (void**)&data, p);
265 if ((APR_SUCCESS == rv && strcmp(cha->key_authz, data)) || APR_STATUS_IS_ENOENT(rv)) {
266 rv = md_store_save(store, p, MD_SG_CHALLENGES, authz->domain, MD_FN_HTTP01,
267 MD_SV_TEXT, (void*)cha->key_authz, 0);
268 notify_server = 1;
269 }
270
271 if (APR_SUCCESS == rv && notify_server) {
272 authz_req_ctx ctx;
273 const char *event;
274
275 /* Raise event that challenge data has been set up before we tell the
276 ACME server. Clusters might want to distribute it. */
277 event = apr_psprintf(p, "challenge-setup:%s:%s", MD_AUTHZ_TYPE_HTTP01, authz->domain);
278 rv = md_result_raise(result, event, p);
279 if (APR_SUCCESS != rv) {
280 md_log_perror(MD_LOG_MARK, MD_LOG_DEBUG, rv, p,
281 "%s: event '%s' failed. aborting challenge setup",
282 authz->domain, event);
283 goto out;
284 }
285 /* challenge is setup or was changed from previous data, tell ACME server
286 * so it may (re)try verification */
287 authz_req_ctx_init(&ctx, acme, NULL, authz, p);
288 ctx.challenge = cha;
289 rv = md_acme_POST(acme, cha->uri, on_init_authz_resp, authz_http_set, NULL, NULL, &ctx);
290 }
291out:
292 *psetup_token = (APR_SUCCESS == rv)?
293 apr_psprintf(p, "%s:%s", MD_AUTHZ_TYPE_HTTP01, authz->domain) : NULL;
294 return rv;
295}
296
297void tls_alpn01_fnames(apr_pool_t *p, md_pkey_spec_t *kspec, char **keyfn, char **certfn )
298{

Callers

nothing calls this directly

Calls 7

setup_key_authzFunction · 0.85
md_store_loadFunction · 0.85
md_store_saveFunction · 0.85
md_result_raiseFunction · 0.85
md_log_perrorFunction · 0.85
authz_req_ctx_initFunction · 0.85
md_acme_POSTFunction · 0.85

Tested by

no test coverage detected