0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

古いcapistranoで Net::SSH::Exception: could not settle on host_key algorithm

Posted at

古い環境のrailsアプリをcapistranoでビルドしようとしたところ、以下のエラーになった。

cap aborted!
Net::SSH::Exception: could not settle on host_key algorithm

おそらくopensslがデフォルトでRSAをサポートしなくなったことが原因。単純なSSH接続の場合はこの方法で解決できました。
今回はどうやらcapistranoが使っているnet-sshが古すぎて +ssh-rsa という記法を理解できなくて、+ssh-rsa を追記してもcapistranoが失敗してしまうという状況。

以下のように対応するアルゴリズムをすべて列挙し解決しました。
本来ならサーバーの公開鍵を差し替えるのが正しいと思いますが、とりあえずワークアラウンドとして。

Host * 
   #PubkeyAcceptedKeyTypes=+ssh-rsa 
   #HostKeyAlgorithms=+ssh-rsa 
+ # +記法に対応していない古いruby net-sshのため 
+ HostkeyAlgorithms=ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521 
+ # +記法に対応していない古いruby net-sshのため 
+ keyAcceptedKeyTypes=ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521 
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?