From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id BF5481FF15C for ; Wed, 13 Nov 2024 12:38:14 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 388AE14411; Wed, 13 Nov 2024 12:38:16 +0100 (CET) From: Dominik Csapak To: pbs-devel@lists.proxmox.com Date: Wed, 13 Nov 2024 12:37:42 +0100 Message-Id: <20241113113742.2278769-1-d.csapak@proxmox.com> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.016 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 Subject: [pbs-devel] [PATCH proxmox-backup v2] fix #5233: don't require root for some tape operations 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" instead, require 'Tape.Write' or 'Tape.Modify' on '/tape' path. This makes it possible for a TapeOperator to destroy tapes and for a TapeAdmin to update the tape status, instead of just root@pam. I opted for the path '/tape' since we don't have a dedicated acl structure for single tapes, just '/tape/pool' (which does not apply since not all tapes have to have a pool), '/tape/device' (which is intended for drives/changers) and '/tape/jobs' (which is for jobs only). Also we use that path for e.g. move_tape already. Signed-off-by: Dominik Csapak --- changes from v1: * rebase on master * change permission required for update status to TAPE_MODIFY src/api2/tape/media.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/api2/tape/media.rs b/src/api2/tape/media.rs index 2ed3e961..9d22ca1a 100644 --- a/src/api2/tape/media.rs +++ b/src/api2/tape/media.rs @@ -9,7 +9,7 @@ use proxmox_uuid::Uuid; use pbs_api_types::{ Authid, MediaContentEntry, MediaContentListFilter, MediaListEntry, MediaPoolConfig, MediaSetListEntry, MediaStatus, CHANGER_NAME_SCHEMA, MEDIA_LABEL_SCHEMA, - MEDIA_POOL_NAME_SCHEMA, MEDIA_UUID_SCHEMA, PRIV_TAPE_AUDIT, PRIV_TAPE_MODIFY, + MEDIA_POOL_NAME_SCHEMA, MEDIA_UUID_SCHEMA, PRIV_TAPE_AUDIT, PRIV_TAPE_MODIFY, PRIV_TAPE_WRITE, VAULT_NAME_SCHEMA, }; use pbs_config::CachedUserInfo; @@ -366,6 +366,9 @@ pub fn move_tape( }, }, }, + access: { + permission: &Permission::Privilege(&["tape"], PRIV_TAPE_WRITE, false), + }, )] /// Destroy media (completely remove from database) pub fn destroy_media( @@ -557,6 +560,9 @@ pub fn get_media_status(uuid: Uuid) -> Result { }, }, }, + access: { + permission: &Permission::Privilege(&["tape"], PRIV_TAPE_MODIFY, false), + }, )] /// Update media status (None, 'full', 'damaged' or 'retired') /// -- 2.39.5 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel