不以明文形式记录密码而失败
Fail without logging passwords in plain text
所以我们的代码看起来像这样:
template my_template do
#stuff
variables({"password": data_bag["password"]})
end
这段代码一切都很好,直到后来,模板失败了。当它这样做时,它会转储指向 erb 模板的所有内容,包括密码。这些数据自动以纯文本形式记录,稍后由其他一些脚本自动梳理,这自然让我感到不舒服。
除非一直写出完美的代码,有什么办法可以防止这种行为?
使用新的 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
这是 Chef 12 的新功能,我还没有使用过。所以我不能保证它会解决你的问题,但文档表明它会。
所以我们的代码看起来像这样:
template my_template do
#stuff
variables({"password": data_bag["password"]})
end
这段代码一切都很好,直到后来,模板失败了。当它这样做时,它会转储指向 erb 模板的所有内容,包括密码。这些数据自动以纯文本形式记录,稍后由其他一些脚本自动梳理,这自然让我感到不舒服。
除非一直写出完美的代码,有什么办法可以防止这种行为?
使用新的 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
这是 Chef 12 的新功能,我还没有使用过。所以我不能保证它会解决你的问题,但文档表明它会。