public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Nicolas Frey <n.frey@proxmox.com>
Subject: Re: [pve-devel] [PATCH proxmox v5 1/4] add proxmox-pgp subcrate, move POM verifier code to it
Date: Wed, 29 Oct 2025 20:39:29 +0100	[thread overview]
Message-ID: <b6f4d0d9-aa5c-4078-a067-d03c033c5332@proxmox.com> (raw)
In-Reply-To: <20251023103953.305810-2-n.frey@proxmox.com>

Am 23.10.25 um 12:40 schrieb Nicolas Frey:> Add new micro-crate `proxmox-pgp` for use in `proxmox-apt` to verify
> repository signatures. Code is derived from `proxmox-offline-mirror`.
> If this patch is applied, then `proxmox-offline-mirror` should use
> the `proxmox-pgp` crate.
> 
> For the original development history, see commits related to [0].
> 
> [0] https://git.proxmox.com/?p=proxmox-offline-mirror.git;a=blob;f=src/helpers/verifier.rs;h=15195a6ec3413ad3c016fffc38f9eee3cefc6827;hb=cd56fab
> 
> Suggested-by: Thomas Lamprecht <t.lamprech@proxmox.com>
> Signed-off-by: Nicolas Frey <n.frey@proxmox.com>
> ---
>  Cargo.toml                       |   2 +
>  proxmox-pgp/Cargo.toml           |  17 +++
>  proxmox-pgp/debian/changelog     |   5 +
>  proxmox-pgp/debian/control       |  40 +++++++
>  proxmox-pgp/debian/copyright     |  18 +++
>  proxmox-pgp/debian/debcargo.toml |   7 ++
>  proxmox-pgp/src/lib.rs           |   5 +
>  proxmox-pgp/src/verifier.rs      | 200 +++++++++++++++++++++++++++++++
>  8 files changed, 294 insertions(+)
>  create mode 100644 proxmox-pgp/Cargo.toml
>  create mode 100644 proxmox-pgp/debian/changelog
>  create mode 100644 proxmox-pgp/debian/control
>  create mode 100644 proxmox-pgp/debian/copyright
>  create mode 100644 proxmox-pgp/debian/debcargo.toml
>  create mode 100644 proxmox-pgp/src/lib.rs
>  create mode 100644 proxmox-pgp/src/verifier.rs

> diff --git a/proxmox-pgp/src/verifier.rs b/proxmox-pgp/src/verifier.rs
> new file mode 100644
> index 00000000..84a15c4c
> --- /dev/null
> +++ b/proxmox-pgp/src/verifier.rs
> @@ -0,0 +1,200 @@
> +use anyhow::{bail, format_err, Error};
> +
> +use proxmox_api_macro::api;
> +use proxmox_schema::Updater;
> +use sequoia_openpgp::{
> +    cert::CertParser,
> +    parse::{
> +        stream::{
> +            DetachedVerifierBuilder, MessageLayer, MessageStructure, VerificationError,
> +            VerificationHelper, VerifierBuilder,
> +        },
> +        PacketParser, PacketParserResult, Parse,
> +    },
> +    policy::StandardPolicy,
> +    types::HashAlgorithm,
> +    Cert, KeyHandle,
> +};
> +use serde::{Deserialize, Serialize};
> +use std::io;

I cleaned up the import code style a bit in POM yesterday, could you please sync that here
if you send a v6 to address Shannon's comment anyway?

> +
> +#[api(
> +    properties: {
> +        "allow-sha1": {
> +            type: bool,
> +            default: false,
> +            optional: true,
> +        },
> +        "min-dsa-key-size": {
> +            type: u64,
> +            optional: true,
> +        },
> +        "min-rsa-key-size": {
> +            type: u64,
> +            optional: true,
> +        },
> +    },
> +)]
> +#[derive(Default, Serialize, Deserialize, Updater, Clone, Debug)]
> +#[serde(rename_all = "kebab-case")]
> +/// Weak Cryptography Configuration
> +pub struct WeakCryptoConfig {
> +    /// Whether to allow SHA-1 based signatures
> +    #[serde(default)]
> +    pub allow_sha1: bool,
> +    /// Whether to lower the key size cutoff for DSA-based signatures
> +    #[serde(default)]
> +    pub min_dsa_key_size: Option<u64>,
> +    /// Whether to lower the key size cutoff for RSA-based signatures
> +    #[serde(default)]
> +    pub min_rsa_key_size: Option<u64>,
> +}
> +
> +struct Helper<'a> {

tiny nit: I know you just copied from the original, but the name is rather a bit to
generic.
As it's not publicly exported it's not to bad, but such things often leak in other
parts of the code nonetheless, so maybe use CertWrapper (just as an idea, feel free
to chose a more fitting/telling name yourself).

> +    cert: &'a Cert,
> +}
> +
> 


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


  parent reply	other threads:[~2025-10-29 19:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-23 10:39 [pve-devel] [PATCH proxmox v5 0/4] fix #5207: apt: check signage of repos with proxmox-pgp Nicolas Frey
2025-10-23 10:39 ` [pve-devel] [PATCH proxmox v5 1/4] add proxmox-pgp subcrate, move POM verifier code to it Nicolas Frey
2025-10-29 10:54   ` Shannon Sterz
2025-10-29 13:44     ` Nicolas Frey
2025-10-29 19:39   ` Thomas Lamprecht [this message]
2025-10-23 10:39 ` [pve-devel] [PATCH proxmox v5 2/4] fix #5207: apt: check signage of repos with proxmox-pgp Nicolas Frey
2025-10-23 14:24   ` Nicolas Frey
2025-10-29 10:55   ` Shannon Sterz
2025-10-29 13:44     ` Nicolas Frey
2025-10-23 10:39 ` [pve-devel] [PATCH proxmox v5 3/4] apt: add tests for POM release filenames Nicolas Frey
2025-10-23 10:39 ` [pve-devel] [PATCH proxmox v5 4/4] apt: check for local POM InRelease as fallback Nicolas Frey
2025-10-29 10:55   ` Shannon Sterz
2025-10-29 13:44     ` Nicolas Frey
2025-10-30 13:30 ` [pve-devel] [PATCH proxmox v5 0/4] fix #5207: apt: check signage of repos with proxmox-pgp Nicolas Frey

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=b6f4d0d9-aa5c-4078-a067-d03c033c5332@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=n.frey@proxmox.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 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