]> git.proxmox.com Git - pve-container.git/commitdiff
setup: fix ssh-key perms lost with the rewrite
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Fri, 6 Nov 2015 12:09:23 +0000 (13:09 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 6 Nov 2015 15:19:00 +0000 (16:19 +0100)
src/PVE/LXC/Setup.pm

index 6b086fbf8ac001aa2fb1c262ab8a089c62b9a87f..9dde1e82e836230501692375d4f53ca3aef1285f 100644 (file)
@@ -181,8 +181,8 @@ sub rewrite_ssh_host_keys {
        my $cmd = ['ssh-keygen', '-q', '-f', $file, '-t', $keytype,
                   '-N', '', '-C', "root\@$hostname"];
        PVE::Tools::run_command($cmd);
-       $keyfiles->{"/etc/ssh/$basename"} = PVE::Tools::file_get_contents($file);
-       $keyfiles->{"/etc/ssh/$basename.pub"} = PVE::Tools::file_get_contents("$file.pub");
+       $keyfiles->{"/etc/ssh/$basename"} = [PVE::Tools::file_get_contents($file), 0600];
+       $keyfiles->{"/etc/ssh/$basename.pub"} = [PVE::Tools::file_get_contents("$file.pub"), 0644];
        unlink $file;
        unlink "$file.pub";
     }
@@ -191,7 +191,7 @@ sub rewrite_ssh_host_keys {
 
     my $code = sub {
        foreach my $file (keys %$keyfiles) {
-           $plugin->ct_file_set_contents($file, $keyfiles->{$file});
+           $plugin->ct_file_set_contents($file, @{$keyfiles->{$file}});
        }
     };
     $self->protected_call($code);