所以我们的代码看起来像这样:
template my_template do
#stuff
variables({"password": data_bag["password"]})
end
这段代码一切都很好,直到后来,模板都失败了。如果是这样,它会转储指向erb模板的所有内容,包括密码。这些数据会以纯文本自动记录,稍后会被其他一些脚本自动梳理,这自然会让我感到不舒服。
除非一直在编写完美的代码,否则有什么方法可以阻止这种行为?
答案 0 :(得分:1)
使用新的sensitive
属性。来自docs:
sensitive - Use to ensure that sensitive resource data is not logged by the chef-client. Default value: false. This setting only applies to the execute, file and template resources
这样的事情:
template my_template do
#stuff
variables({"password": data_bag["password"]})
sensitive true
end
这是一个新的厨师12功能,我还没有使用它。所以我不能保证它会解决你的问题,但是文档建议它会解决。