sqlectron / sqlectron-gui

A simple and lightweight SQL client desktop with cross database and platform support.
https://sqlectron.github.io/
MIT License
4.57k stars 524 forks source link

Tunnel SSH with passphrase seems not working at first try #282

Closed tyx closed 7 years ago

tyx commented 7 years ago

Hello !

I'm giving a try to your app. Looks great but I had difficulties to connect to my prod db through SSH.

DB : Mysql Sqlectron : 1.19 OS : Ubuntu 16.04

I got this error :

In fact I was unabled to check the passphrase checkbox until I save my connection and edit it again.

Then I click on connect, sqlectron ask my for my passphrase and then I get a black window with loader "Connecting to database" but I go back to "servers" view with no more info except a message in status bar "Connection to database established"... looks it works but I don't see anything. Please note that after that clicking on "Connect" doesn't do anything.

Here are the logs from console dev tools I got if it could help

internal/process/warning.js:24 (node:21294) Warning: Possible EventEmitter memory leak detected. 11 sqlectron:update-available listeners added. Use emitter.setMaxListeners() to increase limitprocess.on @ internal/process/warning.js:24 query-browser.jsx?7d85:595 Uncaught TypeError: Cannot read property 'name' of null

Thanks

maxcnunes commented 7 years ago

Fixed the problem on saving the passphrase checkbox. The problem in the connection I need a bit more time to investigate that since I need to prepare a VM to test that.

tyx commented 7 years ago

Thanks !

Let me know if I can help you by testing anything

maxcnunes commented 7 years ago

Could you check if with the password saved is possible to connect?

tyx commented 7 years ago

Yes I already try. The passphrase and the mysql password are right !

pyrech commented 7 years ago

I'm getting the same issue since a few weeks. After filling the passphrase and clicking enter, the connection seems to work as I briefly get the right display of my remote server (with its databases listing and the textarea to write query). But straight after (in less than a second, I needed to make a screenshot to visualize this interface ^^) I'm getting back to the server listing.

DB : Mysql Sqlectron : 1.19 OS : Ubuntu 15.10

If I remember correctly, it worked in 1.17 and broke in 1.18. Hope this helps.

maxcnunes commented 7 years ago

I could reproduce the error. I will try get this fixed in the weekend.

tyx commented 7 years ago

Hi,

Unfortunately it still doesn't work. Here is the action I have in the console:

configure.js?1008:27  action @ 14:12:54.133 CONNECTION_REQUEST
configure.js?1008:27  action @ 14:12:54.143 CONNECTION_REQUIRE_SSH_PASSWORD
configure.js?1008:27  action @ 14:12:59.836 CONNECTION_REQUEST
configure.js?1008:27  action @ 14:13:00.329 CONNECTION_SUCCESS
configure.js?1008:27  action @ 14:13:00.329 FETCH_DATABASES_REQUEST
configure.js?1008:27  action @ 14:13:00.346 FETCH_SCHEMAS_REQUEST
configure.js?1008:27  action @ 14:13:00.356 FETCH_TABLES_REQUEST
configure.js?1008:27  action @ 14:13:00.374 FETCH_VIEWS_REQUEST
configure.js?1008:27  action @ 14:13:00.385 FETCH_ROUTINES_REQUEST
configure.js?1008:27  action @ 14:13:00.481 FETCH_DATABASES_SUCCESS
configure.js?1008:27  action @ 14:13:00.515 FETCH_SCHEMAS_SUCCESS
configure.js?1008:27  action @ 14:13:00.547 CLOSE_CONNECTION
configure.js?1008:27  action @ 14:13:00.832 FETCH_TABLES_FAILURE
configure.js?1008:27  action @ 14:13:00.840 FETCH_VIEWS_FAILURE
configure.js?1008:27  action @ 14:13:00.846 FETCH_ROUTINES_FAILURE

I guess the CLOSE_CONNECTION in the middle is the problem. I'm still available to help on this issue to test anything you need.

maxcnunes commented 7 years ago

These are the problem

configure.js?1008:27  action @ 14:13:00.832 FETCH_TABLES_FAILURE
configure.js?1008:27  action @ 14:13:00.840 FETCH_VIEWS_FAILURE
configure.js?1008:27  action @ 14:13:00.846 FETCH_ROUTINES_FAILURE

Could you send the ~/.sqlectron.log? Or at least open those *_FAILURE messages: screen shot 2017-01-27 at 11 28 44

tyx commented 7 years ago

