ssh fetcher: No longer allow deprecated and insecure DSA algorithm
This commit is contained in:
parent
b45b4c8165
commit
7f5b5e5b5b
|
@ -89,23 +89,16 @@ namespace Sparkles {
|
||||||
|
|
||||||
string FetchHostKey ()
|
string FetchHostKey ()
|
||||||
{
|
{
|
||||||
Logger.LogInfo ("Auth", "Fetching host key for " + RemoteUrl.Host);
|
Logger.LogInfo ("Auth", string.Format ("Fetching host key for {0}", RemoteUrl.Host));
|
||||||
string [] key_types = {"rsa", "dsa", "ecdsa"};
|
var ssh_keyscan = new Command ("ssh-keyscan", string.Format ("-t rsa -p 22 {0}", RemoteUrl.Host));
|
||||||
|
|
||||||
foreach (string key_type in key_types) {
|
if (RemoteUrl.Port > 0)
|
||||||
string args = "-t " + key_type + " " + "-p" + " ";
|
ssh_keyscan.StartInfo.Arguments = string.Format ("-t rsa -p {0} {1}", RemoteUrl.Port, RemoteUrl.Host);
|
||||||
|
|
||||||
if (RemoteUrl.Port < 1)
|
|
||||||
args += "22 " + RemoteUrl.Host;
|
|
||||||
else
|
|
||||||
args += RemoteUrl.Port + " " + RemoteUrl.Host;
|
|
||||||
|
|
||||||
var ssh_keyscan = new Command ("ssh-keyscan", args);
|
|
||||||
string host_key = ssh_keyscan.StartAndReadStandardOutput ();
|
string host_key = ssh_keyscan.StartAndReadStandardOutput ();
|
||||||
|
|
||||||
if (ssh_keyscan.ExitCode == 0 && !string.IsNullOrWhiteSpace (host_key))
|
if (ssh_keyscan.ExitCode == 0 && !string.IsNullOrWhiteSpace (host_key))
|
||||||
return host_key;
|
return host_key;
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue