Files
tldr/pages.zh/common/sops.md

32 lines
811 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# sops
> SOPS秘密操作一个简单灵活的管理秘密的工具。
> 更多信息:<https://github.com/mozilla/sops>。
- 加密文件:
`sops -e {{path/to/file.json}} > {{path/to/file.enc.json}}`
- 解密文件到标准输出:
`sops -d {{path/to/file.enc.json}}`
- 更新 `sops` 文件中声明的密钥:
`sops updatekeys {{path/to/file.enc.yaml}}`
- 旋转 `sops` 文件的数据密钥:
`sops -r {{path/to/file.enc.yaml}}`
- 加密后更改文件的扩展名:
`sops -d --input-type json {{path/to/file.enc.json}}`
- 按名称提取密钥,并按编号提取数组元素:
`sops -d --extract '["an_array"][1]' {{path/to/file.enc.json}}`
- 显示两个 `sops` 文件之间的差异:
`diff <(sops -d {{path/to/secret1.enc.yaml}}) <(sops -d {{path/to/secret2.enc.yaml}})`