From: "Shannon Sterz" <s.sterz@proxmox.com>
To: "Lukas Wagner" <l.wagner@proxmox.com>, <pdm-devel@lists.proxmox.com>
Subject: Re: [PATCH datacenter-manager 08/11] api/auth/bin: add certificate renewal logic
Date: Wed, 29 Jul 2026 11:53:17 +0200 [thread overview]
Message-ID: <DKAYP13WWI2V.1BBE63SYAF06X@proxmox.com> (raw)
In-Reply-To: <DJUUL4ZP1GQT.N8GCK1L3SEKS@proxmox.com>
On Fri Jul 10, 2026 at 1:17 PM CEST, Lukas Wagner wrote:
> 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?
i agree, but imo we currently don't have a nice place for things that
are tls certificate related, but make no sense in an acme specific
context. this is a problem also holding up other series in this space
like dominik's unify openssl callback series [1]. i started an internal
discussion about that, but until that is concluded i'd keep this code
as-is.
[1]: https://lore.proxmox.com/pbs-devel/20260701103120.1593265-2-d.csapak@proxmox.com/
>> + 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-29 9:53 UTC|newest]
Thread overview: 24+ 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-07-29 9:53 ` Shannon Sterz
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-07-29 9:53 ` Shannon Sterz
2026-07-29 10:08 ` Lukas Wagner
2026-07-29 10:13 ` Shannon Sterz
2026-07-29 10:29 ` 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-07-29 9:53 ` Shannon Sterz
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
2026-07-29 9:53 ` Shannon Sterz [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
2026-07-30 13:33 ` [PATCH datacenter-manager/proxmox{,-backup} 00/11] TLS Certificate Rotation 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=DKAYP13WWI2V.1BBE63SYAF06X@proxmox.com \
--to=s.sterz@proxmox.com \
--cc=l.wagner@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