MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / request_new_certificate_inner

Method request_new_certificate_inner

certbot/src/acme_client.rs:428–510  ·  view source on GitHub ↗
(
        &self,
        key: &str,
        domains: &[String],
        challenges: &mut Vec<Challenge>,
    )

Source from the content-addressed store, hash-verified

426 }
427
428 async fn request_new_certificate_inner(
429 &self,
430 key: &str,
431 domains: &[String],
432 challenges: &mut Vec<Challenge>,
433 ) -> Result<String> {
434 debug!("requesting new certificates for {}", domains.join(", "));
435 debug!("creating new order");
436 let identifiers = domains
437 .iter()
438 .map(|name| Identifier::Dns(name.clone()))
439 .collect::<Vec<_>>();
440 let mut order = self
441 .account
442 .new_order(&NewOrder {
443 identifiers: &identifiers,
444 })
445 .await
446 .context("failed to cread new order")?;
447 let mut challenges_ready = false;
448 loop {
449 order.refresh().await.context("failed to refresh order")?;
450 match order.state().status {
451 // Need to accept the challenge
452 OrderStatus::Pending => {
453 if challenges_ready {
454 debug!("challenges are ready, waiting for order to be ready");
455 sleep(Duration::from_secs(2)).await;
456 continue;
457 }
458 debug!("order is pending, waiting for authorization");
459 self.authorize(&mut order, challenges)
460 .await
461 .context("failed to authorize")?;
462 if challenges.is_empty() {
463 bail!("no challenges found");
464 }
465 self.check_dns(challenges)
466 .await
467 .context("failed to check dns")?;
468 for challenge in &*challenges {
469 debug!("setting challenge ready for {}", challenge.url);
470 order
471 .set_challenge_ready(&challenge.url)
472 .await
473 .context("failed to set challenge ready")?;
474 }
475 challenges_ready = true;
476 continue;
477 }
478 // To upload CSR
479 OrderStatus::Ready => {
480 debug!("order is ready, uploading CSR");
481 let csr = make_csr(key, domains)?;
482 order
483 .finalize(csr.as_ref())
484 .await
485 .context("failed to finalize order")?;

Callers 1

Calls 8

make_csrFunction · 0.85
extract_certificateFunction · 0.85
find_errorFunction · 0.85
cloneMethod · 0.80
authorizeMethod · 0.80
check_dnsMethod · 0.80
is_emptyMethod · 0.45
as_refMethod · 0.45

Tested by

no test coverage detected