From: "Lukas Wagner" <l.wagner@proxmox.com>
To: "Shannon Sterz" <s.sterz@proxmox.com>, <pdm-devel@lists.proxmox.com>
Subject: Re: [PATCH datacenter-manager 08/11] api/auth/bin: add certificate renewal logic
Date: Fri, 10 Jul 2026 13:17:28 +0200 [thread overview]
Message-ID: <DJUUL4ZP1GQT.N8GCK1L3SEKS@proxmox.com> (raw)
In-Reply-To: <20260618115443.48618-9-s.sterz@proxmox.com>
On Thu Jun 18, 2026 at 1:54 PM CEST, Shannon Sterz wrote:
> + pub SELF_SIGNED_REGEX = concatcp!(
> + r#"^O\s?=\s?"#,
> + crate::auth::certs::PRODUCT_NAME,
> + r#", OU\s?=\s?[0-9a-fA-F]{8}-(?:[0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}, CN\s?=\s?(?<fqdn>.*)$"#
> + );
> +}
> +
> pub const ROUTER: Router = Router::new()
> .get(&list_subdirs_api_method!(SUBDIRS))
> .subdirs(SUBDIRS);
> @@ -247,6 +258,43 @@ pub fn cert_expires_soon() -> Result<bool, Error> {
> .map_err(|err| format_err!("Failed to check certificate expiration date: {}", err))
> }
>
> +/// Check whether the current certificate is self-signed and returns the remaining days the
> +/// certificate is valid for.
> +pub fn self_signed_cert_expires_in() -> Result<Option<i32>, Error> {
This helper seems very similar to the one you added in PBS, would it
make sense to move it to some shared crate?
> + let cert = get_certificate_info()?;
> +
> + let Some(captures) = (SELF_SIGNED_REGEX.regex_obj)().captures(&cert.issuer) else {
> + return Ok(None);
> + };
> +
> + let mut fqdn = proxmox_sys::nodename().to_owned();
> + let resolv_conf = read_etc_resolv_conf(None)?.config;
> +
> + if let Some(domain) = resolv_conf.search {
> + fqdn.push('.');
> + fqdn.push_str(&domain);
> + }
> +
> + if captures["fqdn"] != fqdn {
> + return Ok(None);
> + }
> +
> + let now = Asn1Time::from_unix(proxmox_time::epoch_i64())?;
> + let not_after = Asn1Time::from_unix(cert.notafter.ok_or_else(|| {
> + format_err!("Could not get \"not after\" epoch for current certificate.")
> + })?)?;
> +
> + let diff = now.diff(¬_after)?;
> + Ok(Some(diff.days))
> +}
next prev parent reply other threads:[~2026-07-10 11:18 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-18 11:54 [PATCH datacenter-manager/proxmox{,-backup} 00/11] TLS Certificate Rotation Shannon Sterz
2026-06-18 11:54 ` [PATCH proxmox 01/11] acme-api: make self-signed certificate expiry configurable Shannon Sterz
2026-07-10 11:15 ` Lukas Wagner
2026-06-18 11:54 ` [PATCH proxmox-backup 02/11] config: use proxmox_acme_api for generating self-signed certificates Shannon Sterz
2026-06-18 11:54 ` [PATCH proxmox-backup 03/11] config: adapt to api change in proxmox_acme_api, add expiry paramter Shannon Sterz
2026-06-18 11:54 ` [PATCH proxmox-backup 04/11] config/server/api: add certificate renewal logic including notifications Shannon Sterz
2026-07-10 11:17 ` Lukas Wagner
2026-06-18 11:54 ` [PATCH proxmox-backup 05/11] daily-update/docs: warn on excessive self-signed certificate lifetime Shannon Sterz
2026-07-10 11:17 ` Lukas Wagner
2026-06-18 11:54 ` [PATCH proxmox-backup 06/11] backup-manager cli: `cert update` can create auth and csrf key Shannon Sterz
2026-06-18 11:54 ` [PATCH datacenter-manager 07/11] certs: adapt to api change in proxmox_acme_api, add expiry paramter Shannon Sterz
2026-06-18 11:54 ` [PATCH datacenter-manager 08/11] api/auth/bin: add certificate renewal logic Shannon Sterz
2026-07-10 11:17 ` Lukas Wagner [this message]
2026-06-18 11:54 ` [PATCH datacenter-manager 09/11] cli: expose certificate management endpoints via the cli Shannon Sterz
2026-06-18 11:54 ` [PATCH datacenter-manager 10/11] daily-update/docs: warn on excessive tls certificate validity periods Shannon Sterz
2026-06-18 11:54 ` [PATCH datacenter-manager 11/11] docs/certificates: use correct certificate file name Shannon Sterz
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=DJUUL4ZP1GQT.N8GCK1L3SEKS@proxmox.com \
--to=l.wagner@proxmox.com \
--cc=pdm-devel@lists.proxmox.com \
--cc=s.sterz@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