all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: "Shannon Sterz" <s.sterz@proxmox.com>
To: "Mark Atwood" <mark@wolfssl.com>, <pve-devel@lists.proxmox.com>
Subject: Re: [PATCH common v2 1/2] ticket: accept RSA tickets signed with SHA-256
Date: Tue, 17 Nov 2026 17:05:21 +0100	[thread overview]
Message-ID: <DMXM4DMQ13J4.RHTCWOP25CBO@proxmox.com> (raw)
In-Reply-To: <20261113030639.3514-2-mark@wolfssl.com>

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 <mark@wolfssl.com>
> ---
>  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 signatures. Returns true if one of
> +# them matches.
> +#
> +# TODO: Remove SHA-1 fallback once SHA-256 signed tickets are the default 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) = @_;
> +
> +    my $valid = 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: OpenSSL error: (null)".
> +        # That is the expected outcome for SHA-1 in FIPS mode and just means no match.
> +        $valid = eval {
> +            $hash eq 'sha256' ? $rsa_pub->use_sha256_hash() : $rsa_pub->use_sha1_hash();
> +            $rsa_pub->verify($full, $sig);
> +        };
> +        if (my $err = $@) {
> +            # anything else is unexpected and should not go unnoticed
> +            warn "unexpected error verifying $hash ticket signature - $err"
> +                if $hash ne 'sha1' || $err !~ m/^RSA\.xs:\d+: OpenSSL error: \(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<--




  reply	other threads:[~2026-11-17 16:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13  3:06 [PATCH common v2 0/2] ticket: sign RSA tickets with SHA-256, opt-in Mark Atwood
2026-11-13  3:06 ` [PATCH common v2 1/2] ticket: accept RSA tickets signed with SHA-256 Mark Atwood
2026-11-17 16:05   ` Shannon Sterz [this message]
2026-11-13  3:06 ` [PATCH common v2 2/2] ticket: allow signing RSA tickets " Mark Atwood
2026-11-17 16:05   ` Shannon Sterz

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=DMXM4DMQ13J4.RHTCWOP25CBO@proxmox.com \
    --to=s.sterz@proxmox.com \
    --cc=mark@wolfssl.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal