public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: Proxmox Backup Server development discussion
	<pbs-devel@lists.proxmox.com>
Subject: [pbs-devel] applied: [PATCH proxmox-backup 6/6] manager: check if offline subscription is for the correct product
Date: Mon, 27 Nov 2023 14:14:28 +0100	[thread overview]
Message-ID: <1701090687.cf63ay42h2.astroid@yuna.none> (raw)
In-Reply-To: <20231109153403.529870-7-s.sterz@proxmox.com>

with the bumped proxmox-subscription dependency folded in

On November 9, 2023 4:34 pm, Stefan Sterz wrote:
> previously when an offline key was set it wasn't verified that the
> subscription was for the correct product. while pom only applies
> subscriptions for the corresponding products, a user could manually
> invoke the `subscription set-offline-key` command to circumvent that.
> 
> Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
> ---
>  src/bin/proxmox_backup_manager/subscription.rs | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/src/bin/proxmox_backup_manager/subscription.rs b/src/bin/proxmox_backup_manager/subscription.rs
> index 66161af7..12f09ecf 100644
> --- a/src/bin/proxmox_backup_manager/subscription.rs
> +++ b/src/bin/proxmox_backup_manager/subscription.rs
> @@ -3,7 +3,7 @@ use serde_json::Value;
> 
>  use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
>  use proxmox_schema::api;
> -use proxmox_subscription::SubscriptionInfo;
> +use proxmox_subscription::{ProductType, SubscriptionInfo};
> 
>  use proxmox_backup::api2::{self, node::subscription::subscription_file_opts};
> 
> @@ -51,6 +51,12 @@ pub fn set_offline_subscription_key(data: String) -> Result<(), Error> {
>      if !info.is_signed() {
>          bail!("Offline subscription key must be signed!");
>      }
> +
> +    let product_type = info.get_product_type()?;
> +    if product_type != ProductType::Pbs {
> +        bail!("Subscription is not a PBS subscription ({product_type})!");
> +    }
> +
>      info.check_signature(&[proxmox_subscription::files::DEFAULT_SIGNING_KEY]);
>      info.check_age(false);
>      info.check_server_id();
> --
> 2.39.2
> 
> 
> 
> _______________________________________________
> pbs-devel mailing list
> pbs-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
> 
> 
> 




      reply	other threads:[~2023-11-27 13:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-09 15:33 [pbs-devel] [PATCH offline-mirror/proxmox/backup-server 0/6] improve pom multi-key handling and pbs key check Stefan Sterz
2023-11-09 15:33 ` [pbs-devel] [PATCH proxmox 1/6] type: move `ProductType` type to `proxmox-subscription` from pom Stefan Sterz
2023-11-27 13:12   ` [pbs-devel] applied: " Fabian Grünbichler
2023-11-09 15:33 ` [pbs-devel] [PATCH proxmox 2/6] subscription: expose the `next_due_date` as an `i64` Stefan Sterz
2023-11-27 13:12   ` [pbs-devel] applied: " Fabian Grünbichler
2023-11-09 15:34 ` [pbs-devel] [PATCH proxmox-offline-mirror 3/6] type: move `ProductType` enum to `proxmox-subscription` Stefan Sterz
2023-11-09 15:34 ` [pbs-devel] [PATCH proxmox-offline-mirror 4/6] helper: improve handling of multiple keys when activating them Stefan Sterz
2023-11-27 13:10   ` Fabian Grünbichler
2023-11-09 15:34 ` [pbs-devel] [PATCH proxmox-offline-mirror 5/6] offline mirror binary: rustfmt clean up Stefan Sterz
2023-11-09 15:34 ` [pbs-devel] [PATCH proxmox-backup 6/6] manager: check if offline subscription is for the correct product Stefan Sterz
2023-11-27 13:14   ` Fabian Grünbichler [this message]

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=1701090687.cf63ay42h2.astroid@yuna.none \
    --to=f.gruenbichler@proxmox.com \
    --cc=pbs-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