2019-12-24 17:04:03 +00:00
|
|
|
# sops
|
|
|
|
|
2024-05-19 10:09:24 +01:00
|
|
|
> SOPS (Secrets OPerationS): a simple and flexible tool for managing secrets.
|
2019-12-24 17:04:03 +00:00
|
|
|
> More information: <https://github.com/mozilla/sops>.
|
|
|
|
|
|
|
|
- Encrypt a file:
|
|
|
|
|
2024-05-19 10:09:24 +01:00
|
|
|
`sops -e {{path/to/file.json}} > {{path/to/file.enc.json}}`
|
2019-12-24 17:04:03 +00:00
|
|
|
|
2023-08-09 06:29:02 +01:00
|
|
|
- Decrypt a file to `stdout`:
|
2019-12-24 17:04:03 +00:00
|
|
|
|
2024-05-19 10:09:24 +01:00
|
|
|
`sops -d {{path/to/file.enc.json}}`
|
2019-12-24 17:04:03 +00:00
|
|
|
|
2024-05-19 10:09:24 +01:00
|
|
|
- Update the declared keys in a `sops` file:
|
2019-12-24 17:04:03 +00:00
|
|
|
|
2024-05-19 10:09:24 +01:00
|
|
|
`sops updatekeys {{path/to/file.enc.yaml}}`
|
|
|
|
|
|
|
|
- Rotate data keys for a `sops` file:
|
|
|
|
|
|
|
|
`sops -r {{path/to/file.enc.yaml}}`
|
2019-12-24 17:04:03 +00:00
|
|
|
|
|
|
|
- Change the extension of the file once encrypted:
|
|
|
|
|
2024-05-19 10:09:24 +01:00
|
|
|
`sops -d --input-type json {{path/to/file.enc.json}}`
|
2019-12-24 17:04:03 +00:00
|
|
|
|
|
|
|
- Extract keys by naming them, and array elements by numbering them:
|
|
|
|
|
2024-05-19 10:09:24 +01:00
|
|
|
`sops -d --extract '["an_array"][1]' {{path/to/file.enc.json}}`
|
2019-12-24 17:04:03 +00:00
|
|
|
|
2024-05-19 10:09:24 +01:00
|
|
|
- Show the difference between two `sops` files:
|
2019-12-24 17:04:03 +00:00
|
|
|
|
|
|
|
`diff <(sops -d {{path/to/secret1.enc.yaml}}) <(sops -d {{path/to/secret2.enc.yaml}})`
|