我第一次尝试使用Capistrano将Rails 7应用部署到Vultr VPS。我遵循了GoRails.com上的**指南。**一切顺利,直到最后一步:使用Capistrano部署应用程序。我的设置如下:
- Ubuntu 22.04.2 LTS Jammy(客户端和服务器)
- Ruby 3.2.2 / Rails7.0.4.2
- rbenv 1.2.0-59-g0704e65
- Bundler版本2.4.10
- 卡皮斯特拉诺(3.17.2)
- capistrano-bundler(2.1.0)
- capistrano-passenger(0.2.1)
- capistrano-rails(1.6.2)
- capistrano-rbenv(2.2.0)
- net-ssh(7.1.0)
- openssl(默认值:3.1.0)
当运行cap production deploy
(ssh服务器配置文件中的 withHostKey /etc/ssh/ssh_host_ed25519_key
)时,我得到以下错误:
verify_host_key: :secure is deprecated, use :always
Thread:0x00007f169f27a710 /home/user/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/sshkit-1.21.4/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
/home/user/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/sshkit-1.21.4/lib/sshkit/runners/parallel.rb:15:in rescue in block (2 levels) in execute': Exception while executing as deploy@xx.xx.xx.xx: could not settle on host_key algorithm (SSHKit::Runner::ExecuteError)
Server host_key preferences: ssh-ed25519
Client host_key preferences: ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256,ssh-rsa-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512
from /home/user/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/sshkit-1.21.4/lib/sshkit/runners/parallel.rb:11:inblock (2 levels) in execute'
/home/user/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/net-ssh-7.1.0/lib/net/ssh/transport/algorithms.rb:410:in `negotiate': could not settle on host_key algorithm (Net::SSH::Exception)
Server host_key preferences: ssh-ed25519
Client host_key preferences: ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256,ssh-rsa-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512
...
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy@xx.xx.xx.xx: could not settle on host_key algorithm
Server host_key preferences: ssh-ed25519
Client host_key preferences: ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256,ssh-rsa-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512
如果服务器上没有HostKey变量,我会得到这个错误:
verify_host_key: :secure is deprecated, use :always
Thread:0x00007f0d3c68a6c8 /home/user/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/sshkit-1.21.4/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
/home/user/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/sshkit-1.21.4/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as deploy@xx.xx.xx.xx: fingerprint SHA256:6EF6B30F9E557F948C402C89002C7C8A is unknown for "xx.xx.xx.xx" (SSHKit::Runner::ExecuteError)
...
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy@xx.xx.xx.xx: fingerprint SHA256:6EF6B30F9E557F948C402C89002C7C8A is unknown for "xx.xx.xx.xx"
Caused by:
Net::SSH::HostKeyUnknown: fingerprint SHA256:6EF6B30F9E557F948C402C89002C7C8A is unknown for "xx.xx.xx.xx"
Tasks: TOP => rbenv:validate
(See full trace by running task with --trace)
我可以在服务器中使用无密码的ssh,没有问题,所以PubKey身份验证似乎工作得很好。
有人知道如何解决这个问题吗?非常感谢任何帮助。
我已经尝试了许多类似的发声错误的建议张贴在这里和其他地方,包括:
1.删除客户端上的known_hosts并将服务器指纹添加到新的known_hosts文件中。
1.将PubkeyAcceptedKeyTypes=+ ed 25519添加到服务器的ssh配置文件(建议here)
1.将客户端和服务器上的所有私钥和公钥更改为使用ed 25519
1.关闭deploy.rb中ssh_options中的verify_host_key设置
1条答案
按热度按时间g0czyy6m1#
主机密钥
ssh-ed25519|需要gem
ed25519
您需要安装两个额外的依赖项以支持
ssh-ed25579
: