From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 735FD1FF0E7 for ; Fri, 10 Jul 2026 13:15:54 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 21D14212C1; Fri, 10 Jul 2026 13:15:54 +0200 (CEST) Content-Type: text/plain; charset=UTF-8 Date: Fri, 10 Jul 2026 13:15:47 +0200 Message-Id: Subject: Re: [PATCH proxmox 01/11] acme-api: make self-signed certificate expiry configurable From: "Lukas Wagner" To: "Shannon Sterz" , Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Mailer: aerc 0.21.0-0-g5549850facc2-dirty References: <20260618115443.48618-1-s.sterz@proxmox.com> <20260618115443.48618-2-s.sterz@proxmox.com> In-Reply-To: <20260618115443.48618-2-s.sterz@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1783682136729 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.000 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: 3GUNTKBGNPYJYGXVEWCZXPPEMBVWX4DW X-Message-ID-Hash: 3GUNTKBGNPYJYGXVEWCZXPPEMBVWX4DW X-MailFrom: l.wagner@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Hi Shannon, thanks for the patch. Some notes inline. On Thu Jun 18, 2026 at 1:54 PM CEST, Shannon Sterz wrote: > and change the default from 365000 days (almost 1000 years) to 3650 > days (almost 10 years). almost 1000 years is excessive, as no > practical cryptographic key can reasonably be considered safe for that > amount of time. almost 10 years should still give plenty of time to > prepare for certificate changes. > > Signed-off-by: Shannon Sterz > --- > > Notes: > imo, we could go down even more. as far as i am aware there is no rea= l > limit that is being enforced here for self-signed certificates from a > browser perspective. they are already trusted on an exemption-basis > anyway. however, certificates signed by public CAs will only be valid > for a maximum of 47 days by 2029 [1]. > =20 > hence, i would personally either adopt the same limit or go down to a > year, as a sensible middle-ground. certificate rotation should really > be automated even in self-signed scenarios. we also had cases in the > past, where customers already ran into issue because they wanted to > limit the lifetime of their certificates below 30 days [2]. meaning > that there is a need out there for shorter lived certificates (though= , > in that case a custom CA & ACME setup was used). > =20 > [1]: https://github.com/cabforum/servercert/pull/553 > [2]: https://bugzilla.proxmox.com/show_bug.cgi?id=3D6372 > > proxmox-acme-api/src/certificate_helpers.rs | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/proxmox-acme-api/src/certificate_helpers.rs b/proxmox-acme-a= pi/src/certificate_helpers.rs > index 3921b18e..9c55d30e 100644 > --- a/proxmox-acme-api/src/certificate_helpers.rs > +++ b/proxmox-acme-api/src/certificate_helpers.rs Please use this opportunity to add a doc-string for this function which also documents this new parameter. > @@ -214,6 +214,7 @@ pub fn create_self_signed_cert( > product_name: &str, > nodename: &str, > domain: Option<&str>, > + expire: Option, Maybe change the name in such a way that it's clear that this is - a duration (not a timestamp) - measured in days e.g. `expiry_in_days` (there might be better choices) Maybe it would even be a good idea to use the 'Duration' type here? I guess then the name could stay the same, since the type encodes the semantics quite nicely. Duration::from_days is still only in nightly, so instantiating it via Duration::from_secs for now is a bit awkward for this situation, admittedly. https://doc.rust-lang.org/beta/std/time/struct.Duration.html#method.from_da= ys > ) -> Result<(PKey, X509), Error> { > let rsa =3D Rsa::generate(4096).unwrap(); > =20 > @@ -223,7 +224,7 @@ pub fn create_self_signed_cert( > =20 > let today =3D openssl::asn1::Asn1Time::days_from_now(0)?; > x509.set_not_before(&today)?; > - let expire =3D openssl::asn1::Asn1Time::days_from_now(365 * 1000)?; > + let expire =3D openssl::asn1::Asn1Time::days_from_now(expire.unwrap_= or(365 * 10))?; > x509.set_not_after(&expire)?; > =20 > let mut fqdn =3D nodename.to_owned(); Also would not hurt to use this opportunity to implement a simple unit-test for this function, which (at least) tests that the expiry is set correctly. I think this crate should already have all the needed helpers to parse and verify the generated cert in a test?