]> git.proxmox.com Git - pve-cluster.git/commitdiff
setup_sshd_config: add start_sshd flag
authorDietmar Maurer <dietmar@proxmox.com>
Thu, 24 Nov 2016 05:40:17 +0000 (06:40 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 24 Nov 2016 05:40:17 +0000 (06:40 +0100)
and call setup_sshd_config within updatecerts.

data/PVE/CLI/pvecm.pm
data/PVE/Cluster.pm

index 690b036c0c9021111686765f361a6d766254d770..49135d3f65926a9eef4635d5c33d60292f2ff148 100755 (executable)
@@ -163,7 +163,7 @@ __PACKAGE__->register_method ({
 
        -f $clusterconf && die "cluster config '$clusterconf' already exists\n";
 
-       PVE::Cluster::setup_sshd_config();
+       PVE::Cluster::setup_sshd_config(1);
        PVE::Cluster::setup_rootsshconfig();
        PVE::Cluster::setup_ssh_keys();
 
@@ -488,7 +488,7 @@ __PACKAGE__->register_method ({
 
        my $nodename = PVE::INotify::nodename();
 
-       PVE::Cluster::setup_sshd_config();
+       PVE::Cluster::setup_sshd_config(1);
        PVE::Cluster::setup_rootsshconfig();
        PVE::Cluster::setup_ssh_keys();
 
@@ -811,6 +811,7 @@ __PACKAGE__->register_method ({
     code => sub {
        my ($param) = @_;
 
+       PVE::Cluster::setup_sshd_config(0);
        PVE::Cluster::setup_rootsshconfig();
 
        PVE::Cluster::gen_pve_vzdump_symlink();
index 60ea17998184cec101297b84bca264857a33e204..3d7f6a36003365c4e25632ba8c8e7491d285ee45 100644 (file)
@@ -1121,6 +1121,7 @@ sub ssh_merge_keys {
 }
 
 sub setup_sshd_config {
+    my ($start_sshd) = @_;
 
     my $conf = PVE::Tools::file_get_contents($sshd_config_fn);
     
@@ -1133,7 +1134,8 @@ sub setup_sshd_config {
 
     PVE::Tools::file_set_contents($sshd_config_fn, $conf);
 
-    PVE::Tools::run_command(['systemctl', 'reload-or-restart', 'sshd']);
+    my $cmd = $start_sshd ? 'reload-or-restart' : 'reload-or-try-restart';
+    PVE::Tools::run_command(['systemctl', $cmd, 'sshd']);
 }
 
 sub setup_rootsshconfig {