all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Christian Ebner <c.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [PATCH proxmox-backup 1/1] sync: pull: refuse to overwrite pre-existing encrypted snapshot
Date: Wed, 29 Apr 2026 16:37:40 +0200	[thread overview]
Message-ID: <20260429143740.886870-1-c.ebner@proxmox.com> (raw)

If the source snapshot is not encrypted, the target snapshot however
is pre-existing and there is no decryption key which would detect the
mismatch, the unencrypted source will overwrite the encrypted target
due to resync because of mismatching raw manifests.

Further, currently regular syncs of two potentially clashing
snapshots from different sources would lead to overwritig of the
target snapshot as well, since byte wise manifests differ.

Protect against this by extending the key matching checks, refusing
to overwrite any locally encrypted by a not decrypted source as well
as comparing content by calculating the signature using a dummy key
if both, source and pre-existing target are not encrypted.

Reported-by: Daniel Kral <d.kral@proxmox.com>
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
 src/server/pull.rs | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/server/pull.rs b/src/server/pull.rs
index 5fa18cefa..7c4cd9332 100644
--- a/src/server/pull.rs
+++ b/src/server/pull.rs
@@ -942,6 +942,19 @@ async fn optionally_use_decryption_key(
     log_sender: Arc<LogLineSender>,
 ) -> Result<(Option<Arc<CryptConfig>>, bool), Error> {
     let Some(key_fp) = manifest.fingerprint().with_context(|| prefix.clone())? else {
+        if let Some(existing_manifest) = existing_target_manifest {
+            if existing_manifest.fingerprint()?.is_some() {
+                bail!("Local encrypted or signed snapshot detected, but source is not encrypted, refuse to sync");
+            } else {
+                // just used to detect unsigned source and pre-existing target clashes
+                let dummy = CryptConfig::new([0u8; 32])?;
+                if existing_manifest.signature(&dummy)? != manifest.signature(&dummy)? {
+                    // neighther source nor target encrypted, but manifests differ
+                    bail!("Different content for pre-existing local snapshot and source snapshot detected, refuse to sync");
+                }
+            }
+        }
+
         return Ok((None, false)); // no fingerprint on source, regular pull
     };
 
-- 
2.47.3





             reply	other threads:[~2026-04-29 14:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-29 14:37 Christian Ebner [this message]
2026-04-29 16:23 ` applied: [PATCH proxmox-backup 1/1] sync: pull: refuse to overwrite pre-existing encrypted snapshot Thomas Lamprecht

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=20260429143740.886870-1-c.ebner@proxmox.com \
    --to=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal