From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pbs-devel@lists.proxmox.com, Shannon Sterz <s.sterz@proxmox.com>
Subject: Re: [PATCH proxmox v3 03/16] tls-certificates: add self_signed_cert_expires_in to check certificates
Date: Thu, 06 Aug 2026 15:49:12 +0200 [thread overview]
Message-ID: <1786024038.yyctmo025m.astroid@yuna.none> (raw)
In-Reply-To: <1786019255.vl8y2g6kbs.astroid@yuna.none>
On August 6, 2026 3:09 pm, Fabian Grünbichler wrote:
> On August 5, 2026 5:52 pm, Shannon Sterz wrote:
>> this is useful when self-signed certificates are in use. it
>> heuristically checks whether a certificate is self-signed by the
>> specified node and returns for how many more days the certificate is
>> valid if it is a self-signed certificate.
>>
>> Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
>> ---
>> proxmox-tls-certificates/Cargo.toml | 2 +
>> proxmox-tls-certificates/src/lib.rs | 2 +-
>> proxmox-tls-certificates/src/util.rs | 55 ++++++++++++++++++++++++++++
>> 3 files changed, 58 insertions(+), 1 deletion(-)
>>
>> diff --git a/proxmox-tls-certificates/Cargo.toml b/proxmox-tls-certificates/Cargo.toml
>> index 3a7b97cd..658a700d 100644
>> --- a/proxmox-tls-certificates/Cargo.toml
>> +++ b/proxmox-tls-certificates/Cargo.toml
>> @@ -16,6 +16,7 @@ hex = { workspace = true, optional = true }
>> libc = { workspace = true, optional = true }
>> openssl = { workspace = true, optional = true }
>> serde = { workspace = true, features = [ "derive" ] }
>> +regex = { workspace = true, optional = true }
>>
>> proxmox-schema = { workspace = true, features = [ "api-macro" ] }
>> proxmox-time = { workspace = true, optional = true }
>> @@ -29,6 +30,7 @@ impl = [
>> "dep:hex",
>> "dep:libc",
>> "dep:openssl",
>> + "dep:regex",
>>
>> "dep:proxmox-time",
>> "dep:proxmox-uuid",
>> diff --git a/proxmox-tls-certificates/src/lib.rs b/proxmox-tls-certificates/src/lib.rs
>> index 454c700f..66def7d6 100644
>> --- a/proxmox-tls-certificates/src/lib.rs
>> +++ b/proxmox-tls-certificates/src/lib.rs
>> @@ -4,4 +4,4 @@ pub use types::CertificateInfo;
>> #[cfg(feature = "impl")]
>> mod util;
>> #[cfg(feature = "impl")]
>> -pub use util::create_self_signed_cert;
>> +pub use util::{create_self_signed_cert, self_signed_cert_expires_in};
>> diff --git a/proxmox-tls-certificates/src/util.rs b/proxmox-tls-certificates/src/util.rs
>> index 98aa042e..a07903d8 100644
>> --- a/proxmox-tls-certificates/src/util.rs
>> +++ b/proxmox-tls-certificates/src/util.rs
>> @@ -2,12 +2,54 @@ use std::mem::MaybeUninit;
>>
>> use anyhow::{Error, bail, format_err};
>> use foreign_types::ForeignTypeRef;
>> +use openssl::asn1::Asn1Time;
>> use openssl::pkey::{PKey, Private};
>> use openssl::rsa::Rsa;
>> use openssl::x509::{X509, X509Builder};
>>
>> use crate::CertificateInfo;
>>
>> +proxmox_schema::const_regex! {
>> + SELF_SIGNED_REGEX =
>> + // O = $product_name, OU = $uuid, CN = $nodename
>> + r#"^O\s?=\s(?P<product>.*)?, OU\s?=\s?[0-9a-fA-F]{8}-(?:[0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}, CN\s?=\s?(?P<fqdn>.*)$"#;
>> +}
>> +
>> +/// Check whether the current certificate is self-signed and returns the remaining days the
>> +/// certificate is valid for.
>
> I am a bit confused by this description - do we want to check that it is
> self-signed? then we should check that cert.subject == cert.issuer (or
> better, actual_cert.issued(&actual_cert) via `openssl` ;))
>
> or do we want to check that it seems to be created by our product stack?
> then we should maybe name this a bit differently and document what the
> semantics/expectations are?
>
> or should we maybe make this two helpers, one checking expiry, one
> checking self-signed/..-ness (and if needed for a smooth migration, keep
> a deprecated combined helper around for a bit)?
>
> since the next patch drops the compat-re-export of this helper, it seems
> to me we could rework the interface and then drop the old one entirely?
summary of a short off-list discussion:
- we could consider adding a custom, non-critical extension to generated
certificates, and use that to detect whether it is "one of ours"
- the current, 1000 year self-signed certs won't ever run into the
refresh logic anyway, and any newly (re)generated ones would have the
extension as marker
- PVE can use the "signed by cluster CA" property (once/if it switches
over to a perlmod-ified variant of this series)
next prev parent reply other threads:[~2026-08-06 13:49 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-05 15:52 [PATCH datacenter-manager/proxmox{,-backup} v3 00/16] TLS Certificate Rotation Shannon Sterz
2026-08-05 15:52 ` [PATCH proxmox v3 01/16] acme-api/tls-certificates: add new crate collecting tls related helpers Shannon Sterz
2026-08-05 15:52 ` [PATCH proxmox v3 02/16] tls-certificates: add days_valid parameter to create_self_signed_cert Shannon Sterz
2026-08-06 13:09 ` Fabian Grünbichler
2026-08-06 13:49 ` Shannon Sterz
2026-08-05 15:52 ` [PATCH proxmox v3 03/16] tls-certificates: add self_signed_cert_expires_in to check certificates Shannon Sterz
2026-08-06 13:09 ` Fabian Grünbichler
2026-08-06 13:49 ` Fabian Grünbichler [this message]
2026-08-05 15:52 ` [PATCH proxmox v3 04/16] acme-api: stop re-exporting create_self_signed_cert Shannon Sterz
2026-08-05 15:52 ` [PATCH proxmox-backup v3 05/16] config: use proxmox_tls_certificates for generating self-signed certificates Shannon Sterz
2026-08-06 13:09 ` Fabian Grünbichler
2026-08-06 13:49 ` Shannon Sterz
2026-08-05 15:52 ` [PATCH proxmox-backup v3 06/16] config/server/api: add certificate renewal logic including notifications Shannon Sterz
2026-08-06 13:09 ` Fabian Grünbichler
2026-08-05 15:53 ` [PATCH proxmox-backup v3 07/16] daily update: warn about excessive self-signed certificate lifetime Shannon Sterz
2026-08-05 15:53 ` [PATCH proxmox-backup v3 08/16] docs: document force refreshing long-lived certificates Shannon Sterz
2026-08-05 15:53 ` [PATCH proxmox-backup v3 09/16] backup-manager cli: `cert update` can create auth and csrf key Shannon Sterz
2026-08-06 13:27 ` applied: " Fabian Grünbichler
2026-08-05 15:53 ` [PATCH proxmox-backup v3 10/16] notifications: use `Severity::Error` for acme renewal failures Shannon Sterz
2026-08-06 13:27 ` applied: " Fabian Grünbichler
2026-08-05 15:53 ` [PATCH datacenter-manager v3 11/16] certs: use proxmox-tls-certificates directly, add days_valid parameter Shannon Sterz
2026-08-05 15:53 ` [PATCH datacenter-manager v3 12/16] api/auth/bin: add certificate renewal logic Shannon Sterz
2026-08-05 15:53 ` [PATCH datacenter-manager v3 13/16] cli: expose certificate management endpoints via the cli Shannon Sterz
2026-08-06 13:53 ` applied: " Fabian Grünbichler
2026-08-05 15:53 ` [PATCH datacenter-manager v3 14/16] daily-update: warn about certificates with excessive lifetimes Shannon Sterz
2026-08-05 15:53 ` [PATCH datacenter-manager v3 15/16] docs: add section on forcing a new self-signed certificate Shannon Sterz
2026-08-05 15:53 ` [PATCH datacenter-manager v3 16/16] docs/certificates: use correct certificate file name Shannon Sterz
2026-08-06 13:54 ` partially-applied: " Fabian Grünbichler
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=1786024038.yyctmo025m.astroid@yuna.none \
--to=f.gruenbichler@proxmox.com \
--cc=pbs-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