From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id AD88A66407 for ; Fri, 6 Nov 2020 08:12:13 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A5CEC1E52F for ; Fri, 6 Nov 2020 08:11:43 +0100 (CET) Received: from elsa.proxmox.com (212-186-127-178.static.upcbusiness.at [212.186.127.178]) by firstgate.proxmox.com (Proxmox) with ESMTP id 7E4711E49B for ; Fri, 6 Nov 2020 08:11:39 +0100 (CET) Received: by elsa.proxmox.com (Postfix, from userid 0) id 606C3AE9952; Fri, 6 Nov 2020 08:11:39 +0100 (CET) From: Dietmar Maurer To: pbs-devel@lists.proxmox.com Date: Fri, 6 Nov 2020 08:11:35 +0100 Message-Id: <20201106071138.23547-1-dietmar@proxmox.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -1.045 Adjusted score from AWL reputation of From: address 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. [sync.rs, pull.rs, userid.rs, proxmox-backup-proxy.rs, self.data] Subject: [pbs-devel] [PATCH proxmox-backup 1/4] get rid of backup@pam 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: , X-List-Received-Date: Fri, 06 Nov 2020 07:12:13 -0000 --- src/api2/config/sync.rs | 4 ++-- src/api2/pull.rs | 2 +- src/api2/types/userid.rs | 12 ------------ src/bin/proxmox-backup-proxy.rs | 10 +++++----- src/server/email_notifications.rs | 8 +------- www/window/SyncJobEdit.js | 2 +- 6 files changed, 10 insertions(+), 28 deletions(-) diff --git a/src/api2/config/sync.rs b/src/api2/config/sync.rs index f9810369..bdad21e6 100644 --- a/src/api2/config/sync.rs +++ b/src/api2/config/sync.rs @@ -58,7 +58,7 @@ pub fn check_sync_job_modify_access( && owner.user() == auth_id.user()) }, // default sync owner - None => auth_id == Authid::backup_auth_id(), + None => auth_id == Authid::root_auth_id(), }; // same permission as changing ownership after syncing @@ -511,7 +511,7 @@ acl:1:/remote/remote1/remotestore1:write@pbs:RemoteSyncOperator job.owner = Some(read_auth_id.clone()); assert_eq!(check_sync_job_modify_access(&user_info, &write_auth_id, &job), false); - // also not to the default 'backup@pam' + // also not to the default 'root@pam' job.owner = None; assert_eq!(check_sync_job_modify_access(&user_info, &write_auth_id, &job), false); diff --git a/src/api2/pull.rs b/src/api2/pull.rs index 87015c72..7ac6308e 100644 --- a/src/api2/pull.rs +++ b/src/api2/pull.rs @@ -84,7 +84,7 @@ pub fn do_sync_job( let worker_future = async move { let delete = sync_job.remove_vanished.unwrap_or(true); - let sync_owner = sync_job.owner.unwrap_or(Authid::backup_auth_id().clone()); + let sync_owner = sync_job.owner.unwrap_or(Authid::root_auth_id().clone()); let (client, src_repo, tgt_store) = get_pull_parameters(&sync_job.store, &sync_job.remote, &sync_job.remote_store).await?; worker.log(format!("Starting datastore sync job '{}'", job_id)); diff --git a/src/api2/types/userid.rs b/src/api2/types/userid.rs index 9104de22..42271904 100644 --- a/src/api2/types/userid.rs +++ b/src/api2/types/userid.rs @@ -450,11 +450,6 @@ impl Userid { &self.data } - /// Get the "backup@pam" user id. - pub fn backup_userid() -> &'static Self { - &*BACKUP_USERID - } - /// Get the "root@pam" user id. pub fn root_userid() -> &'static Self { &*ROOT_USERID @@ -462,7 +457,6 @@ impl Userid { } lazy_static! { - pub static ref BACKUP_USERID: Userid = Userid::new("backup@pam".to_string(), 6); pub static ref ROOT_USERID: Userid = Userid::new("root@pam".to_string(), 4); } @@ -596,11 +590,6 @@ impl Authid { } } - /// Get the "backup@pam" auth id. - pub fn backup_auth_id() -> &'static Self { - &*BACKUP_AUTHID - } - /// Get the "root@pam" auth id. pub fn root_auth_id() -> &'static Self { &*ROOT_AUTHID @@ -608,7 +597,6 @@ impl Authid { } lazy_static! { - pub static ref BACKUP_AUTHID: Authid = Authid::from(Userid::new("backup@pam".to_string(), 6)); pub static ref ROOT_AUTHID: Authid = Authid::from(Userid::new("root@pam".to_string(), 4)); } diff --git a/src/bin/proxmox-backup-proxy.rs b/src/bin/proxmox-backup-proxy.rs index 5803f024..80f30e8d 100644 --- a/src/bin/proxmox-backup-proxy.rs +++ b/src/bin/proxmox-backup-proxy.rs @@ -377,7 +377,7 @@ async fn schedule_datastore_garbage_collection() { Err(_) => continue, // could not get lock }; - let auth_id = Authid::backup_auth_id(); + let auth_id = Authid::root_auth_id(); if let Err(err) = crate::server::do_garbage_collection_job(job, datastore, auth_id, Some(event_str), false) { eprintln!("unable to start garbage collection job on datastore {} - {}", store, err); @@ -440,7 +440,7 @@ async fn schedule_datastore_prune() { Err(_) => continue, // could not get lock }; - let auth_id = Authid::backup_auth_id().clone(); + let auth_id = Authid::root_auth_id().clone(); if let Err(err) = do_prune_job(job, prune_options, store.clone(), &auth_id, Some(event_str)) { eprintln!("unable to start datastore prune job {} - {}", &store, err); } @@ -484,7 +484,7 @@ async fn schedule_datastore_sync_jobs() { Err(_) => continue, // could not get lock }; - let auth_id = Authid::backup_auth_id().clone(); + let auth_id = Authid::root_auth_id().clone(); if let Err(err) = do_sync_job(job, job_config, &auth_id, Some(event_str)) { eprintln!("unable to start datastore sync job {} - {}", &job_id, err); } @@ -520,7 +520,7 @@ async fn schedule_datastore_verify_jobs() { }; let worker_type = "verificationjob"; - let auth_id = Authid::backup_auth_id().clone(); + let auth_id = Authid::root_auth_id().clone(); if check_schedule(worker_type, &event_str, &job_id) { let job = match Job::new(&worker_type, &job_id) { Ok(job) => job, @@ -560,7 +560,7 @@ async fn schedule_task_log_rotate() { if let Err(err) = WorkerTask::new_thread( worker_type, None, - Authid::backup_auth_id().clone(), + Authid::root_auth_id().clone(), false, move |worker| { job.start(&worker.upid().to_string())?; diff --git a/src/server/email_notifications.rs b/src/server/email_notifications.rs index a4383361..7a835e3f 100644 --- a/src/server/email_notifications.rs +++ b/src/server/email_notifications.rs @@ -397,16 +397,10 @@ pub fn send_updates_available( } /// Lookup users email address -/// -/// For "backup@pam", this returns the address from "root@pam". fn lookup_user_email(userid: &Userid) -> Option { use crate::config::user::{self, User}; - if userid == Userid::backup_userid() { - return lookup_user_email(Userid::root_userid()); - } - if let Ok(user_config) = user::cached_config() { if let Ok(user) = user_config.lookup::("user", userid.as_str()) { return user.email.clone(); @@ -437,7 +431,7 @@ pub fn lookup_datastore_notify_settings( email = match config.notify_user { Some(ref userid) => lookup_user_email(userid), - None => lookup_user_email(Userid::backup_userid()), + None => lookup_user_email(Userid::root_userid()), }; let notify_str = config.notify.unwrap_or(String::new()); diff --git a/www/window/SyncJobEdit.js b/www/window/SyncJobEdit.js index c3c0e228..df1f2c5b 100644 --- a/www/window/SyncJobEdit.js +++ b/www/window/SyncJobEdit.js @@ -142,7 +142,7 @@ Ext.define('PBS.window.SyncJobEdit', { name: 'owner', allowBlank: true, value: null, - emptyText: 'backup@pam', + emptyText: 'root@pam', skipEmptyText: true, cbind: { deleteEmpty: '{!isCreate}', -- 2.20.1