public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup v2] fix #5233: don't require root for some tape operations
@ 2024-11-13 11:37 Dominik Csapak
  2024-11-14 14:17 ` [pbs-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Dominik Csapak @ 2024-11-13 11:37 UTC (permalink / raw)
  To: 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 <d.csapak@proxmox.com>
---
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<MediaStatus, Error> {
             },
         },
     },
+    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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pbs-devel] applied: [PATCH proxmox-backup v2] fix #5233: don't require root for some tape operations
  2024-11-13 11:37 [pbs-devel] [PATCH proxmox-backup v2] fix #5233: don't require root for some tape operations Dominik Csapak
@ 2024-11-14 14:17 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2024-11-14 14:17 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Dominik Csapak

Am 13.11.24 um 12:37 schrieb Dominik Csapak:
> 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 <d.csapak@proxmox.com>
> ---
> 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(-)
> 
>

applied, thanks!


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-11-14 14:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-13 11:37 [pbs-devel] [PATCH proxmox-backup v2] fix #5233: don't require root for some tape operations Dominik Csapak
2024-11-14 14:17 ` [pbs-devel] applied: " Thomas Lamprecht

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