public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: Christian Ebner <c.ebner@proxmox.com>,
	Proxmox Backup Server development discussion
	<pbs-devel@lists.proxmox.com>
Subject: Re: [pbs-devel] [PATCH v3 proxmox-backup 00/33] fix #3044: push datastore to remote target
Date: Fri, 11 Oct 2024 09:51:48 +0200 (CEST)	[thread overview]
Message-ID: <1903680466.3605.1728633108731@webmail.proxmox.com> (raw)
In-Reply-To: <50e2691b-29fb-479a-95c3-76786142c32a@proxmox.com>

> Christian Ebner <c.ebner@proxmox.com> hat am 11.10.2024 09:12 CEST geschrieben:  
> Thanks for tackling the review for this patches, let me look into your 
> comments and come back to you with further questions when they arise 
> during reworking of the series.

I'll try to get around to the missing parts today!

> I think the main confusion here stems from different interpretation on 
> what the `local_user` should be (as in which users permissions to 
> check). I try to clarify inline:
> 
> On 10/10/24 16:48, Fabian Grünbichler wrote:
> > left some comments on individual patches (those that I got around to
> > anyway, which is roughly up to patch #20), the permissions are still not
> > quite right, but since those changes are spread over a few patches, I'll
> > leave the comment for that here in one place (existing pull priv checks
> > should remain as they are, the following *only* applies to push based
> > syncing, except maybe the first bit):
> > 
> > UI/UX issues:
> > 
> > - I can create a sync job without having DatastoreAudit, but then I
> >    don't see it afterwards (this affects pull and push)
> 
> This is a bit strange, but will see to fix it for both.

I guess we either need to check for Audit as well when creating/.. a sync job, or we should drop the Audit requirement when listing.. maybe a user with just Datastore.Backup should at least see the sync jobs with themselves as owner/local_user (provided they have access to the remote, of course!)? they could after all do the same thing as non-sync pull invocation as well..

> > usage of helpers and logic in helpers:
> > 
> > - I can see other people's push jobs (where local_user/owner != auth_id)
> 
> Local user is the one who's permissions decide which source 
> snapshots/groups/namespaces are visible. I did not intend that to be 
> used to define permissions for the job itself. The intention was to use 
> the authenticated user for that exclusively.
> 
> > -- I can't modify them or create such jobs (unless I am highly privileged)
> 
> As you can set the sync job's local user (defining which sources can be 
> read) this has to be highly privileged.

yes, this part is okay I'd say (although it does not map 1:1 to the pull check, so it might make sense to distangle those).

