运行bundle更新时避免使用 RSA 密钥指纹



我正在使用Opscode chef进行基础设施管理和代码部署。但是我遇到了一个问题,每当我从配方运行捆绑安装时,它都会要求RSA密钥指纹并期望输入。但配方未能进一步继续。我需要在捆绑包安装或捆绑包更新期间删除此 RSA 指纹的一些方法。如何使用食谱/食谱删除它以部署 Ruby on rails 应用程序。

创建这些文件(其中<bundle_user>是将运行bundle命令或引用它的属性的用户):

### recipes/ssh_config.rb
directory "#{<bundle_user>}/.ssh" do
  mode 00755
  owner <bundle_user>
end
cookbook_file "#{bundle_user}/.ssh/config" do
  source "ssh_config"
  owner <bundle_user>
  mode 00644
end

### files/default/ssh_config
Host github.com
  StrictHostKeyChecking no

然后,在deploy资源运行之前,include_recipe "your_cookbook::ssh_config" .这将禁用 github.com 的 SSH 指纹验证。

请注意,这具有安全隐患(值得注意的是,它更容易遭受 MITM 攻击)。

最新更新