]> git.proxmox.com Git - pve-container.git/blobdiff - src/PVE/LXC/Setup.pm
fix #1253: show ssh key fingerprints again
[pve-container.git] / src / PVE / LXC / Setup.pm
index a32eb86d524de16291f0ce5f69dc384353fc8cbe..d65685ccaad6ed6c88de366bd45b428572b89c35 100644 (file)
@@ -223,7 +223,8 @@ sub rewrite_ssh_host_keys {
        my $line = shift;
 
        print "done: $line\n"
-           if ($line =~ m/^([0-9a-f]{2}:)+[0-9a-f]{2}\s+\Q$ssh_comment\E$/i);
+           if $line =~ m/^(?:[0-9a-f]{2}:)+[0-9a-f]{2}\s+\Q$ssh_comment\E$/i ||
+              $line =~ m/^SHA256:[0-9a-z+\/]{43}\s+\Q$ssh_comment\E$/i;
     };
 
     # Create temporary keys in /tmp on the host
@@ -233,7 +234,7 @@ sub rewrite_ssh_host_keys {
        my $file = "/tmp/$$.$basename";
        print "Creating SSH host key '$basename' - this may take some time ...\n";
        my $cmd = ['ssh-keygen', '-f', $file, '-t', $keytype,
-                  '-N', '', '-C', $ssh_comment];
+                  '-N', '', '-E', 'sha256', '-C', $ssh_comment];
        PVE::Tools::run_command($cmd, outfunc => $keygen_outfunc);
        $keyfiles->{"/etc/ssh/$basename"} = [PVE::Tools::file_get_contents($file), 0600];
        $keyfiles->{"/etc/ssh/$basename.pub"} = [PVE::Tools::file_get_contents("$file.pub"), 0644];