Here is the sqlectron.json with sensitive data removed

{
  "servers": [
    {
      "id": "8e6edc3e-3e1a-44d3-8b64-d5b0587e4e7c",
      "name": "tvlr prod",
      "client": "mysql",
      "ssl": false,
      "host": "XX.XX.XX.XX",
      "port": 3306,
      "socketPath": null,
      "user": "user",
      "password": "mypassword",
      "database": "tvlr",
      "schema": null,
      "ssh": {
        "host": "my.host.net",
        "port": 22,
        "user": "myuser",
        "password": null,
        "privateKey": "/home/tyx/.ssh/id_rsa",
        "privateKeyWithPassphrase": true
      }
    }
  ]
}

but I did not succeed in retrieving failure action again. I have now only:

action @ 14:38:35.705 CONNECTION_REQUEST
(program):44  action @ 14:38:35.706 CONNECTION_REQUIRE_SSH_PASSWORD
configure.js?1008:27  action @ 14:38:47.248 CONNECTION_REQUEST
configure.js?1008:27  action @ 14:38:47.919 CLOSE_CONNECTION
configure.js?1008:27  action @ 14:38:48.005 CONNECTION_SUCCESS

I'm keep trying to get back the initial log

maxcnunes commented 7 years ago

Sorry, I said ~/.sqlectron.json but I meant ~/.sqlectron.log 😆

tyx commented 7 years ago

I have no sqlectron.log anywhere on my disk

maxcnunes commented 7 years ago

You need to enable the logging to file in your ~/.sqlectron.json

  "log": {
    "console": true,
    "file": true,
    "level": "debug"
  },

https://github.com/sqlectron/sqlectron-gui/blob/master/docs/app/logging.md

tyx commented 7 years ago

Ok I get it back !

Here is the failure error

Error: Pool is closed.
    at Handshake.onConnect (/opt/Sqlectron/resources/app.asar/node_modules/mysql/lib/Pool.js:52:15)
    at Handshake.Sequence.end (/opt/Sqlectron/resources/app.asar/node_modules/mysql/lib/protocol/sequences/Sequence.js:86:24)
    at Handshake.Sequence.OkPacket (/opt/Sqlectron/resources/app.asar/node_modules/mysql/lib/protocol/sequences/Sequence.js:95:8)
    at Protocol._parsePacket (/opt/Sqlectron/resources/app.asar/node_modules/mysql/lib/protocol/Protocol.js:280:23)
    at Parser.write (/opt/Sqlectron/resources/app.asar/node_modules/mysql/lib/protocol/Parser.js:74:12)
    at Protocol.write (/opt/Sqlectron/resources/app.asar/node_modules/mysql/lib/protocol/Protocol.js:39:16)
    at Socket.<anonymous> (/opt/Sqlectron/resources/app.asar/node_modules/mysql/lib/Connection.js:109:28)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)

I will activate the log

tyx commented 7 years ago

Here is the complete log from sqlectron.log

