summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorDaniel P. Berrangé <berrange@redhat.com>2021-09-13 17:57:34 +0100
committerDaniel P. Berrangé <berrange@redhat.com>2022-02-16 14:34:15 +0000
commitea0f60e6f274ca8ecb45296272b2561e088b6fc8 (patch)
treee99cd74c20435171ae861ebd6d6793ceb315f54a
parentab458750d06bc5dec241722df8b2d5cd2456f66d (diff)
downloadfocaccia-qemu-ea0f60e6f274ca8ecb45296272b2561e088b6fc8.tar.gz
focaccia-qemu-ea0f60e6f274ca8ecb45296272b2561e088b6fc8.zip
block: support sha256 fingerprint with pre-blockdev options
When support for sha256 fingerprint checking was aded in

  commit bf783261f0aee6e81af3916bff7606d71ccdc153
  Author: Daniel P. Berrangé <berrange@redhat.com>
  Date:   Tue Jun 22 12:51:56 2021 +0100

    block/ssh: add support for sha256 host key fingerprints

it was only made to work with -blockdev. Getting it working with
-drive requires some extra custom parsing.

Reviewed-by: Hanna Reitz <hreitz@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-rw-r--r--block/ssh.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/block/ssh.c b/block/ssh.c
index 3b5bf34031..ac01301409 100644
--- a/block/ssh.c
+++ b/block/ssh.c
@@ -556,6 +556,11 @@ static bool ssh_process_legacy_options(QDict *output_opts,
             qdict_put_str(output_opts, "host-key-check.type", "sha1");
             qdict_put_str(output_opts, "host-key-check.hash",
                           &host_key_check[5]);
+        } else if (strncmp(host_key_check, "sha256:", 7) == 0) {
+            qdict_put_str(output_opts, "host-key-check.mode", "hash");
+            qdict_put_str(output_opts, "host-key-check.type", "sha256");
+            qdict_put_str(output_opts, "host-key-check.hash",
+                          &host_key_check[7]);
         } else if (strcmp(host_key_check, "yes") == 0) {
             qdict_put_str(output_opts, "host-key-check.mode", "known_hosts");
         } else {