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 82B1C1FF130 for ; Mon, 20 Jul 2026 16:13:57 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 46976214AB; Mon, 20 Jul 2026 16:13:57 +0200 (CEST) Message-ID: <73210cac-6083-4eb5-80f1-49b1770f15cf@proxmox.com> Date: Mon, 20 Jul 2026 16:13:23 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH proxmox-backup v3 04/15] pbs-config: use proxmox-product-config::replace_config() To: Robert Obkircher , pbs-devel@lists.proxmox.com References: <20260701140412.200920-1-c.ebner@proxmox.com> <20260701140412.200920-5-c.ebner@proxmox.com> <0a702b2c-de13-433a-ae33-1ca51e172e82@proxmox.com> Content-Language: en-US, de-DE From: Christian Ebner In-Reply-To: <0a702b2c-de13-433a-ae33-1ca51e172e82@proxmox.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1784556779240 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.389 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) RCVD_IN_DNSWL_LOW -0.7 Sender listed at https://www.dnswl.org/, low trust 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: 7FJ63XDBAB4JGABD3UXXK4CEUCIRHZEJ X-Message-ID-Hash: 7FJ63XDBAB4JGABD3UXXK4CEUCIRHZEJ 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: On 7/6/26 2:28 PM, Robert Obkircher wrote: > > On 01.07.26 16:05, Christian Ebner wrote: >> Instead of using the pbs-config local implementation, use the product >> general implementation, dropping the local one instead. >> >> Since proxmox-product-config::replace_config() requires the api- and >> priv-user to be initialized a-priori, any calling codepath must >> guarantee to have run proxmox-product-config::init() once. >> >> [..] >> >> -/// Atomically write data to file owned by "root:backup" with permission "0640" >> -/// >> -/// Only the superuser can write those files, but group 'backup' can read them. >> -pub fn replace_backup_config>(path: P, data: &[u8]) -> Result<(), Error> { >> - let backup_user = backup_user()?; >> - let mode = nix::sys::stat::Mode::from_bits_truncate(0o0640); >> - // set the correct owner/group/permissions while saving file >> - // owner(rw) = root, group(r)= backup >> - let options = proxmox_sys::fs::CreateOptions::new() >> - .perm(mode) >> - .owner(nix::unistd::ROOT) >> - .group(backup_user.gid); >> - >> - proxmox_sys::fs::replace_file(path, data, options, true)?; >> - >> - Ok(()) >> -} >> >> [..] >> >> pub fn save_config(config: &SectionConfigData) -> Result<(), Error> { >> let raw = CONFIG.write(METRIC_SERVER_CFG_FILENAME, config)?; >> - crate::replace_backup_config(METRIC_SERVER_CFG_FILENAME, raw.as_bytes()) >> + replace_config(METRIC_SERVER_CFG_FILENAME, raw.as_bytes()) >> } >> >> [..] > This changes the permissions from root:backup to backup:backup! > > I think the correct function would be > proxmox_product_config::replace_privileged_config. > > (Applies to all changes in this patch) Good catch! Will be fixed in v4!