[pve-devel] [PATCH cluster] ssh_merge_known_hosts: also add entry if current sshkey does not match

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Jul 12 11:53:16 CEST 2017


this ensures that our current valid SSH keys gets added even if
another key on the same hostname exists already for some reasons.
The code path which handles hashed host names has this behavior
already since the beginning, so let the new non-hashed code act the
same way.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 data/PVE/Cluster.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/data/PVE/Cluster.pm b/data/PVE/Cluster.pm
index cfcd99a..8990656 100644
--- a/data/PVE/Cluster.pm
+++ b/data/PVE/Cluster.pm
@@ -1261,9 +1261,9 @@ sub ssh_merge_known_hosts {
 		} else {
 		    $key = lc($key); # avoid duplicate entries, ssh compares lowercased
 		    if ($key eq $ip_address) {
-			$found_local_ip = 1;
+			$found_local_ip = 1 if $rsakey eq $hostkey;
 		    } elsif ($key eq $nodename) {
-			$found_nodename = 1;
+			$found_nodename = 1 if $rsakey eq $hostkey;
 		    }
 		}
 		$data .= $line;
-- 
2.11.0





More information about the pve-devel mailing list