[pve-devel] [PATCH RFC 10/21] setup_sshd_config: add force flag (allow to regenerate cert)

Dietmar Maurer dietmar at proxmox.com
Mon Nov 28 08:09:02 CET 2016


Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
---
 data/PVE/CLI/pvecm.pm | 2 +-
 data/PVE/Cluster.pm   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/data/PVE/CLI/pvecm.pm b/data/PVE/CLI/pvecm.pm
index e47c3d3..db7cb63 100755
--- a/data/PVE/CLI/pvecm.pm
+++ b/data/PVE/CLI/pvecm.pm
@@ -825,7 +825,7 @@ __PACKAGE__->register_method ({
 	    PVE::Cluster::gen_pve_vzdump_files();
 	}
 
-	PVE::Cluster::setup_sshd_config(0);
+	PVE::Cluster::setup_sshd_config(0, $param->{force});
 	PVE::Cluster::setup_rootsshconfig();
 	PVE::Cluster::gen_pve_vzdump_symlink();
 
diff --git a/data/PVE/Cluster.pm b/data/PVE/Cluster.pm
index 6b04a6f..1b1b0a7 100644
--- a/data/PVE/Cluster.pm
+++ b/data/PVE/Cluster.pm
@@ -1198,11 +1198,11 @@ sub ssh_merge_keys {
 }
 
 sub setup_sshd_config {
-    my ($start_sshd) = @_;
+    my ($start_sshd, $force) = @_;
 
     my $nodename = PVE::INotify::nodename();
 
-    if (! -s $ssh_host_rsa_cert) {
+    if ($force || ! -s $ssh_host_rsa_cert) {
 	my $ssh_host_pubkey = PVE::Tools::file_get_contents($ssh_host_rsa_id);
 	my $cert = gen_pve_ssh_cert($ssh_host_pubkey, $nodename,
 				    "PVE-HOST-$nodename", 1);
-- 
2.1.4




More information about the pve-devel mailing list