{"app":"sqlectron-gui","name":"sqlectron-gui","hostname":"ubuntyx","pid":7174,"namespace":"sqlectron-core:db:tunnel","level":20,"msg":"creating ssh tunnel client","time":"2017-01-27T13:55:51.587Z","v":0}
{"app":"sqlectron-gui","name":"sqlectron-gui","hostname":"ubuntyx","pid":7174,"namespace":"sqlectron-core:db:tunnel","level":20,"msg":"connecting ssh tunnel client","time":"2017-01-27T13:55:51.593Z","v":0}
{"app":"sqlectron-gui","name":"sqlectron-gui","hostname":"ubuntyx","pid":7174,"namespace":"sqlectron-core:db:tunnel","level":20,"msg":"connected ssh tunnel client","time":"2017-01-27T13:55:51.879Z","v":0}
{"app":"sqlectron-gui","name":"sqlectron-gui","hostname":"ubuntyx","pid":7174,"namespace":"sqlectron-core:db:tunnel","level":20,"msg":"forwarding ssh tunnel client output","time":"2017-01-27T13:55:51.880Z","v":0}
{"app":"sqlectron-gui","name":"sqlectron-gui","hostname":"ubuntyx","pid":7174,"namespace":"sqlectron-core:db:tunnel","level":20,"msg":"creating ssh tunnel client","time":"2017-01-27T13:55:52.158Z","v":0}
{"app":"sqlectron-gui","name":"sqlectron-gui","hostname":"ubuntyx","pid":7174,"namespace":"sqlectron-core:db:tunnel","level":20,"msg":"connecting ssh tunnel client","time":"2017-01-27T13:55:52.161Z","v":0}
{"app":"sqlectron-gui","name":"sqlectron-gui","hostname":"ubuntyx","pid":7174,"namespace":"sqlectron-core:db:tunnel","level":20,"msg":"creating ssh tunnel client","time":"2017-01-27T13:55:52.170Z","v":0}
{"app":"sqlectron-gui","name":"sqlectron-gui","hostname":"ubuntyx","pid":7174,"namespace":"sqlectron-core:db:tunnel","level":20,"msg":"connecting ssh tunnel client","time":"2017-01-27T13:55:52.173Z","v":0}
{"app":"sqlectron-gui","name":"sqlectron-gui","hostname":"ubuntyx","pid":7174,"namespace":"sqlectron-core:db:tunnel","level":20,"msg":"creating ssh tunnel client","time":"2017-01-27T13:55:52.185Z","v":0}
{"app":"sqlectron-gui","name":"sqlectron-gui","hostname":"ubuntyx","pid":7174,"namespace":"sqlectron-core:db:tunnel","level":20,"msg":"connecting ssh tunnel client","time":"2017-01-27T13:55:52.187Z","v":0}
{"app":"sqlectron-gui","name":"sqlectron-gui","hostname":"ubuntyx","pid":7174,"namespace":"sqlectron-core:db:tunnel","level":20,"msg":"connected ssh tunnel client","time":"2017-01-27T13:55:52.448Z","v":0}
{"app":"sqlectron-gui","name":"sqlectron-gui","hostname":"ubuntyx","pid":7174,"namespace":"sqlectron-core:db:tunnel","level":20,"msg":"forwarding ssh tunnel client output","time":"2017-01-27T13:55:52.449Z","v":0}
{"app":"sqlectron-gui","name":"sqlectron-gui","hostname":"ubuntyx","pid":7174,"namespace":"sqlectron-core:db:tunnel","level":20,"msg":"connected ssh tunnel client","time":"2017-01-27T13:55:52.458Z","v":0}
{"app":"sqlectron-gui","name":"sqlectron-gui","hostname":"ubuntyx","pid":7174,"namespace":"sqlectron-core:db:tunnel","level":20,"msg":"forwarding ssh tunnel client output","time":"2017-01-27T13:55:52.459Z","v":0}
{"app":"sqlectron-gui","name":"sqlectron-gui","hostname":"ubuntyx","pid":7174,"namespace":"sqlectron-core:db:tunnel","level":20,"msg":"connected ssh tunnel client","time":"2017-01-27T13:55:52.481Z","v":0}
{"app":"sqlectron-gui","name":"sqlectron-gui","hostname":"ubuntyx","pid":7174,"namespace":"sqlectron-core:db:tunnel","level":20,"msg":"forwarding ssh tunnel client output","time":"2017-01-27T13:55:52.481Z","v":0}
{"app":"sqlectron-gui","name":"sqlectron-gui","hostname":"ubuntyx","pid":7174,"namespace":"renderer:redux","level":50,"msg":"Error Error {\n  message: 'Pool is closed.',\n  code: 'POOL_CLOSED',\n  name: 'Error' }","time":"2017-01-27T13:55:52.596Z","v":0}
{"app":"sqlectron-gui","name":"sqlectron-gui","hostname":"ubuntyx","pid":7174,"namespace":"renderer:redux","level":50,"msg":"Error Stack Error: Pool is closed.\n    at Handshake.onConnect (/opt/Sqlectron/resources/app.asar/node_modules/mysql/lib/Pool.js:52:15)\n    at Handshake.Sequence.end (/opt/Sqlectron/resources/app.asar/node_modules/mysql/lib/protocol/sequences/Sequence.js:86:24)\n    at Handshake.Sequence.OkPacket (/opt/Sqlectron/resources/app.asar/node_modules/mysql/lib/protocol/sequences/Sequence.js:95:8)\n    at Protocol._parsePacket (/opt/Sqlectron/resources/app.asar/node_modules/mysql/lib/protocol/Protocol.js:280:23)\n    at Parser.write (/opt/Sqlectron/resources/app.asar/node_modules/mysql/lib/protocol/Parser.js:74:12)\n    at Protocol.write (/opt/Sqlectron/resources/app.asar/node_modules/mysql/lib/protocol/Protocol.js:39:16)\n    at Socket.<anonymous> (/opt/Sqlectron/resources/app.asar/node_modules/mysql/lib/Connection.js:109:28)\n    at emitOne (events.js:96:13)\n    at Socket.emit (events.js:188:7)\n    at readableAddChunk (_stream_readable.js:176:18)","time":"2017-01-27T13:55:52.597Z","v":0}
{"app":"sqlectron-gui","name":"sqlectron-gui","hostname":"ubuntyx","pid":7174,"namespace":"renderer:redux","level":50,"msg":"Error Error {\n  message: 'Pool is closed.',\n  code: 'POOL_CLOSED',\n  name: 'Error' }","time":"2017-01-27T13:55:52.603Z","v":0}
{"app":"sqlectron-gui","name":"sqlectron-gui","hostname":"ubuntyx","pid":7174,"namespace":"renderer:redux","level":50,"msg":"Error Stack Error: Pool is closed.\n    at Handshake.onConnect (/opt/Sqlectron/resources/app.asar/node_modules/mysql/lib/Pool.js:52:15)\n    at Handshake.Sequence.end (/opt/Sqlectron/resources/app.asar/node_modules/mysql/lib/protocol/sequences/Sequence.js:86:24)\n    at Handshake.Sequence.OkPacket (/opt/Sqlectron/resources/app.asar/node_modules/mysql/lib/protocol/sequences/Sequence.js:95:8)\n    at Protocol._parsePacket (/opt/Sqlectron/resources/app.asar/node_modules/mysql/lib/protocol/Protocol.js:280:23)\n    at Parser.write (/opt/Sqlectron/resources/app.asar/node_modules/mysql/lib/protocol/Parser.js:74:12)\n    at Protocol.write (/opt/Sqlectron/resources/app.asar/node_modules/mysql/lib/protocol/Protocol.js:39:16)\n    at Socket.<anonymous> (/opt/Sqlectron/resources/app.asar/node_modules/mysql/lib/Connection.js:109:28)\n    at emitOne (events.js:96:13)\n    at Socket.emit (events.js:188:7)\n    at readableAddChunk (_stream_readable.js:176:18)","time":"2017-01-27T13:55:52.604Z","v":0}
{"app":"sqlectron-gui","name":"sqlectron-gui","hostname":"ubuntyx","pid":7174,"namespace":"renderer:redux","level":50,"msg":"Error Error {\n  message: 'Pool is closed.',\n  code: 'POOL_CLOSED',\n  name: 'Error' }","time":"2017-01-27T13:55:52.634Z","v":0}
{"app":"sqlectron-gui","name":"sqlectron-gui","hostname":"ubuntyx","pid":7174,"namespace":"renderer:redux","level":50,"msg":"Error Stack Error: Pool is closed.\n    at Handshake.onConnect (/opt/Sqlectron/resources/app.asar/node_modules/mysql/lib/Pool.js:52:15)\n    at Handshake.Sequence.end (/opt/Sqlectron/resources/app.asar/node_modules/mysql/lib/protocol/sequences/Sequence.js:86:24)\n    at Handshake.Sequence.OkPacket (/opt/Sqlectron/resources/app.asar/node_modules/mysql/lib/protocol/sequences/Sequence.js:95:8)\n    at Protocol._parsePacket (/opt/Sqlectron/resources/app.asar/node_modules/mysql/lib/protocol/Protocol.js:280:23)\n    at Parser.write (/opt/Sqlectron/resources/app.asar/node_modules/mysql/lib/protocol/Parser.js:74:12)\n    at Protocol.write (/opt/Sqlectron/resources/app.asar/node_modules/mysql/lib/protocol/Protocol.js:39:16)\n    at Socket.<anonymous> (/opt/Sqlectron/resources/app.asar/node_modules/mysql/lib/Connection.js:109:28)\n    at emitOne (events.js:96:13)\n    at Socket.emit (events.js:188:7)\n    at readableAddChunk (_stream_readable.js:176:18)","time":"2017-01-27T13:55:52.637Z","v":0}
{"app":"sqlectron-gui","name":"sqlectron-gui","hostname":"ubuntyx","pid":7174,"namespace":"sqlectron-core:db:tunnel","level":20,"msg":"close ssh tunnel server","time":"2017-01-27T13:55:52.669Z","v":0}
maxcnunes commented 7 years ago

@tyx Releasing a fix for that. Let me know if that solves your problem.

tyx commented 7 years ago

Thank you for your quick support ! It works now ;)