From: Samuel Rufinatscha <s.rufinatscha@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [PATCH proxmox 1/3] acme-api: extract certificate order finalization helper
Date: Mon, 14 Sep 2026 18:19:29 +0200 [thread overview]
Message-ID: <20260914161931.380138-2-s.rufinatscha@proxmox.com> (raw)
In-Reply-To: <20260914161931.380138-1-s.rufinatscha@proxmox.com>
Move order finalization and certificate download into a private helper.
Signed-off-by: Samuel Rufinatscha <s.rufinatscha@proxmox.com>
---
proxmox-acme-api/src/certificate_helpers.rs | 23 ++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/proxmox-acme-api/src/certificate_helpers.rs b/proxmox-acme-api/src/certificate_helpers.rs
index 3921b18e..1db41564 100644
--- a/proxmox-acme-api/src/certificate_helpers.rs
+++ b/proxmox-acme-api/src/certificate_helpers.rs
@@ -119,8 +119,20 @@ pub async fn order_certificate(
info!("Creating CSR");
let csr = proxmox_acme::util::Csr::generate(&identifiers, &Default::default())?;
+ let certificate = finalize_order(&mut acme, &order.location, &csr.data).await?;
+
+ Ok(Some(OrderedCertificate {
+ certificate,
+ private_key_pem: csr.private_key_pem,
+ }))
+}
+
+async fn finalize_order(
+ acme: &mut AcmeClient,
+ order_url: &str,
+ csr: &[u8],
+) -> Result<Vec<u8>, Error> {
let mut finalize_error_cnt = 0u8;
- let order_url = &order.location;
let mut order;
loop {
use proxmox_acme::order::Status;
@@ -134,7 +146,7 @@ pub async fn order_certificate(
.finalize
.as_deref()
.ok_or_else(|| format_err!("missing 'finalize' URL in order"))?;
- if let Err(err) = acme.finalize(finalize, &csr.data).await {
+ if let Err(err) = acme.finalize(finalize, csr).await {
if finalize_error_cnt >= 5 {
return Err(err);
}
@@ -149,7 +161,7 @@ pub async fn order_certificate(
.finalize
.as_deref()
.ok_or_else(|| format_err!("missing 'finalize' URL in order"))?;
- acme.finalize(finalize, &csr.data).await?;
+ acme.finalize(finalize, csr).await?;
tokio::time::sleep(Duration::from_secs(5)).await;
}
Status::Processing => {
@@ -174,10 +186,7 @@ pub async fn order_certificate(
)
.await?;
- Ok(Some(OrderedCertificate {
- certificate: certificate.to_vec(),
- private_key_pem: csr.private_key_pem,
- }))
+ Ok(certificate.to_vec())
}
async fn request_validation(
--
2.47.3
next prev parent reply other threads:[~2026-09-14 16:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-14 16:19 [PATCH proxmox 0/3] fix #7166: acme: stop and time out stalled certificate orders Samuel Rufinatscha
2026-09-14 16:19 ` Samuel Rufinatscha [this message]
2026-09-14 16:19 ` [PATCH proxmox 2/3] fix #7166: acme-api: allow stopping " Samuel Rufinatscha
2026-09-14 16:19 ` [PATCH proxmox 3/3] fix #7166: acme-api: time out validation and finalization Samuel Rufinatscha
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260914161931.380138-2-s.rufinatscha@proxmox.com \
--to=s.rufinatscha@proxmox.com \
--cc=pdm-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox