public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH proxmox-acme] Fix bug 4687: Bad IP identifier in ACME certificate requests.
@ 2026-11-17 18:56 14% Bugzy
  0 siblings, 0 replies; 3+ results
From: Bugzy @ 2026-11-17 18:56 UTC (permalink / raw)
  To: pve-devel

From e709aabd52358ba460cb1829c27d8a37e643c537 Mon Sep 17 00:00:00 2001
From: Bugzy <pvebugs@fluidolabs.com>
Date: Tue, 17 Nov 2026 14:54:10 -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

---
Dear Proxmox maintainers,

This patch is part of another patch I will submit for the project
`pve-common`.

We need to fix both `./src/PVE/ACME.pm` in this project, as well as
the file `./src/PVE/Certificate.pm` in the project `pve-common`.

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/ACME.pm | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/PVE/ACME.pm b/src/PVE/ACME.pm
index d3604b4a9a..b3d4a90049 100644
--- a/src/PVE/ACME.pm
+++ b/src/PVE/ACME.pm
@@ -14,6 +14,7 @@ use Digest::SHA qw(sha256 sha256_hex hmac_sha256);

 use HTTP::Request;
 use LWP::UserAgent;
+use Net::IP;

 use Crypt::OpenSSL::Random;
 use Crypt::OpenSSL::RSA;
@@ -408,6 +409,13 @@ sub get_account {
     return $self->update_account();
 }

+# Returns whether a domain is a "dns" name or an "ip" address
+# for use in certificates / CSRs.
+sub get_domain_type {
+    my ($domain) = @_;
+    return (new Net::IP($domain)) ? 'ip' : 'dns';
+}
+
 # Start a new order for one or more domains
 # POST to newOrder endpoint
 # Expects a '201 Created' reply
@@ -417,7 +425,8 @@ sub new_order {

     my $url = $self->_method('newOrder');
     my $req = {
-        identifiers => [map { { type => 'dns', value => $_ } } @$domains],
+        identifiers => [map { { type => get_domain_type($_), value => $_ }
} @$domains],
+
     };

     my $r = $self->do(POST => $url, $req);
-- 
2.47.3

^ permalink raw reply related	[relevance 14%]

* [PATCH pve-common] Fix bug 4687: Bad IP identifier in ACME certificate requests - Part 2.
@ 2026-11-17 19:18 14% Bugzy
  2026-11-17 20:47 13% ` Bugzy
  0 siblings, 1 reply; 3+ results
From: Bugzy @ 2026-11-17 19:18 UTC (permalink / raw)
  To: pve-devel

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

^ permalink raw reply related	[relevance 14%]

* Re: [PATCH pve-common] Fix bug 4687: Bad IP identifier in ACME certificate requests - Part 2.
  2026-11-17 19:18 14% [PATCH pve-common] Fix bug 4687: Bad IP identifier in ACME certificate requests - Part 2 Bugzy
@ 2026-11-17 20:47 13% ` Bugzy
  0 siblings, 0 replies; 3+ results
From: Bugzy @ 2026-11-17 20:47 UTC (permalink / raw)
  To: pve-devel

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
>
>

^ permalink raw reply related	[relevance 13%]

Results 1-3 of 3 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2026-11-17 18:56 14% [PATCH proxmox-acme] Fix bug 4687: Bad IP identifier in ACME certificate requests Bugzy
2026-11-17 19:18 14% [PATCH pve-common] Fix bug 4687: Bad IP identifier in ACME certificate requests - Part 2 Bugzy
2026-11-17 20:47 13% ` Bugzy

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