Bug #77613 Workbench can't connect to (unknown) hosts over SSH
Submitted: 3 Jul 2015 17:16 Modified: 13 Jul 2015 10:27
Reporter: Stefan Greiner Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: Administration Severity:S2 (Serious)
Version:6.3.4 OS:Windows (8.1 Enterprise)
Assigned to: CPU Architecture:Any
Tags: ssh ssh-rsa known_hosts

[3 Jul 2015 17:16] Stefan Greiner
Description:
Currently the Workbench is not able to connect to (unknown) hosts via SSH.

Error Message:
SSH Server Fingerprint is Missing
The authenticity of host 'xxx (xxx)' can't be established.
ssh-rsa key fingerprint is XXXX
Are you sure you want to continue connecting.

But after clicking 'continue' the key is neither added to any known_hosts file, nor does the connection work.

There is only one workaround: add the following to %appdata%\MySQL\Workbench\ssh\config

Host *
	StrictHostKeyChecking no

The folder and the file have to be created manually.
Setting a custom known_hosts file via UserKnownHostsFile seems to get ignored by workbench (at least under Windows)

How to repeat:
-Open MySQL Workbench
-Add a new connection
-Edit the connection and set Remote Management to "SSH login based management" and enter a hostname/ip and a username
-open the newly created connection (or test connection right here)
-switch to "Server Status"
-enter the SSH Password

Error Message:
SSH Server Fingerprint is Missing
The authenticity of host 'xxx (xxx)' can't be established.
ssh-rsa key fingerprint is XXXX
Are you sure you want to continue connecting.

-Press continue
-there is nothing displayed on the right info bar (e.g. Load, Connections, Traffic ...)

Same goes for every other feature which requires SSH (e.g. Server logs, Options file...)

Suggested fix:
Implement something that MySQL Workbench adds and uses as known_hosts file under Windows. There should be no need for the enduser to open that files manually.
[8 Jul 2015 14:57] MySQL Verification Team
Thank you for the bug report.
[13 Jul 2015 10:27] Marcin Szalowicz
This bug has been already fixed, and here is relevant patch for this fix:

--- a/plugins/wb.admin/backend/wb_admin_ssh.py
+++ b/plugins/wb.admin/backend/wb_admin_ssh.py
@@ -381,21 +381,20 @@ class WbAdminSSH(object):
         
 
         client = paramiko.SSHClient()
-        if usekey:
-            ssh_known_hosts_file = None
-            if "userknownhostsfile" in opts:
-                ssh_known_hosts_file = opts["userknownhostsfile"]
-            else:
-                client.get_host_keys().clear()
-                ssh_known_hosts_file = '~/.ssh/known_hosts'
+        ssh_known_hosts_file = None
+        if "userknownhostsfile" in opts:
+            ssh_known_hosts_file = opts["userknownhostsfile"]
+        else:
+            client.get_host_keys().clear()
+            ssh_known_hosts_file = '~/.ssh/known_hosts'
+            
+            if platform.system().lower() == "windows":
+                ssh_known_hosts_file = '%s\ssh\known_hosts' % mforms.App.get().get_user_data_folder()
                 
-                if platform.system().lower() == "windows":
-                    ssh_known_hosts_file = '%s\ssh\known_hosts' % mforms.App.get().get_user_data_folder()
-                    
-            try:
-                client.load_host_keys(os.path.expanduser(ssh_known_hosts_file))
-            except IOError, e:
-                log_warning("IOError, probably caused by file %s not found, the message was: %s\n" % (ssh_known_hosts_file, e))
+        try:
+            client.load_host_keys(os.path.expanduser(ssh_known_hosts_file))
+        except IOError, e:
+            log_warning("IOError, probably caused by file %s not found, the message was: %s\n" % (ssh_known_hosts_file, e))
         
         if "stricthostkeychecking" in opts and opts["stricthostkeychecking"].lower() == "no":
             client.set_missing_host_key_policy(WarningPolicy())
[21 Jul 2015 21:29] MySQL Verification Team
http://bugs.mysql.com/bug.php?id=77794 marked as duplicate of this one.
[26 Aug 2015 8:12] Den Parygin
very well
[29 Aug 2015 18:22] Joaquin Berlanga
Patch applied and ssh working properly, on Windows 8.1 pro