【发布时间】:2016-07-31 18:32:18
【问题描述】:
我正在使用带有厨房 (1.5.0) 和 vagrant (1.8.1) 的 Chef 来通过新服务器一致地管理用户。我的用户配方如下所示:
include_recipe "users"
group 'sudo'
password_secret = Chef::EncryptedDataBagItem.load_secret(node['enterprise_sp']['secret_file'])
jays_password = Chef::EncryptedDataBagItem.load('user_secrets','jgodse', password_secret)['password']
shadow_password = `openssl passwd -1 -salt xyz #{jays_password}`.strip
user 'jgodse' do
action :create
group 'sudo'
system true
shell '/bin/bash'
home '/home/jgodse'
manage_home true
password shadow_password #added to /etc/shadow when chef runs
end
未加密的数据包是我明文配置密码的地方。然后我用 knife 命令加密了数据包。
这可行,但这似乎是解决设置密码问题的一种非常肮脏的方法。我必须这样做,因为 user 块的 password 指令只需要影子密码,并且只能通过使用 openssl强>命令。
有没有更简洁的方法来获取影子密码,而无需使用生成密码的 openssl 命令?
【问题讨论】:
标签: vagrant chef-infra test-kitchen databags