From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id C3A251FF135 for ; Sun, 19 Apr 2026 23:08:33 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 8FE3A1792B; Sun, 19 Apr 2026 23:08:24 +0200 (CEST) From: Thomas Lamprecht To: c.ebner@proxmox.com Subject: Re: [PATCH proxmox-backup v3 28/30] sync: pull: decrypt snapshots with matching encryption key fingerprint Date: Sun, 19 Apr 2026 22:41:59 +0200 Message-ID: <20260419210610.3915597-10-t.lamprecht@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260414125923.892345-29-c.ebner@proxmox.com> References: <20260419210610.3915597-1-t.lamprecht@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1776632780962 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.002 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: RIMD3Y7GB5MR3YD6RP5EI3ZPCS2AOQDC X-Message-ID-Hash: RIMD3Y7GB5MR3YD6RP5EI3ZPCS2AOQDC X-MailFrom: t.lamprecht@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 CC: pbs-devel@lists.proxmox.com 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: Am 14.04.26 um 14:59 schrieb Christian Ebner: > diff --git a/src/server/pull.rs b/src/server/pull.rs > @@ -783,9 +781,15 @@ async fn pull_snapshot<'a>( > > + new_manifest.unprotected = manifest.unprotected.clone(); > + if let Some(unprotected) = new_manifest.unprotected.as_object_mut() { > + unprotected.remove("key-fingerprint"); > + unprotected.remove("verify_state"); > + } Shouldn't this also remove the change-detection-fingerprint? That field was computed from the source's encrypted file entries and doesn't match the decrypted local content. On the next sync: 1. raw manifest comparison fails (encrypted vs decrypted blobs) 2. change_detection_fingerprint() gets recomputed from the local decrypted entries, which won't match the source's stored one that was computed from encrypted entries 3. no fast path fires and everything gets re-downloaded and re-decrypted For large datastores that's a pretty significant hit on every re-sync even when nothing actually changed on the source. I think either removing the stale fingerprint here or storing the source fingerprint as-is (without recomputing from local entries on the next round) would fix it. > + tmp_manifest_file.write_all(&manifest_data).await?; > + tmp_manifest_file.flush().await?; nit: only flush() but no fsync() before the rename below. Patch 26 correctly uses nix::unistd::fsync() before its rename, might want to be consistent here for crash safety (albeit it won't help with peformance, but at least would be consistent - your call). > + if local_manifest_file_fp.is_some() && crypt_config.is_none() { > + bail!("local unencrypted snapshot detected, refuse to sync without source decryption"); > + } nit: the error message is slightly misleading - the local snapshot isn't "unencrypted" per se, it was previously *decrypted*. Something like "local snapshot was previously decrypted but no matching decryption key is configured" would probably better describe the situation for the user's POV.