all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: "Elias Huhsovitz" <e.huhsovitz@proxmox.com>
To: "Thomas Ellmenreich" <t.ellmenreich@proxmox.com>,
	<pve-devel@lists.proxmox.com>
Subject: Re: [PATCH proxmox-acme v3 2/2] fix #5978: pem parser: relax parsing of chain entries:
Date: Tue, 04 Aug 2026 13:02:28 +0200	[thread overview]
Message-ID: <DKG3X9OWZKGS.3TPUROW14T2TI@proxmox.com> (raw)
In-Reply-To: <20260703105133.77817-3-t.ellmenreich@proxmox.com>

On Fri Jul 3, 2026 at 12:51 PM CEST, Thomas Ellmenreich wrote:
> Instead of using a custom regex to parse pem chains, now uses
> the pve-common Certificate::check_pem function to do so. This
> now allows for additional text and whitespace inbetween the
> chain entries.
>
> Signed-off-by: Thomas Ellmenreich <t.ellmenreich@proxmox.com>
> ---

Good change to use standard pve-common implementation instead of custom
regex!

See comments below.

>  src/PVE/ACME.pm | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/src/PVE/ACME.pm b/src/PVE/ACME.pm
> index e6fb9c2..7adda25 100644
> --- a/src/PVE/ACME.pm
> +++ b/src/PVE/ACME.pm
> @@ -526,14 +526,15 @@ sub get_certificate {
>                      }
>                  }
>              }
> -            die "no matching alternate chain for '$root' returned by server\n"
> +            die "no matching alternate chain for '$root' provided by the acme server\n"
>                  if !defined($res);
>          }
>  
> -        if ($res =~ /^(-----BEGIN CERTIFICATE-----)(.+)(-----END CERTIFICATE-----)$/s) { # untaint
> -            return $1 . $2 . $3;
> -        }
> -        die "Server reply does not look like a PEM encoded certificate\n";
> +        my $parsed = eval { PVE::Certificate::check_pem($res, multiple => 1) };
> +        die
> +            "value returned by acme certificate url does not look like a PEM encoded certificate: $@\n"
> +            if $@;

nit: Error message inside of $@ might contain trailing newline. Consider
remvoing the newline before die statement. e.g.,

die "value returned by ACME certificate url does not look like a PEM encoded certificate: " . chomp($@) . "\n"
    if $@;

nit: in the error message "PEM" is capitalized by "acme" is not. Capitalize both for
consistency. e.g., code sample above.


> +        return $parsed;
>      };
>      $self->fatal("POST of '$order->{certificate}' failed - $@", $r) if $@;
>      return $return;





      reply	other threads:[~2026-08-04 11:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-03 10:51 [PATCH common/proxmox-acme v3 0/2] fix #5978: pem parser: relax parsing of chain entries Thomas Ellmenreich
2026-07-03 10:51 ` [PATCH common v3 1/2] " Thomas Ellmenreich
2026-08-04 10:55   ` Elias Huhsovitz
2026-07-03 10:51 ` [PATCH proxmox-acme v3 2/2] fix #5978: pem parser: relax parsing of chain entries: Thomas Ellmenreich
2026-08-04 11:02   ` Elias Huhsovitz [this message]

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=DKG3X9OWZKGS.3TPUROW14T2TI@proxmox.com \
    --to=e.huhsovitz@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=t.ellmenreich@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal