From 32e89e92600a361bdfe65ef34e3ac874515919f5 Mon Sep 17 00:00:00 2001 From: elijah Date: Sun, 9 Nov 2014 15:18:18 -0800 Subject: make sure to specify HostKeyAlgorithms for ssh and rsync. this is needed because otherwise you can't connect to a server that has ecdsa host key if all you have is an rsa key host key. closes bug #6337 --- lib/leap_cli/ssh_key.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'lib/leap_cli/ssh_key.rb') diff --git a/lib/leap_cli/ssh_key.rb b/lib/leap_cli/ssh_key.rb index 3cbeddd..5a7ac23 100644 --- a/lib/leap_cli/ssh_key.rb +++ b/lib/leap_cli/ssh_key.rb @@ -107,6 +107,23 @@ module LeapCli return keys.map{|k| SshKey.load(k[1], k[0])} end + # + # takes a string with one or more ssh keys, one key per line, + # and returns a string that specified the ssh key algorithms + # that are supported by the keys, in order of preference. + # + # eg: ecdsa-sha2-nistp256,ssh-rsa,ssh-ed25519 + # + def self.supported_host_key_algorithms(string) + if string + self.parse_keys(string).map {|key| + key.type + }.join(',') + else + "" + end + end + ## ## INSTANCE METHODS ## -- cgit v1.2.3