From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 0B8BD91642 for ; Mon, 29 Jan 2024 14:15:23 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 542A2162F0 for ; Mon, 29 Jan 2024 14:15:22 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Mon, 29 Jan 2024 14:15:21 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 13C20492F1 for ; Mon, 29 Jan 2024 14:15:21 +0100 (CET) Message-ID: <900962afcb6e80f11c9366f43b30584853a8ea55.camel@proxmox.com> From: Folke Gleumes To: Proxmox VE development discussion Date: Mon, 29 Jan 2024 14:15:20 +0100 In-Reply-To: <20240125082800.11857-1-shana@zju.edu.cn> References: <1fc22f503128b9043613c4f6571232189857ebe3.camel@proxmox.com> <20240125082800.11857-1-shana@zju.edu.cn> Organization: Proxmox Server Solutions GmbH Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4-2 MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.021 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [acme.pm] Subject: Re: [pve-devel] [PATCH v2 acme] Fix EBA MAC key decoding X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2024 13:15:23 -0000 On Thu, 2024-01-25 at 16:28 +0800, YU Jincheng wrote: > Accroding to RFC 8555: >=20 > > The MAC key SHOULD be provided in base64url-encoded form... >=20 > However, currently we are only decoding the MAC key as base64. > This patch chooses the correct function to decode the user provided > MAC key. This can fix authentication error when a user uses command > `pvenode acme account register` and paste the EBA MAC key as > prompted. >=20 > Signed-off-by: YU Jincheng > --- > =C2=A0src/PVE/ACME.pm | 9 +++++++-- > =C2=A01 file changed, 7 insertions(+), 2 deletions(-) >=20 > diff --git a/src/PVE/ACME.pm b/src/PVE/ACME.pm > index bf5410d..65094c2 100644 > --- a/src/PVE/ACME.pm > +++ b/src/PVE/ACME.pm > @@ -7,7 +7,7 @@ use POSIX; > =C2=A0 > =C2=A0use Data::Dumper; > =C2=A0use Date::Parse; > -use MIME::Base64 qw(encode_base64url decode_base64); > +use MIME::Base64 qw(encode_base64url decode_base64 > decode_base64url); > =C2=A0use File::Path qw(make_path); > =C2=A0use JSON; > =C2=A0use Digest::SHA qw(sha256 sha256_hex hmac_sha256); > @@ -365,7 +365,12 @@ sub new_account { > =C2=A0=C2=A0=C2=A0=C2=A0 my %payload =3D ( contact =3D> $info{contact} ); > =C2=A0 > =C2=A0=C2=A0=C2=A0=C2=A0 if (defined($info{eab})) { > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0my $eab_hmac_key =3D decode_ba= se64($info{eab}->{hmac_key}); > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0my $eab_hmac_key; > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if ($info{eab}->{hmac_key} =3D= ~ m/[+\/]/) { > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 $eab_hmac_k= ey =3D decode_base64($info{eab}->{hmac_key}); > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0} else { > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 $eab_hmac_k= ey =3D decode_base64url($info{eab}->{hmac_key}); > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0} > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0$payload{externalAccountB= inding} =3D > external_account_binding_jws( > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 $info{= eab}->{kid}, > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 $eab_h= mac_key, Thanks! Works as intended, tested with base64, base64url and strings that would be valid for both. Tested-by: Folke Gleumes