public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Bugzy <pvebugs@fluidolabs.com>
To: pve-devel@lists.proxmox.com
Subject: Re: [PATCH pve-common] Fix bug 4687: Bad IP identifier in ACME certificate requests - Part 2.
Date: Tue, 17 Nov 2026 17:47:52 -0300	[thread overview]
Message-ID: <CAHbfunWdcvYZziwMJ25QGB5mWcMEKLz=SeM_om8jmPsTmmSmLA@mail.gmail.com> (raw)
In-Reply-To: <CAHbfunU_y1hJHP7mptJcSCz2cF98FYfBu4dTNpVTYtw9uwGCXg@mail.gmail.com>

From cd04d04103b50e859821a4f5bdbd7f0b83bf9644 Mon Sep 17 00:00:00 2001
From: Bugzy <pvebugs@fluidolabs.com>
Date: Tue, 17 Nov 2026 16:07:53 -0300
Subject: [PATCH] Fix bug 4687: Bad IP identifier in ACME certificate
requests.

Allow using IP addresses in ACME certificate requests.

Note: Re-rolled from a Bugzilla patch by Tim, issue opened by Bugzy.

Bugzilla comment:
https://bugzilla.proxmox.com/show_bug.cgi?id=4687#c5

Original patch:
https://bugzilla.proxmox.com/attachment.cgi?id=1179

---

Edit: There was a typo in previous `Certificate.pm` patch. Here is the
correct patch. Tested to be working OK.

Signed-off-by: Bugzy <pvebugs@fluidolabs.com>
---
 src/PVE/Certificate.pm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/PVE/Certificate.pm b/src/PVE/Certificate.pm
index 589bce8edd..bf2e9266fb 100644
--- a/src/PVE/Certificate.pm
+++ b/src/PVE/Certificate.pm
@@ -428,11 +428,12 @@ sub generate_csr {
     die "Identifiers are required to generate a CSR.\n"
         if !defined($identifiers);

-    my $san = [map { $_->{value} } grep { $_->{type} eq 'dns' }
@$identifiers];
+    my $san = [map { uc($_->{type}) . ":" . $_->{value} } grep {
$_->{type} eq 'dns' or $_->{type} eq 'ip' } @$identifiers];
     die "DNS identifiers are required to generate a CSR.\n" if !scalar
@$san;

     # optional
     my $common_name = delete($attr{common_name}) // $san->[0];
+    $common_name =~ s/^(IP|DNS)://;

     my $md = eval { Net::SSLeay::EVP_get_digestbyname($dig_alg) };
     die "Invalid digest algorithm '$dig_alg'\n" if !$md;
@@ -508,7 +509,7 @@ sub generate_csr {
         &Net::SSLeay::NID_key_usage => 'digitalSignature,keyEncipherment',
         &Net::SSLeay::NID_basic_constraints => 'CA:FALSE',
         &Net::SSLeay::NID_ext_key_usage => 'serverAuth,clientAuth',
-        &Net::SSLeay::NID_subject_alt_name => join(',', map { "DNS:$_" }
@$san),
+        &Net::SSLeay::NID_subject_alt_name => join(',', @$san),
     ) or $cleanup->("Failed to add extensions to CSR\n");

     $cleanup->("Failed to set public key\n") if
!Net::SSLeay::X509_REQ_set_pubkey($req, $pk);
-- 
2.47.3


On Tue, Nov 17, 2026 at 4:18 PM Bugzy <pvebugs@fluidolabs.com> wrote:

> From 150bd6945836fd1672c50c264e49f8b53a04a658 Mon Sep 17 00:00:00 2001
> From: Bugzy <pvebugs@fluidolabs.com>
> Date: Tue, 17 Nov 2026 16:07:53 -0300
> Subject: [PATCH] Fix bug 4687: Bad IP identifier in ACME certificate
> requests.
>
> Allow using IP addresses in ACME certificate requests.
>
> Note: This is part 2 of a re-roll of a Bugzilla patch by Tim; the issue
> was opened by Bugzy.
>
> Bugzilla comment:
> https://bugzilla.proxmox.com/show_bug.cgi?id=4687#c5
>
> Original patch:
> https://bugzilla.proxmox.com/attachment.cgi?id=1179
>
> ---
> Dear Proxmox maintainers,
>
> This patch is part 2 of another patch I had submittted for the project
> `proxmox-acme`.
>
> We need to fix both `./src/PVE/Certificate.pm` in this project, as well as
> the file `./src/PVE/ACME.pm` in the project `proxmox-acme`.
>
> Then, it will fix the `badCSR` error we currently get if we request
> certificates for a raw IP address.
>
> Signed-off-by: Bugzy <pvebugs@fluidolabs.com>
> ---
>  src/PVE/Certificate.pm | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/PVE/Certificate.pm b/src/PVE/Certificate.pm
> index 589bce8edd..2f84d2e5e6 100644
> --- a/src/PVE/Certificate.pm
> +++ b/src/PVE/Certificate.pm
> @@ -428,11 +428,12 @@ sub generate_csr {
>      die "Identifiers are required to generate a CSR.\n"
>          if !defined($identifiers);
>
> -    my $san = [map { $_->{value} } grep { $_->{type} eq 'dns' }
> @$identifiers];
> +    my $san = [map { uc($_->{type}) . ":" . $_->{value} } grep {
> $_->{type} eq 'dns' or $_->{type} eq 'ip' } @$identifiers];
>      die "DNS identifiers are required to generate a CSR.\n" if !scalar
> @$san;
>
>      # optional
>      my $common_name = delete($attr{common_name}) // $san->[0];
> +    common_name =~ s/^(IP|DNS)://;
>
>      my $md = eval { Net::SSLeay::EVP_get_digestbyname($dig_alg) };
>      die "Invalid digest algorithm '$dig_alg'\n" if !$md;
> @@ -508,7 +509,7 @@ sub generate_csr {
>          &Net::SSLeay::NID_key_usage => 'digitalSignature,keyEncipherment',
>          &Net::SSLeay::NID_basic_constraints => 'CA:FALSE',
>          &Net::SSLeay::NID_ext_key_usage => 'serverAuth,clientAuth',
> -        &Net::SSLeay::NID_subject_alt_name => join(',', map { "DNS:$_" }
> @$san),
> +        &Net::SSLeay::NID_subject_alt_name => join(',', @$san),
>      ) or $cleanup->("Failed to add extensions to CSR\n");
>
>      $cleanup->("Failed to set public key\n") if
> !Net::SSLeay::X509_REQ_set_pubkey($req, $pk);
> --
> 2.47.3
>
>

      reply	other threads:[~2026-11-17 20:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 19:18 [PATCH pve-common] Fix bug 4687: Bad IP identifier in ACME certificate requests - Part 2 Bugzy
2026-11-17 20:47 ` Bugzy [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='CAHbfunWdcvYZziwMJ25QGB5mWcMEKLz=SeM_om8jmPsTmmSmLA@mail.gmail.com' \
    --to=pvebugs@fluidolabs.com \
    --cc=pve-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