From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id EBC891FF13A for ; Wed, 29 Apr 2026 16:09:49 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 6FCB7F969; Wed, 29 Apr 2026 16:09:47 +0200 (CEST) From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= To: pbs-devel@lists.proxmox.com Subject: [PATCH proxmox-backup 2/6] pull: add support for strict decryption checking Date: Wed, 29 Apr 2026 16:09:23 +0200 Message-ID: <20260429140941.3537494-3-f.gruenbichler@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260429140941.3537494-1-f.gruenbichler@proxmox.com> References: <20260429140941.3537494-1-f.gruenbichler@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1777471686855 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.054 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 Message-ID-Hash: 47PCNBCQOH35YSTEBP36TRIDYASF6VE6 X-Message-ID-Hash: 47PCNBCQOH35YSTEBP36TRIDYASF6VE6 X-MailFrom: f.gruenbichler@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: if enabled, this mode will refuse to sync encrypted snapshots which cannot be decrypted. the only exception are encrypted snapshots which have previously been synced without decryption and are just resynced. Signed-off-by: Fabian Grünbichler --- src/api2/pull.rs | 2 ++ src/server/pull.rs | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/src/api2/pull.rs b/src/api2/pull.rs index 20b73b2cc..b80bc9a7d 100644 --- a/src/api2/pull.rs +++ b/src/api2/pull.rs @@ -93,6 +93,7 @@ impl TryFrom<&SyncJobConfig> for PullParameters { sync_job.resync_corrupt, sync_job.worker_threads, sync_job.associated_key.clone(), + None, ) } } @@ -233,6 +234,7 @@ async fn pull( resync_corrupt, worker_threads, decryption_keys, + None, )?; // fixme: set to_stdout to false? diff --git a/src/server/pull.rs b/src/server/pull.rs index 5fa18cefa..fcb14b878 100644 --- a/src/server/pull.rs +++ b/src/server/pull.rs @@ -77,6 +77,8 @@ pub(crate) struct PullParameters { worker_threads: Option, /// Decryption key ids and configs to decrypt snapshots with matching key fingerprint crypt_configs: Vec<(String, Arc)>, + /// Only sync encrypted snapshots if a matching key is configured + strict_decryption_mode: bool, } impl PullParameters { @@ -99,6 +101,7 @@ impl PullParameters { resync_corrupt: Option, worker_threads: Option, decryption_keys: Option>, + strict_decryption_mode: Option, ) -> Result { if let Some(max_depth) = max_depth { ns.check_max_depth(max_depth)?; @@ -108,6 +111,7 @@ impl PullParameters { let resync_corrupt = resync_corrupt.unwrap_or(false); let encrypted_only = encrypted_only.unwrap_or(false); let verified_only = verified_only.unwrap_or(false); + let strict_decryption_mode = strict_decryption_mode.unwrap_or(false); let source: Arc = if let Some(remote) = remote { let (remote_config, _digest) = pbs_config::remote::config()?; @@ -165,6 +169,7 @@ impl PullParameters { resync_corrupt, worker_threads, crypt_configs, + strict_decryption_mode, }) } } @@ -980,6 +985,10 @@ async fn optionally_use_decryption_key( bail!("No matching key found, refusing sync"); } + if encrypted && params.strict_decryption_mode { + bail!("No matching key found but strict checking requests, refusing to sync"); + } + // regular sync if !params.crypt_configs.is_empty() { log_sender -- 2.47.3