public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dietmar Maurer <dietmar@proxmox.com>
To: "Proxmox Backup Server development discussion"
	<pbs-devel@lists.proxmox.com>,
	"Fabian Grünbichler" <f.gruenbichler@proxmox.com>
Subject: [pbs-devel] applied: [PATCH proxmox-backup-qemu 1/2] encryption key tracking: use fingerprint
Date: Wed, 25 Nov 2020 08:28:53 +0100 (CET)	[thread overview]
Message-ID: <270281567.389.1606289334340@webmail.proxmox.com> (raw)
In-Reply-To: <20201124130520.1058725-2-f.gruenbichler@proxmox.com>

applied both patches.

> On 11/24/2020 2:05 PM Fabian Grünbichler <f.gruenbichler@proxmox.com> wrote:
> 
>  
> but accept old variant as well for now, to not invalidate bitmaps for
> freshly migrated VMs.
> 
> Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
> ---
> 
> Notes:
>     needs proxmox-backup with Fingerprint::bytes()
> 
>  src/commands.rs | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/src/commands.rs b/src/commands.rs
> index 7a24b7c..dcee5a1 100644
> --- a/src/commands.rs
> +++ b/src/commands.rs
> @@ -108,6 +108,8 @@ fn archive_name(device_name: &str) -> String {
>  const CRYPT_CONFIG_HASH_INPUT:&[u8] = b"this is just a static string to protect against key changes";
>  
>  /// Create an identifying digest for the crypt config
> +/// legacy version for VMs freshly migrated from old version
> +/// TODO: remove in PVE 7.0
>  pub(crate) fn crypt_config_digest(
>      config: Arc<CryptConfig>,
>  ) -> [u8;32] {
> @@ -152,7 +154,8 @@ pub(crate) fn check_last_encryption_key(
>      let digest_guard = PREVIOUS_CRYPT_CONFIG_DIGEST.lock().unwrap();
>      match (*digest_guard, config)  {
>          (Some(last_digest), Some(current_config)) => {
> -            crypt_config_digest(current_config) == last_digest
> +            current_config.fingerprint().bytes() == &last_digest
> +                || crypt_config_digest(current_config) == last_digest
>          },
>          (None, None) => true,
>          _ => false,
> @@ -440,7 +443,13 @@ pub(crate) async fn finish_backup(
>  
>      {
>          let crypt_config_digest = match crypt_config {
> -            Some(current_config) => Some(crypt_config_digest(current_config)),
> +            Some(current_config) => {
> +                let fp = current_config
> +                    .fingerprint()
> +                    .bytes()
> +                    .to_owned();
> +                Some(fp)
> +            },
>              None => None,
>          };
>  
> -- 
> 2.20.1
> 
> 
> 
> _______________________________________________
> pbs-devel mailing list
> pbs-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel




  parent reply	other threads:[~2020-11-25  7:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-24 13:05 [pbs-devel] [PATCH proxmox-backup(-qemu) 0/3] switch to fingerprint for tracking key Fabian Grünbichler
2020-11-24 13:05 ` [pbs-devel] [PATCH proxmox-backup-qemu 1/2] encryption key tracking: use fingerprint Fabian Grünbichler
2020-11-24 15:36   ` Dietmar Maurer
2020-11-24 15:44     ` Fabian Grünbichler
2020-11-25  7:28   ` Dietmar Maurer [this message]
2020-11-24 13:05 ` [pbs-devel] [PATCH proxmox-backup] fingerprint: add bytes() accessor Fabian Grünbichler
2020-11-25  7:27   ` [pbs-devel] applied: " Dietmar Maurer
2020-11-24 13:05 ` [pbs-devel] [PATCH proxmox-backup-qemu 2/2] fingerprint: rename variables Fabian Grünbichler

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=270281567.389.1606289334340@webmail.proxmox.com \
    --to=dietmar@proxmox.com \
    --cc=f.gruenbichler@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