使用Debian Jessie的MySQL Workbench-SSH上的TCP / IP不起作用


10

我曾经使用“ TCP / IP over SSH”将Windows 7 Pro x64与MySQL Workbench客户端上使用Debian Wheezy托管的MySQL服务器连接,但是在Debian Jessie上的新服务器上却无法使用,为什么?


MySQL Workbench配置:

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

我仔细检查了IP地址/主机名,用户名和密码...


Debian Wheezy服务器配置:

root @ debian:〜#猫/ etc / debian_version

7.8

mysql>选择版本();

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

root @ debian:〜#猫/ 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

Debian Jessie服务器配置:

root @ debian:〜#猫/ etc / debian_version

8.0

mysql>选择版本();

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

root @ debian:〜#猫/ 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

所以人的区别是ServerKeyBits两个sshd_config文件之间的区别...


当我尝试连接到Debian Jessie服务器时,错误MySQL Workbench 6.3.3给了我:

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

日志文件:

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

更多信息:

文件夹“ ssh”不存在于:

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

两台服务器上的防火墙规则:

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

我可以在两台服务器上都使用SSH(KiTTY)连接...


我尝试了两种不同版本的MySQL Workbench:

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

这两个版本适用于Debian Wheezy,但不适用于Debian Jessie。 我想念什么?

Answers:


10

根据https://bugs.mysql.com/bug.php?id=74658,当使用opensh 6.7和MySql工作台附带的python库时,该问题就会出现。在将“ KexAlgorithms”添加到sshd配置时,您可以更新MySql Workbench随附的python库。如果您无法控制sshd配置,这可能会很方便...

如果您在错误报告中向下滚动,则有下载和复制paramiko和ecdsa库的说明。


3
+1。这是正确的答案。更改sshd中允许的密钥交换算法可能会影响安全性,因此不应这样做。按照此答案中的建议更新客户端库的侵入性较小,并提高了ssh隧道的安全性。
克里斯蒂安·鲁道夫,

使用Workbench 6.2和Debian Jessie遇到相同的问题。我的Workbench 6.2 CE告诉我,它是“帮助”->“检查更新”中的最新版本。真是个谎言...从dev.mysql.com/downloads/workbench下载了6.3版,一切工作都像个魅力。
Martin Seitl '16

9

我找到了解决方案。

我将此行添加到我的/etc/ssh/sshd_config文件中:

KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1

并重新启动ssh: systemctl restart ssh

如这篇文章所建议的那样:https : //stackoverflow.com/questions/26577494/aptana-sftp-key-exchange


7
这当然允许访问,但是我仍然对这样做是正确的感到疲倦。列出了很多算法,MySQL Workbench需要任何想法吗?
pcnate

0

由于bigmandan的答案有很多可供浏览的地方,因此我认为也可以将其张贴在此处以使其更容易找到。

对于Windows,这是修复程序。[2015年6月3日15:27] Mike Hadrup还在Windows 10 64 bit和MySQL Workbench 6.3.3.0(592)msi上进行了测试,并在OpenSSH 6.7下针对Debian 8 Jessie进行了noinstall测试

您可以将http://www.7-zip.org/中的7zip 用于ecdsa-0.13.tar.gz gizpped tar存档。

注意:Windows 10上需要Visual Studio 2013的Visual C ++可再发行组件包,网址为:https : //www.microsoft.com/zh-cn/download/details.aspx?id=40784

在OS X上,将paramiko和ecdsa库复制到:/Applications/MySQLWorkbench.app/Contents/Resources/libraries


0

因为有两种方法可以连接到mysql。当您安装mysql的时间,然后它询问您要使用哪种方式,第一个是unix sock,它非常有用,可以为您提供良好的性能,第二个是TCP / ip,请检查特权,您可以连接到您的数据库远程只是使用了一些其他的ip(如果没有),然后启用了mysql中的安全功能


1
MySQL的Unix套接字接口只能由同一台计算机上的客户端使用;这个问题是关于另一台必须使用TCP / IP(以及可选地,如问题SSH)的计算机上的客户端的。
dave_thompson_085 '16

0

在linux中(并且完全避开了这个问题),我发现手动创建自己的ssh隧道以使mysql-workbench可以更简单/更干净地使用:

ssh root @ host -L 3307:localhost:3306

这将创建一个从本地端口3307到远程本地端口3306的ssh隧道。因此,您只需将mysql-workbench配置为连接到localhost:3307

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.