[pve-devel] [PATCH RFC 09/21] setup_sshd_config: generate $ssh_host_rsa_cert

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


Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
---
 data/PVE/Cluster.pm | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/data/PVE/Cluster.pm b/data/PVE/Cluster.pm
index c7deafe..6b04a6f 100644
--- a/data/PVE/Cluster.pm
+++ b/data/PVE/Cluster.pm
@@ -1200,6 +1200,15 @@ sub ssh_merge_keys {
 sub setup_sshd_config {
     my ($start_sshd) = @_;
 
+    my $nodename = PVE::INotify::nodename();
+
+    if (! -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);
+	PVE::Tools::file_set_contents($ssh_host_rsa_cert, $cert);
+    }
+
     my $conf = PVE::Tools::file_get_contents($sshd_config_fn);
 
     my $changes = 0;
-- 
2.1.4




More information about the pve-devel mailing list