From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 3E5CA1FF0AA for ; Tue, 17 Nov 2026 17:05:31 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 376F221680; Tue, 17 Nov 2026 17:05:26 +0100 (CET) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Tue, 17 Nov 2026 17:05:21 +0100 Message-Id: To: "Mark Atwood" , Subject: Re: [PATCH common v2 1/2] ticket: accept RSA tickets signed with SHA-256 X-Mailer: aerc 0.20.0 References: <20261113030639.3514-1-mark@wolfssl.com> <20261113030639.3514-2-mark@wolfssl.com> In-Reply-To: <20261113030639.3514-2-mark@wolfssl.com> From: "Shannon Sterz" X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1794931521843 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.577 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: TICXTLRSOJVHGMZCF7N3AGAN3BLPOMSW X-Message-ID-Hash: TICXTLRSOJVHGMZCF7N3AGAN3BLPOMSW X-MailFrom: s.sterz@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Fri Nov 13, 2026 at 4:06 AM CET, Mark Atwood wrote: > Verification only accepted tickets with an RSA signature made with > SHA-1, the default digest of Crypt::OpenSSL::RSA. Providers that > refuse SHA-1 signatures, such as FIPS ones, cannot create or check > such tickets. As a first step towards signing with SHA-256, accept > tickets signed with either SHA-256 or SHA-1, trying SHA-256 first. > > Accepting SHA-256 first lets nodes that verify tickets be upgraded > ahead of the ones that sign with SHA-256, so it needs to be rolled out > before any signing change. This also affects Proxmox Mail Gateway, > which uses PVE::Ticket for its tickets too. > > A mismatching signature makes the library return false. A provider > that refuses SHA-1 makes it die instead, for example wolfProvider > when signing: "RSA.xs:1007: OpenSSL error: (null)". Treat exactly that > kind of message as the signature not matching for SHA-1, and warn > about all other errors, so they do not go unnoticed. wolfProvider > still verifies SHA-1 signatures, so there SHA-1 tickets from nodes > that are not upgraded yet keep working. > > Verifying switches the digest of the public key object, which is state > that callers can see. Always reset it to the library default, SHA-1, > after verifying, regardless of which digest matched or whether an > error happened. This leaves the object as it was before and does not > leave a digest behind that depends on the last ticket seen. Documenting > the left-over state instead would have made every caller depend on it. > > The tests use tickets signed with the openssl command line, so they do > not rely on the signing code. They also cover that verification works > without the noerr parameter, and the handling of provider errors. > > Signed-off-by: Mark Atwood > --- > src/PVE/Ticket.pm | 35 +++++++++++++++++- > test/ticket_test.pl | 87 +++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 121 insertions(+), 1 deletion(-) > > diff --git a/src/PVE/Ticket.pm b/src/PVE/Ticket.pm > index 5bd06fc..f20ab5d 100644 > --- a/src/PVE/Ticket.pm > +++ b/src/PVE/Ticket.pm > @@ -71,6 +71,39 @@ sub assemble_rsa_ticket { > return $ticket; > } > > +# Checks the signature of a ticket, accepting SHA-256 and SHA-1 signatur= es. Returns true if one of > +# them matches. > +# > +# TODO: Remove SHA-1 fallback once SHA-256 signed tickets are the defaul= t across PMG and PVE for at > +# least one major release. > +# > +# Note: Always leaves $rsa_pub with the library default digest (SHA-1), = as it was before it got > +# used here, no matter which one matched. > +my sub verify_rsa_signature { > + my ($rsa_pub, $full, $sig) =3D @_; > + > + my $valid =3D 0; > + for my $hash ('sha256', 'sha1') { > + # A mismatch returns false. A provider that refuses to use SHA-1= makes the library die with > + # a message without any OpenSSL error text, e.g. "RSA.xs:1007: O= penSSL error: (null)". > + # That is the expected outcome for SHA-1 in FIPS mode and just m= eans no match. > + $valid =3D eval { > + $hash eq 'sha256' ? $rsa_pub->use_sha256_hash() : $rsa_pub->= use_sha1_hash(); > + $rsa_pub->verify($full, $sig); > + }; > + if (my $err =3D $@) { > + # anything else is unexpected and should not go unnoticed > + warn "unexpected error verifying $hash ticket signature - $e= rr" > + if $hash ne 'sha1' || $err !~ m/^RSA\.xs:\d+: OpenSSL er= ror: \(null\) at /; not sure whether this is ideal. the check seems fairly brittle to me. maybe it be better to warn about all errors? alternatively maybe wolfProvider could put a message on OpenSSL's error stack that we could check here, though that would still require wolfProvider (and potentially other providers) to never change that message, so im not sure if that's ideal either. also if i understand the commit message here correctly, verify will never output this error for wolfProvider as wolfProvider only errors out when signing? -->8 snip 8<--