[pbs-devel] [PATCH proxmox-backup 3/7] client: print key fingerprint and master key

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Nov 17 19:38:04 CET 2020


On 17.11.20 18:57, Fabian Grünbichler wrote:
> for operations where it makes sense.
> 
> Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
> ---
>  src/bin/proxmox-backup-client.rs       | 11 +++++++++--
>  src/bin/proxmox_backup_client/mount.rs |  6 +++++-
>  2 files changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/src/bin/proxmox-backup-client.rs b/src/bin/proxmox-backup-client.rs
> index c63c7eb6..54f7911d 100644
> --- a/src/bin/proxmox-backup-client.rs
> +++ b/src/bin/proxmox-backup-client.rs
> @@ -1069,7 +1069,9 @@ async fn create_backup(
>      let (crypt_config, rsa_encrypted_key) = match keydata {
>          None => (None, None),
>          Some(key) => {
> -            let (key, created, _fingerprint) = decrypt_key(&key, &key::get_encryption_key_password)?;
> +            let (key, created, fingerprint) = decrypt_key(&key, &key::get_encryption_key_password)?;
> +            println!("Encryption key fingerprint: {}",
> +                     crate::tools::format::as_fingerprint(&fingerprint));
>  
>              let crypt_config = CryptConfig::new(key)?;
>  
> @@ -1078,6 +1080,9 @@ async fn create_backup(
>                      let pem_data = file_get_contents(path)?;
>                      let rsa = openssl::rsa::Rsa::public_key_from_pem(&pem_data)?;
>                      let enc_key = crypt_config.generate_rsa_encoded_key(rsa, created)?;
> +                    println!("Master key '{:?}'",
> +                             path);

nit, above would better fit in the same line as the println!
(just as reminder for whoever applies this series, or you if a v2 is warranted
for other reasons)

> +
>                      (Some(Arc::new(crypt_config)), Some(enc_key))
>                  }
>                  _ => (Some(Arc::new(crypt_config)), None),
> @@ -1380,7 +1385,9 @@ async fn restore(param: Value) -> Result<Value, Error> {
>      let crypt_config = match keydata {
>          None => None,
>          Some(key) => {
> -            let (key, _, _) = decrypt_key(&key, &key::get_encryption_key_password)?;
> +            let (key, _, fingerprint) = decrypt_key(&key, &key::get_encryption_key_password)?;
> +            println!("Encryption key fingerprint: '{}'",
> +                     crate::tools::format::as_fingerprint(&fingerprint));
>              Some(Arc::new(CryptConfig::new(key)?))
>          }
>      };
> diff --git a/src/bin/proxmox_backup_client/mount.rs b/src/bin/proxmox_backup_client/mount.rs
> index 6283961e..a1c2ed86 100644
> --- a/src/bin/proxmox_backup_client/mount.rs
> +++ b/src/bin/proxmox_backup_client/mount.rs
> @@ -182,7 +182,11 @@ async fn mount_do(param: Value, pipe: Option<RawFd>) -> Result<Value, Error> {
>      let crypt_config = match keyfile {
>          None => None,
>          Some(path) => {
> -            let (key, _, _) = load_and_decrypt_key(&path, &crate::key::get_encryption_key_password)?;
> +            println!("Encryption key file: '{:?}'",
> +                     path);
> +            let (key, _, fingerprint) = load_and_decrypt_key(&path, &crate::key::get_encryption_key_password)?;
> +            println!("Encryption key fingerprint: '{}'",
> +                     crate::tools::format::as_fingerprint(&fingerprint));
>              Some(Arc::new(CryptConfig::new(key)?))
>          }
>      };
> 







More information about the pbs-devel mailing list