From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id CB72F20EC91 for ; Tue, 30 Apr 2024 17:37:21 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 231ABA13; Tue, 30 Apr 2024 17:37:31 +0200 (CEST) From: Christian Ebner To: pbs-devel@lists.proxmox.com Date: Tue, 30 Apr 2024 17:37:14 +0200 Message-Id: <20240430153714.390159-1-c.ebner@proxmox.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.029 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [proxmox.com, create.rs] Subject: [pbs-devel] [PATCH proxmox-backup] fix 5304: client: set process uid/gid for .pxarexclude-cli X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" The .pxarexclude-cli encodes the exclude patterns the client was invoked with in the pxar archive as regular file entry. The current behaviour of setting the uid and gid to default 0 (root) causes however issues when trying to backup and restore the backup as non-root user. Opt for using the uid/gid of the user the executable was called as, allowing the restore for this user to succeed. Root will succeed to restore anyways. Link to issue in bugtracker: https://bugzilla.proxmox.com/show_bug.cgi?id=5304 Signed-off-by: Christian Ebner --- pbs-client/src/pxar/create.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pbs-client/src/pxar/create.rs b/pbs-client/src/pxar/create.rs index 60efb0ce5..a5afde7af 100644 --- a/pbs-client/src/pxar/create.rs +++ b/pbs-client/src/pxar/create.rs @@ -404,6 +404,10 @@ impl Archiver { let mut metadata = Metadata::default(); metadata.stat.mode = pxar::format::mode::IFREG | 0o600; + // use uid/gid of client process so the backup snapshot might be restored by the same + // potentially non-root user + metadata.stat.uid = unsafe { libc::getuid() }; + metadata.stat.gid = unsafe { libc::getgid() }; let mut file = encoder .create_file(&metadata, ".pxarexclude-cli", content.len() as u64) -- 2.39.2 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel