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 93D521FF13E for ; Wed, 01 Jul 2026 16:05:29 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 63CEF2141D; Wed, 01 Jul 2026 16:05:29 +0200 (CEST) From: Christian Ebner To: pbs-devel@lists.proxmox.com Subject: [PATCH proxmox-backup v3 11/15] api: subscription: use proxmox-product-config create options Date: Wed, 1 Jul 2026 16:04:08 +0200 Message-ID: <20260701140412.200920-12-c.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260701140412.200920-1-c.ebner@proxmox.com> References: <20260701140412.200920-1-c.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1782914662389 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.039 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) 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: 326KWNW7HS64DKXBMAXYZVYBBP7E4Y3X X-Message-ID-Hash: 326KWNW7HS64DKXBMAXYZVYBBP7E4Y3X X-MailFrom: c.ebner@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 Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Instead of re-defining them, use the create options helper for secret files as defined in proxmox-product-config crate. Signed-off-by: Christian Ebner --- src/api2/node/subscription.rs | 11 +---------- src/bin/proxmox_backup_manager/subscription.rs | 4 ++-- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/api2/node/subscription.rs b/src/api2/node/subscription.rs index 033a6e4c0..639a1d1dd 100644 --- a/src/api2/node/subscription.rs +++ b/src/api2/node/subscription.rs @@ -22,15 +22,6 @@ const PRODUCT_URL: &str = "https://www.proxmox.com/en/proxmox-backup-server/pric const APT_AUTH_FN: &str = "/etc/apt/auth.conf.d/pbs.conf"; const APT_AUTH_URL: &str = "enterprise.proxmox.com/debian/pbs"; -pub fn subscription_file_opts() -> Result { - let backup_user = pbs_config::backup_user()?; - let mode = nix::sys::stat::Mode::from_bits_truncate(0o0640); - Ok(CreateOptions::new() - .perm(mode) - .owner(nix::unistd::ROOT) - .group(backup_user.gid)) -} - fn apt_auth_file_opts() -> CreateOptions { let mode = nix::sys::stat::Mode::from_bits_truncate(0o0600); CreateOptions::new().perm(mode).owner(nix::unistd::ROOT) @@ -58,7 +49,7 @@ fn check_and_write_subscription(key: String, server_id: String) -> Result<(), Er proxmox_subscription::files::write_subscription( PROXMOX_BACKUP_SUBSCRIPTION_FN, - subscription_file_opts()?, + proxmox_product_config::privileged_create_options(), &info, ) .map_err(|e| format_err!("Error writing updated subscription status - {}", e))?; diff --git a/src/bin/proxmox_backup_manager/subscription.rs b/src/bin/proxmox_backup_manager/subscription.rs index f04949bf3..dffc39066 100644 --- a/src/bin/proxmox_backup_manager/subscription.rs +++ b/src/bin/proxmox_backup_manager/subscription.rs @@ -5,7 +5,7 @@ use proxmox_router::{ApiHandler, RpcEnvironment, cli::*}; use proxmox_schema::api; use proxmox_subscription::{ProductType, SubscriptionInfo}; -use proxmox_backup::api2::{self, node::subscription::subscription_file_opts}; +use proxmox_backup::api2; use pbs_buildcfg::PROXMOX_BACKUP_SUBSCRIPTION_FN; @@ -62,7 +62,7 @@ pub fn set_offline_subscription_key(data: String) -> Result<(), Error> { info.check_server_id(); proxmox_subscription::files::write_subscription( PROXMOX_BACKUP_SUBSCRIPTION_FN, - subscription_file_opts()?, + proxmox_product_config::privileged_create_options(), &info, )?; Ok(()) -- 2.47.3