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 AF12E1FF13E for ; Wed, 01 Jul 2026 16:05:07 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 24AA921463; Wed, 01 Jul 2026 16:05:02 +0200 (CEST) From: Christian Ebner To: pbs-devel@lists.proxmox.com Subject: [PATCH proxmox-backup v3 08/15] pbs-datastore: use proxmox-product-config cached backup user Date: Wed, 1 Jul 2026 16:04:05 +0200 Message-ID: <20260701140412.200920-9-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: 1782914661627 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.053 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: XZF5TKMYU2NGTT7KCPHML2JVYZD62QUH X-Message-ID-Hash: XZF5TKMYU2NGTT7KCPHML2JVYZD62QUH 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 looking it up, use the globally cached backup user info provided by proxmox-product-config. The user is not allowed to change change anyways during the runtime of the process, as otherwise all sorts of permission issues can arise. Signed-off-by: Christian Ebner --- pbs-datastore/src/datastore.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs index e2d1ae67c..06adbece5 100644 --- a/pbs-datastore/src/datastore.rs +++ b/pbs-datastore/src/datastore.rs @@ -488,14 +488,15 @@ impl DataStore { let (config, _config_digest) = pbs_config::s3::config()?; let config: S3ClientConf = config.lookup(S3_CFG_TYPE_ID, s3_client_id)?; + let backup_user = proxmox_product_config::get_api_user(); let rate_limiter_options = S3RateLimiterOptions { id: s3_client_id.to_string(), - user: pbs_config::backup_user()?, + user: backup_user.clone(), base_path: S3_CLIENT_RATE_LIMITER_BASE_PATH.into(), }; let request_counter_config = S3RequestCounterConfig { id: format!("{s3_client_id}-{bucket}-{}", self.name()), - user: pbs_config::backup_user()?, + user: backup_user.clone(), base_path: S3_CLIENT_REQUEST_COUNTER_BASE_PATH.into(), }; @@ -819,8 +820,9 @@ impl DataStore { .ok_or(format_err!("missing s3 bucket"))?, config.name, ); + let backup_user = proxmox_product_config::get_api_user(); let request_counters = - SharedRequestCounters::open_shared_memory_mapped(path, pbs_config::backup_user()?)?; + SharedRequestCounters::open_shared_memory_mapped(path, backup_user.clone())?; Ok(request_counters) } @@ -2653,7 +2655,7 @@ impl DataStore { let mut path = self.base_path(); path.push(".gc-status"); - let backup_user = pbs_config::backup_user()?; + let backup_user = proxmox_product_config::get_api_user(); let mode = nix::sys::stat::Mode::from_bits_truncate(0o0644); // set the correct owner/group/permissions while saving file // owner(rw) = backup, group(r)= backup @@ -3183,7 +3185,7 @@ impl DataStore { // Fetch the contents (metadata, no chunks) of the datastore from the S3 object store to the // provided temporaray directory async fn fetch_tmp_contents(&self, tmp_base: &Path, s3_client: &S3Client) -> Result<(), Error> { - let backup_user = pbs_config::backup_user().context("failed to get backup user")?; + let backup_user = proxmox_product_config::get_api_user(); let mode = nix::sys::stat::Mode::from_bits_truncate(0o0644); let file_create_options = CreateOptions::new() .perm(mode) @@ -3336,14 +3338,15 @@ impl DataStore { let client_config: S3ClientConf = config .lookup(S3_CFG_TYPE_ID, s3_client_id) .with_context(|| format!("no '{s3_client_id}' in config"))?; + let backup_user = proxmox_product_config::get_api_user(); let rate_limiter_options = S3RateLimiterOptions { id: s3_client_id.to_string(), - user: pbs_config::backup_user()?, + user: backup_user.clone(), base_path: S3_CLIENT_RATE_LIMITER_BASE_PATH.into(), }; let request_counter_config = S3RequestCounterConfig { id: format!("{s3_client_id}-{bucket}-{}", datastore_config.name), - user: pbs_config::backup_user()?, + user: backup_user.clone(), base_path: S3_CLIENT_REQUEST_COUNTER_BASE_PATH.into(), }; -- 2.47.3