public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup] fix #5233: don't require root for some tape operations
Date: Tue, 10 Sep 2024 09:08:18 +0200	[thread overview]
Message-ID: <20240910070818.268267-1-d.csapak@proxmox.com> (raw)

instead, require 'Tape.Write' on '/tape' path.
This makes it possible for a TapeAdmin or TapeOperator to
format/remove/vault tapes, 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).

Alternatively we could invent a new scheme for tape media, e.g.
'/tape/media' for this.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/api2/tape/media.rs | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/api2/tape/media.rs b/src/api2/tape/media.rs
index a7c8483a..a480ae17 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, VAULT_NAME_SCHEMA,
+    MEDIA_POOL_NAME_SCHEMA, MEDIA_UUID_SCHEMA, PRIV_TAPE_AUDIT, PRIV_TAPE_WRITE, VAULT_NAME_SCHEMA,
 };
 use pbs_config::CachedUserInfo;
 
@@ -305,6 +305,9 @@ pub async fn list_media(
             },
         },
     },
+    access: {
+        permission: &Permission::Privilege(&["tape"], PRIV_TAPE_WRITE, false),
+    },
 )]
 /// Change Tape location to vault (if given), or offline.
 pub fn move_tape(
@@ -362,6 +365,9 @@ pub fn move_tape(
             },
         },
     },
+    access: {
+        permission: &Permission::Privilege(&["tape"], PRIV_TAPE_WRITE, false),
+    },
 )]
 /// Destroy media (completely remove from database)
 pub fn destroy_media(
@@ -553,6 +559,9 @@ pub fn get_media_status(uuid: Uuid) -> Result<MediaStatus, Error> {
             },
         },
     },
+    access: {
+        permission: &Permission::Privilege(&["tape"], PRIV_TAPE_WRITE, false),
+    },
 )]
 /// Update media status (None, 'full', 'damaged' or 'retired')
 ///
-- 
2.39.2



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


                 reply	other threads:[~2024-09-10  7:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240910070818.268267-1-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal