【问题标题】:Chef on Vagrant Box: Can't find encrypted data bag secretVagrant Box 上的厨师:找不到加密的数据包秘密
【发布时间】:2013-01-30 14:09:33
【问题描述】:

使用 (hosted-)chef 配置 vagrant box 时,出现以下错误:

No such file or directory - file not found '/tmp/encrypted_data_bag_secret'

这是导致错误的调用:

ssl = Chef::EncryptedDataBagItem.load("ssl", s[:id])

我也无法在/etc/chef 中找到它通常驻留在我的其他服务器上的encrypted_data_bag_secret

我是否缺少上传数据包机密的配置?

这是堆栈跟踪的其余部分:

[2013-02-14T16:51:15+00:00] ERROR: Running exception handlers
[2013-02-14T16:51:15+00:00] FATAL: Saving node information to /srv/chef/file_store/failed-run-data.json
[2013-02-14T16:51:15+00:00] ERROR: Exception handlers complete
[2013-02-14T16:51:15+00:00] FATAL: Stacktrace dumped to /srv/chef/file_store/chef-stacktrace.out
[2013-02-14T16:51:15+00:00] FATAL: Errno::ENOENT: No such file or directory - file not found '/tmp/encrypted_data_bag_secret'

【问题讨论】:

    标签: chef-infra vagrant


    【解决方案1】:

    在配置 vagrant box 时,如果您想使用加密的数据包,则必须提供数据包密钥的路径。

    config.vm.provision :chef_solo do |chef|
      [...]
      chef.encrypted_data_bag_secret_key_path = '/etc/chef/encrypted_data_bag_secret'
      [...]
    end
    

    【讨论】:

    • 好人!我在任何地方都找不到这条信息。这很奇怪,因为在knife.rb 文件中,该设置被称为“encrypted_data_bag_secret_key”。谢谢!
    • 请注意,您必须在本地计算机上为 chef.encrypted_data_bag_secret_key_path 提供路径。然后它将密钥放入 chef.encrypted_data_bag_secret,默认为“/etc/chef/encrypted_data_bag”。
    • 我在下面添加了对 Thomas 评论的更新作为单独的答案。
    【解决方案2】:

    快速修改 Thomas Obermüller 对上述 Draco Ater 回答的回应。在 Vagrant 1.5.1 到 Vagrant 1.6.5(可能早于 1.5.1;我没有尝试过)中,有一些变化:

    1. chef.encrypted_data_bag_secret 已弃用,设置它无效。
    2. Vagrant 将加密密钥放在 /tmp/vagrant-chef-2/encrypted_data_bag_secret_key,而不是像最初那样默认为 /etc/chef/encrypted_data_bag_secret

    【讨论】:

    • 总是 vagrant-chef-2 吗?在我第一次运行时,它把它放在 vagrant-chef-1。
    • 那么你可能正在使用 Vagrant 1?
    • 看起来我在1.6.5。但它也告诉我最新版本是1.7.1。很奇怪。
    猜你喜欢
    • 1970-01-01
    • 2015-03-30
    • 1970-01-01
    • 1970-01-01
    • 2018-01-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多