* Re: [PATCH pve-common] Fix bug 4687: Bad IP identifier in ACME certificate requests - Part 2.
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
0 siblings, 0 replies; 2+ messages in thread
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 [flat|nested] 2+ messages in thread