MySQL Workbench com Debian Jessie - TCP/IP sobre SSH não funciona

MySQL Workbench com Debian Jessie - TCP/IP sobre SSH não funciona

Eu uso para conectar com Windows 7 Pro x64 ao meu servidor MySQL hospedado em um Debian Wheezy com o cliente MySQL Workbench usando o "TCP/IP over SSH" mas não funciona no meu novo servidor no Debian Jessie, por quê?


Configuração do ambiente de trabalho MySQL:

Connection Name: TEST
Connection Method: Standard TCP/IP over SSH

SSH Hostname: x.x.x.x:22
SSH Username: root
SSH Password: myRootPa$$word
SSH Key File: <NOT-USING-KEYFILE>

MySQL Hostname: 127.0.0.1
MySQL Server Port: 3306
Username: root
Password: myMySQLPa$$word

Verifiquei novamente o endereço IP/nome do host, nome de usuário e senha...


Configuração do servidor Debian Wheezy:

root@debian:~# cat /etc/debian_version

7.8

mysql> selecione versão();

+------------------+
| version()        |
+------------------+
| 5.5.40-0+wheezy1 |
+------------------+
1 row in set (0.00 sec)

root@debian:~# cat /etc/ssh/sshd_config

Port 22
Protocol 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
UsePrivilegeSeparation yes

KeyRegenerationInterval 3600
ServerKeyBits 768
SyslogFacility AUTH
LogLevel INFO
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes
RSAAuthentication yes
PubkeyAuthentication yes

IgnoreRhosts yes
RhostsRSAAuthentication no
HostbasedAuthentication no
PermitEmptyPasswords no
ChallengeResponseAuthentication no

X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes

AcceptEnv LANG LC_*
Subsystem sftp /usr/lib/openssh/sftp-server
UsePAM yes

Configuração do servidor Debian Jessie:

root@debian:~# cat /etc/debian_version

8.0

mysql> selecione versão();

+-----------------+
| version()       |
+-----------------+
| 5.5.43-0+deb8u1 |
+-----------------+
1 row in set (0.00 sec)

root@debian:~# cat /etc/ssh/sshd_config

Port 22
Protocol 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
UsePrivilegeSeparation yes

KeyRegenerationInterval 3600
ServerKeyBits 1024
SyslogFacility AUTH
LogLevel INFO
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes
RSAAuthentication yes
PubkeyAuthentication yes

IgnoreRhosts yes
RhostsRSAAuthentication no
HostbasedAuthentication no
PermitEmptyPasswords no
ChallengeResponseAuthentication no

X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes

AcceptEnv LANG LC_*
Subsystem sftp /usr/lib/openssh/sftp-server
UsePAM yes

Então a diferença principal é ServerKeyBitsentre os dois arquivos sshd_config ...


O erro que o MySQL Workbench 6.3.3 me dá quando tento me conectar aoDebian Jessieservidor:

Could not connect the SSH Tunnel
Authentication error, unhandled exception caught in tunnel manager, please refer to logs for details

O arquivo de registro:

10:00:04 [INF][     SSH tunnel]: Starting tunnel
10:00:04 [INF][     SSH tunnel]: Existing SSH tunnel not found, opening new one
10:00:07 [INF][     SSH tunnel]: Opening SSH tunnel to 10.232.50.15:22
10:00:07 [WRN][sshtunnel.py:_connect_ssh:287]: IOError, probably caused by file C:\Users\myUser\AppData\Roaming\MySQL\Workbench\ssh\known_hosts not found, the message was: [Errno 2] No such file or directory: u'C:\\Users\\myUser\\AppData\\Roaming\\MySQL\\Workbench\\ssh\\known_hosts'
10:00:07 [ERR][sshtunnel.py:notify_exception_error:233]: Traceback (most recent call last):
  File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE\sshtunnel.py", line 297, in _connect_ssh
    look_for_keys=has_key, allow_agent=has_key)
  File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\client.py", line 301, in connect
    t.start_client()
  File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\transport.py", line 461, in start_client
    raise e
SSHException: Incompatible ssh peer (no acceptable kex algorithm)

10:00:07 [INF][     SSH tunnel]: TunnelManager.wait_connection authentication error: Authentication error, unhandled exception caught in tunnel manager, please refer to logs for details
10:00:07 [ERR][     SSH tunnel]: Authentication error opening SSH tunnel: Authentication error, unhandled exception caught in tunnel manager, please refer to logs for details

Mais informações:

A pasta "ssh" não está presente em:

C:\Users\myUser\AppData\Roaming\MySQL\Workbench

Regras de firewall em ambos os servidores:

root@debian:~# iptables -vnL

Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

Posso me conectar com SSH (KiTTY) em ambos os servidores ...


Eu tentei duas versões diferentes do MySQL Workbench:

Version 6.3.3.0 build 592 (64 bits)
Version 6.0.9.11421 build 1170 (32 bits)

Essas duas versões funcionam com Debian Wheezy, mas não com Debian Jessie. o que estou perdendo?

Responder1

De acordo comhttps://bugs.mysql.com/bug.php?id=74658o problema se apresenta ao usar o openssh 6.7, as bibliotecas python fornecidas com o ambiente de trabalho MySql. Ao adicionar "KexAlgorithms" à configuração do sshd, você pode atualizar as bibliotecas python que vêm com o MySql Workbench. Isso pode ser útil se você não tiver controle sobre a configuração do sshd...

Se você rolar para baixo no relatório de bug, há instruções para baixar e copiar as bibliotecas paramiko e ecdsa.

Responder2

Eu encontrei a solução.

Adicionei esta linha ao meu /etc/ssh/sshd_configarquivo:

KexAlgorithms [email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1

e reiniciei o ssh: systemctl restart ssh

conforme sugerido por esta postagem: https://stackoverflow.com/questions/26577494/aptana-sftp-key-exchange

Responder3

Como há muito o que percorrer na resposta de bigmandan, acho que faz sentido publicá-la aqui também para facilitar a localização.

Para Windows, esta é a solução. [3 de junho de 2015 15:27] Mike Hadrup Também testado no Windows 10 de 64 bits com MySQL Workbench 6.3.3.0 (592) msi e noinstall contra Debian 8 Jessie com OpenSSH 6.7

Você pode usar 7zip dehttp://www.7-zip.org/para o arquivo tar gizpped ecdsa-0.13.tar.gz.

Observação: os pacotes redistribuíveis do Visual C++ para Visual Studio 2013 são necessários no Windows 10 em:https://www.microsoft.com/en-us/download/details.aspx?id=40784

No OS X, copie as bibliotecas paramiko e ecdsa para: /Applications/MySQLWorkbench.app/Contents/Resources/libraries

Responder4

No Linux (e evitando TOTALMENTE o problema), achei mais simples/limpo criar manualmente meu próprio túnel ssh para o mysql-workbench usar:

ssh raiz@host -L 3307:localhost:3306

Isso cria um túnel ssh da porta local 3307 para a porta local 3306 do controle remoto.Então você acabou de configurar o mysql-workbench para se conectar ao localhost:3307.

informação relacionada