简体   繁体   English

使用配方下载厨师库文件

[英]Downloading chef vault file using recipe

I have a chef vault item storing a private key which I have created using 我有一个厨师保管库项目,其中存储了我使用创建的私钥

knife vault create keys private --file user.pem

I can query this using 我可以使用查询

knife vaullt show keys private

In one of my recipe I want to download this file on the client. 在我的食谱之一中,我想在客户端上下载此文件。 I saw this method to load the vault items but this would not download the file as is. 我看到了此方法来加载保管库项目,但这不会按原样下载文件。

vault_item = ChefVault::Item.load(vaultname, itemname)

How can I download user.pem in a specified location on my node? 如何在节点上的指定位置下载user.pem? Basically I am looking for recipe equivalent of knife vault download VAULT ITEM /path/to/file command on workstation.I probably would have load it in a variable and then write in a file using a ruby library but not sure if that is a good way to handle .pem files. 基本上我正在寻找相当于knife vault download VAULT ITEM /path/to/file配方,在工作站上knife vault download VAULT ITEM /path/to/file命令。我可能会将其加载到变量中,然后使用ruby库写入文件中,但不确定这是否是一个好方法.pem文件的处理方式。 I also have .crt file which I have to store and download from vault. 我也有.crt文件,必须从Vault中存储和下载。

该文件最终在Vault项目中以base64编码的blob结尾,您可以使用file资源将其写入磁盘并设置权限和所有爵士乐。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM