public inbox for pdm-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Shannon Sterz" <s.sterz@proxmox.com>
To: "Lukas Wagner" <l.wagner@proxmox.com>, <pdm-devel@lists.proxmox.com>
Subject: Re: [PATCH proxmox-backup 04/11] config/server/api: add certificate renewal logic including notifications
Date: Wed, 29 Jul 2026 11:53:13 +0200	[thread overview]
Message-ID: <DKAYOZ3FFYYW.1QISE0FM2M6LO@proxmox.com> (raw)
In-Reply-To: <DJUUKWOZRJFG.26MQEMVN3HEHL@proxmox.com>

On Fri Jul 10, 2026 at 1:17 PM CEST, Lukas Wagner wrote:
> Hi Shannon,
>
> some notes inline.
>
> On Thu Jun 18, 2026 at 1:54 PM CEST, Shannon Sterz wrote:

-->8 snip 8<--

>>
>> +/// Send email for upcoming self signed renewal.
>> +pub fn send_upcoming_self_signed_renewal_notification() -> Result<(), Error> {
>> +    let metadata = HashMap::from([
>> +        ("hostname".into(), proxmox_sys::nodename().into()),
>> +        ("type".into(), "cert".into()),
>> +    ]);
>> +
>> +    let notification = Notification::from_template(
>> +        Severity::Info,
>
> Maybe this should use Severity::Notice? Since it might require some
> attention from the user?

imo no, at least not yet. this series does not stage certificates yet
(like my series for pve would [1]), so there is nothing a user can do at
this stage. however, the notification further down that a renewal has
happened needs more attention as fingerprints would need to be
exchanged. so i'll adjust the severity there.

once we have a staging mechanism in place, we can include the new
fingerprint in the notification and increase the severity here to make
users aware this will happen. we can then tell the user to make sure to
check that any clients are either updated automatically (through a
mechanism similar to the one in that series) or that they should add the
fingerprint manually.

[1]: https://lore.proxmox.com/all/20260611120327.257523-1-s.sterz@proxmox.com/

>> +        "cert-upcoming-refresh",
>> +        serde_json::to_value(CommonData::new())?,
>> +        metadata,
>> +    );
>> +
>> +    send_notification(notification)?;
>> +    Ok(())
>> +}
>> +
>> +/// Send email renewed self-signed certificate
>> +pub fn send_self_signed_renewal_notification(result: &Result<(), Error>) -> Result<(), Error> {
>> +    let metadata = HashMap::from([
>> +        ("hostname".into(), proxmox_sys::nodename().into()),
>> +        ("type".into(), "acme".into()),
>
> I guess the type should be "cert"?
>
> Also, maybe a longer 'cert-renewal' might be clearer. Maybe we could
> consolidate the ACME and self-signed notifications at some point
> (probably during a major upgrade, since notification matchers might rely
> on the type being 'acme')

ack, i went with cert-renewal for now.

>
>> +    ]);
>> +
>> +    let notification = match result {
>> +        Err(e) => {
>> +            let template_data = AcmeErrTemplateData {
>> +                common: CommonData::new(),
>> +                error: format!("{e:#}"),
>> +            };
>> +
>> +            Notification::from_template(
>> +                Severity::Info,
>
> This should be Severity::Error. Seems like in the pre-existing
> ACME certificate notification it also only uses Info, which seems like a
> bug to me. Feel free to fix it there as well.

done.

>> +                "acme-err",
>
> Considering that templates can be overridden by users, we might want use
> a dedicated template for the self-signed ones. Or, as mentioned above,
> consolidate the notification types, which *could* (but does not have to)
> mean that we also use the same templates for both, ACME and self-signed.

ack, added a second cert-err template for now.

>> +                serde_json::to_value(template_data)?,
>> +                metadata,
>> +            )
>> +        }
>> +        _ => Notification::from_template(
>> +            Severity::Info,
>> +            "cert-refresh",
>> +            serde_json::to_value(CommonData::new())?,
>> +            metadata,
>> +        ),
>
> I've just realized that we don't really send notifications for
> successful ACME cert refreshes, so maybe we should do this in the future
> as well. This would of course be a separate patch series, just thinking
> out aloud here.

we could, but the point of using acme usually is that you use
certificates that are trusted by other hosts in you environment.
meaning, you either use a public acme provider that is generally trusted
or a private one and add your root cert to the trust stores of the
systems in your environment.

this means, most users using acme (usually) don't need to do anything
when successfully refreshing. whereas, a refreshed self-signed
certificate requires exchanging fingerprints again. otherwise, backups
will start failing.

so imo, if we want to add a notification for that, it should be lower
severity than the self-signed certificate one.

>> +    };
>> +
>> +    send_notification(notification)
>> +}

-->8 snip 8<--

>> diff --git a/templates/default/cert-upcoming-refresh-body.txt.hbs b/templates/default/cert-upcoming-refresh-body.txt.hbs
>> new file mode 100644
>> index 000000000..8d199c9fd
>> --- /dev/null
>> +++ b/templates/default/cert-upcoming-refresh-body.txt.hbs
>> @@ -0,0 +1,9 @@
>> +Proxmox Backup Server will refresh its TLS certificate within the next 30 days.
>
> I wonder, would it be possible to include a concrete date here? If I
> understood it correctly, the first time the user receives this
> notification, the renewal would be first attempted in 15 days at the
> earliest, so maybe this should be mentioned.

i can add a line that the earliest a certificate will updated is in X
days.

adding a date is imo a bit trickier due to localization. as far as i can
tell, handlebars [1] currently has no date formatting helpers. so either
we implement our own, which seems orthogonal to this series and probably
not worth it if we do decide to switch templating engines in the near
future. or we don't care about localization and simply decide on one
format (e.g. YYYY-MM-DD).

what do you think?

[1]: https://github.com/sunng87/handlebars-rust/issues/614

-->8 snip 8<--




  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 [this message]
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
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=DKAYOZ3FFYYW.1QISE0FM2M6LO@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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal