Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to deploy Rails App to DigitalOcean because of unsupported key type

I have configured the droplet in DO and nginx is up and running successfully. I followed the guide on DO on deploying to server via Capistrano. I can ssh into the server without entering my password. But on running bundle exec cap production deploy:initial I'm getting a very weird error:

cap aborted! NotImplementedError: unsupported key type�pl+�lI���D�����U����X��K\�L�[�\� �M�\� �M�A?d��h"sU�Ǐ�2�?h��a 5G͕�E���%!Cg��j�|��tu�yL*�'/9�s۷'

I'm using rsa SSH key and this has been working with many (>10) servers seamlessly. I tried to remove the ssh_options param from my deploy/production.rb file. This should ask for the server password before (I guess?). But I get the same error, leading me to suspect that something else is tripping me up.

Gem Versions:

net-ssh (3.2.0) capistrano (3.6.0) sshkit (1.11.2)

like image 259
tekina Avatar asked Aug 15 '16 11:08

tekina


1 Answers

I believe you have stumbled across a bug in sshkit. Recent versions of sshkit have a custom SSH key-loading and caching mechanism aimed at improving connection performance.

However it seems that the custom implementation is not as bulletproof as the default net-ssh implementation that it replaces. Specifically, net-ssh will silently ignore keys that it doesn't support. The sshkit custom key-loader does not do this, so it blows up with the unsupported key type error you are seeing.

If my theory is correct, then you should be able to fix your issue by turning off sshkit's custom key-loader and forcing the original net-ssh implementation to be used. You can do this by adding the following to your deploy.rb:

set :ssh_options, known_hosts: Net::SSH::KnownHosts
like image 175
Matt Brictson Avatar answered Oct 19 '22 09:10

Matt Brictson