if I can either read the whole datastore, or change arbitrary ownership, then I can also set local_user. I think currently only the second part is implemented (since for pull-based syncing, that makes sense for the question "am I allowed to set the owner to somebody else).
 
> > -- I can execute them (even if I am not highly privileged!)
> 
> So that a highly privileged user can create a job for you, but you are 
> only allowed to execute it.

but for pull based syncing, the checks are the same for modification and execution. I don't think it makes much sense to allow less-privileged users to execute sync jobs that they would not be able to set up (among other things - the sync job might not have a schedule and not be intended to be run at that point in time!).

> > the check_sync_job_remote_datastore_backup_access helper is wrong (it
> > doesn't account for auth_id vs local_user/owner at all). also, it is not
> > called when modifying a sync job or creating one, just when executing it
> > manually, which is probably also wrong. it also has a logic bug (missing
> > "not" when preparing the remote ACL path).
> 
> Okay, I need to look closer at this again, but I guess there is once 
> again a difference in interpretation of what the local user is/should 
> be. So that needs clarification first.

see above :) IMHO, modifying a sync job and running it should use the same helpers/checks. the latter should disallow running a sync job with a different local_user, unless the the authenticated user can either read all groups anyway, or  change their ownership in arbitrary fashion, in which case the user could do that and run the equivalent sync job as themselves anyway.

> > privileges:
> > 
> > - for pull-syncing, creating/removing namespaces needs PRIV_DATASTORE_MODIFY
> > - for push-syncing, creating namespaces needs PRIV_REMOTE_DATASTORE_MODIFY
> > - for push-syncing, removing namespaces needs PRIV_REMOTE_DATASTORE_PRUNE(!)
> > - manual push requires PRIV_REMOTE_DATASTORE_MODIFY (instead of
> >    PRIV_REMOTE_DATASTORE_BACKUP)
> 
> Okay, will double check and adapt.
> 
>
> > related code style nit:
> > 
> > since job_user is required for pushing (in
> > `check_ns_remote_datastore_privs`), it might make sense to not allow
> > creation of PushParameters without it set, e.g. by changing the TryFrom
> > impl to convert from (SyncJobConfig, AuthId) instead of just the
> > config.. or by using a custom helper.
> > 
> 
> OK, have a look at this as well.
> 
> Thanks!


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

      reply	other threads:[~2024-10-11  7:51 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-12 14:32 Christian Ebner
2024-09-12 14:32 ` [pbs-devel] [PATCH v3 proxmox-backup 01/33] api: datastore: add missing whitespace in description Christian Ebner
2024-09-12 14:32 ` [pbs-devel] [PATCH v3 proxmox-backup 02/33] server: sync: move sync related stats to common module Christian Ebner
2024-09-12 14:32 ` [pbs-devel] [PATCH v3 proxmox-backup 03/33] server: sync: move reader trait to common sync module Christian Ebner
2024-09-12 14:32 ` [pbs-devel] [PATCH v3 proxmox-backup 04/33] server: sync: move source " Christian Ebner
2024-09-12 14:32 ` [pbs-devel] [PATCH v3 proxmox-backup 05/33] client: backup writer: bundle upload stats counters Christian Ebner
2024-10-10 14:49   ` Fabian Grünbichler
2024-09-12 14:32 ` [pbs-devel] [PATCH v3 proxmox-backup 06/33] client: backup writer: factor out merged chunk stream upload Christian Ebner
2024-09-12 14:32 ` [pbs-devel] [PATCH v3 proxmox-backup 07/33] client: backup writer: add chunk count and duration stats Christian Ebner
2024-09-12 14:32 ` [pbs-devel] [PATCH v3 proxmox-backup 08/33] client: backup writer: allow push uploading index and chunks Christian Ebner
2024-09-12 14:32 ` [pbs-devel] [PATCH v3 proxmox-backup 09/33] server: sync: move skip info/reason to common sync module Christian Ebner
2024-09-12 14:32 ` [pbs-devel] [PATCH v3 proxmox-backup 10/33] server: sync: make skip reason message more genenric Christian Ebner
2024-09-12 14:33 ` [pbs-devel] [PATCH v3 proxmox-backup 11/33] server: sync: factor out namespace depth check into sync module Christian Ebner
2024-09-12 14:33 ` [pbs-devel] [PATCH v3 proxmox-backup 12/33] config: acl: mention optional namespace acl path component Christian Ebner
2024-09-12 14:33 ` [pbs-devel] [PATCH v3 proxmox-backup 13/33] config: acl: allow namespace components for remote datastores Christian Ebner
2024-10-10 14:49   ` Fabian Grünbichler
2024-09-12 14:33 ` [pbs-devel] [PATCH v3 proxmox-backup 14/33] api types: define remote permissions and roles for push sync Christian Ebner
2024-09-12 14:33 ` [pbs-devel] [PATCH v3 proxmox-backup 15/33] fix #3044: server: implement push support for sync operations Christian Ebner
2024-10-10 14:48   ` Fabian Grünbichler
2024-09-12 14:33 ` [pbs-devel] [PATCH v3 proxmox-backup 16/33] config: jobs: add `sync-push` config type for push sync jobs Christian Ebner
2024-10-10 14:48   ` Fabian Grünbichler
2024-09-12 14:33 ` [pbs-devel] [PATCH v3 proxmox-backup 17/33] api: push: implement endpoint for sync in push direction Christian Ebner
2024-09-12 14:33 ` [pbs-devel] [PATCH v3 proxmox-backup 18/33] api: sync: move sync job invocation to server sync module Christian Ebner
2024-09-12 14:33 ` [pbs-devel] [PATCH v3 proxmox-backup 19/33] api: sync jobs: expose optional `sync-direction` parameter Christian Ebner
2024-10-10 14:48   ` Fabian Grünbichler
2024-09-12 14:33 ` [pbs-devel] [PATCH v3 proxmox-backup 20/33] api: sync: add permission checks for push sync jobs Christian Ebner
2024-09-12 14:33 ` [pbs-devel] [PATCH v3 proxmox-backup 21/33] bin: manager: add datastore push cli command Christian Ebner
2024-09-12 14:33 ` [pbs-devel] [PATCH v3 proxmox-backup 22/33] ui: group filter: allow to set namespace for local datastore Christian Ebner
2024-09-12 14:33 ` [pbs-devel] [PATCH v3 proxmox-backup 23/33] ui: sync edit: source group filters based on sync direction Christian Ebner
2024-09-12 14:33 ` [pbs-devel] [PATCH v3 proxmox-backup 24/33] ui: add view with separate grids for pull and push sync jobs Christian Ebner
2024-09-12 14:33 ` [pbs-devel] [PATCH v3 proxmox-backup 25/33] ui: sync job: adapt edit window to be used for pull and push Christian Ebner
2024-09-12 14:33 ` [pbs-devel] [PATCH v3 proxmox-backup 26/33] ui: sync: pass sync-direction to allow removing push jobs Christian Ebner
2024-09-12 14:33 ` [pbs-devel] [PATCH v3 proxmox-backup 27/33] ui: sync view: do not use data model proxy for store Christian Ebner
2024-09-12 14:33 ` [pbs-devel] [PATCH v3 proxmox-backup 28/33] ui: sync view: set sync direction when invoking run task via api Christian Ebner
2024-09-12 14:33 ` [pbs-devel] [PATCH v3 proxmox-backup 29/33] datastore: move `BackupGroupDeleteStats` to api types Christian Ebner
2024-09-12 14:33 ` [pbs-devel] [PATCH v3 proxmox-backup 30/33] api types: implement api type for `BackupGroupDeleteStats` Christian Ebner
2024-09-12 14:33 ` [pbs-devel] [PATCH v3 proxmox-backup 31/33] datastore: increment deleted group counter when removing group Christian Ebner
2024-09-12 14:33 ` [pbs-devel] [PATCH v3 proxmox-backup 32/33] api: datastore/namespace: return backup groups delete stats on remove Christian Ebner
2024-10-11  9:32   ` Fabian Grünbichler
2024-09-12 14:33 ` [pbs-devel] [PATCH v3 proxmox-backup 33/33] server: sync job: use delete stats provided by the api Christian Ebner
2024-10-11  9:32   ` Fabian Grünbichler
2024-10-10 14:48 ` [pbs-devel] [PATCH v3 proxmox-backup 00/33] fix #3044: push datastore to remote target Fabian Grünbichler
2024-10-11  7:12   ` Christian Ebner
2024-10-11  7:51     ` Fabian Grünbichler [this message]

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=1903680466.3605.1728633108731@webmail.proxmox.com \
    --to=f.gruenbichler@proxmox.com \
    --cc=c.ebner@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