jeromelebel/MongoHub-Mac

SSH with public key not working

nrbrook opened this issue · 12 comments

Even if I specify the public key to use, MongoHub gives a "Wrong password" error.

If I look in the console I see:

02/10/2013 11:26:46.379 MongoHub[27151]: /usr/bin/ssh -L 40005:localhost:27017 -v -N -o ConnectTimeout=28 -o NumberOfPasswordPrompts=1 -o ConnectionAttempts=1 -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=no -o ServerAliveInterval=30 -o ServerAliveCountMax=3 -o TCPKeepAlive=yes -C -p 1234 -l nick redacted.website -i /Users/nick/.ssh/id_rsa.pub

02/10/2013 11:26:47.033 MongoHub[27151]: SSH TUNNEL ERROR: Error Domain=MHTunnelDomain Code=6 "Wrong password" UserInfo=0x108746660 {NSLocalizedDescription=Wrong password}

If I run the command it logged directly in terminal it does open the tunnel and then I can connect to Mongo on localhost:40005

I traced this down to the private key having a passphrase. Removing the passphrase with ssh-keygen -p allows MongoHub to connect.

Mongohub should instead prompt the user for the passphrase or...however it is doing it currently...isn't using ssh-agent to provide the passphrase

Thanks for finding about the passphrase. I looked into that problem. I can reproduce it, but I have no clue how to fix it. One work around is to create a second ssh key without a passphrase. But I guess you already think about that, and you won't like it...
So unfortunately, I don't think I will be able to fix it anytime soon.

I think I didn't test it correctly. Did you try to put your passphrase into the password field in MongoHub? It seems to work for me.

Ah yeah that seems to work, maybe just make it clearer that the box can be used for password and SSH key passphrase... thanks

It would be nice to use the ssh-agent though (if there is no password in the UI)... But I don't understand why it is not used when mongohub launch the ssh process.

Me neither! This really confused us in the office...

I found the way to use the ssh-agent when mongohub starts the ssh process. This bug will be fixed exactly the way it is supposed to be in the next update (you won't need to enter the passphrase in mongohub).

[master fa5cd58] don't try to give a password if the user didn't provide any, and we need to use the ssh-agent #93

nice, well done!

Thanks for your help, it would have been a nightmare to find why it was not working for you!

Fixed in 2.5.14, I let you close this issue after testing this new release.

(oups, already closed)