@@ -96,12 +96,12 @@ separated, in the **SOPS_PGP_FP** env variable.
96
96
97
97
Note: you can use both PGP and KMS simultaneously.
98
98
99
- Then simply call ``sops `` with a file path as argument. It will handle the
99
+ Then simply call ``sops edit `` with a file path as argument. It will handle the
100
100
encryption/decryption transparently and open the cleartext file in an editor
101
101
102
102
.. code :: sh
103
103
104
- $ sops mynewtestfile.yaml
104
+ $ sops edit mynewtestfile.yaml
105
105
mynewtestfile.yaml doesn' t exist, creating it.
106
106
please wait while an encryption key is being generated and stored in a secure fashion
107
107
file written to mynewtestfile.yaml
@@ -164,7 +164,7 @@ Given that, the only command a SOPS user needs is:
164
164
165
165
.. code :: sh
166
166
167
- $ sops < file>
167
+ $ sops edit < file>
168
168
169
169
`<file> ` will be opened, decrypted, passed to a text editor (vim by default),
170
170
encrypted if modified, and saved back to its original location. All of these
@@ -184,7 +184,7 @@ the example files and pgp key provided with the repository::
184
184
$ git clone https://github.com/getsops/sops.git
185
185
$ cd sops
186
186
$ gpg --import pgp/sops_functional_tests_key.asc
187
- $ sops example.yaml
187
+ $ sops edit example.yaml
188
188
189
189
This last step will decrypt ``example.yaml `` using the test private key.
190
190
@@ -480,35 +480,33 @@ separated list.
480
480
SOPS will prompt you with the changes to be made. This interactivity can be
481
481
disabled by supplying the ` ` -y` ` flag.
482
482
483
- Command Line
484
- ************
483
+ ` ` rotate ` ` command
484
+ ******************
485
485
486
- Command line flag ` ` --add-kms` ` , ` ` --add-pgp` ` , ` ` --add-gcp-kms` ` , ` ` --add-azure-kv` ` ,
487
- ` ` --rm-kms` ` , ` ` --rm-pgp` ` , ` ` --rm-gcp-kms` ` and ` ` --rm-azure-kv` ` can be used to add
488
- and remove keys from a file.
489
- These flags use the comma separated syntax as the ` ` --kms` ` , ` ` --pgp` ` , ` ` --gcp-kms` `
490
- and ` ` --azure-kv` ` arguments when creating new files.
486
+ The ` ` rotate` ` command generates a new data encryption key and reencrypt all values
487
+ with the new key. At te same time, the command line flag ` ` --add-kms` ` , ` ` --add-pgp` ` ,
488
+ ` ` --add-gcp-kms` ` , ` ` --add-azure-kv` ` , ` ` --rm-kms` ` , ` ` --rm-pgp` ` , ` ` --rm-gcp-kms` `
489
+ and ` ` --rm-azure-kv` ` can be used to add and remove keys from a file. These flags use
490
+ the comma separated syntax as the ` ` --kms` ` , ` ` --pgp` ` , ` ` --gcp-kms` ` and ` ` --azure-kv` `
491
+ arguments when creating new files.
491
492
492
- Note that ` ` -r` ` or ` ` --rotate` ` is mandatory in this mode. Not specifying
493
- rotate will ignore the ` ` --add-*` ` options. Use ` ` updatekeys` ` if you want to
494
- add a key without rotating the data key.
493
+ Use ` ` updatekeys` ` if you want to add a key without rotating the data key.
495
494
496
495
.. code:: sh
497
496
498
497
# add a new pgp key to the file and rotate the data key
499
- $ sops -r -i --add-pgp 85D77543B3D624B63CEA9E6DBC17301B491B3F21 example.yaml
498
+ $ sops rotate -i --add-pgp 85D77543B3D624B63CEA9E6DBC17301B491B3F21 example.yaml
500
499
501
500
# remove a pgp key from the file and rotate the data key
502
- $ sops -r -i --rm-pgp 85D77543B3D624B63CEA9E6DBC17301B491B3F21 example.yaml
501
+ $ sops rotate -i --rm-pgp 85D77543B3D624B63CEA9E6DBC17301B491B3F21 example.yaml
503
502
504
503
505
504
Direct Editing
506
505
**************
507
506
508
- Alternatively, invoking ` ` sops` ` with the flag **-s** will display the master keys
507
+ Alternatively, invoking ` ` sops edit ` ` with the flag **-s** will display the master keys
509
508
while editing. This method can be used to add or remove ` ` kms` ` or ` ` pgp` ` keys under the
510
- ` ` sops` ` section. Invoking ` ` sops` ` with the **-i** flag will perform an in-place edit
511
- instead of redirecting output to ` ` stdout` ` .
509
+ ` ` sops` ` section.
512
510
513
511
For example, to add a KMS master key to a file, add the following entry while
514
512
editing:
@@ -620,7 +618,7 @@ When creating a new file, you can specify the encryption context in the
620
618
621
619
.. code:: sh
622
620
623
- $ sops --encryption-context Environment:production,Role:web-server test.dev.yaml
621
+ $ sops edit --encryption-context Environment:production,Role:web-server test.dev.yaml
624
622
625
623
The format of the Encrypt Context string is ` ` <EncryptionContext Key>:<EncryptionContext Value>,<EncryptionContext Key>:<EncryptionContext Value>,...` `
626
624
@@ -651,13 +649,16 @@ Key Rotation
651
649
~~~~~~~~~~~~
652
650
653
651
It is recommended to renew the data key on a regular basis. ` ` sops` ` supports key
654
- rotation via the ` ` -r ` ` flag . Invoking it on an existing file causes ` ` sops` ` to
655
- reencrypt the file with a new data key, which is then encrypted with the various
652
+ rotation via the ` ` rotate ` ` command . Invoking it on an existing file causes ` ` sops` `
653
+ to reencrypt the file with a new data key, which is then encrypted with the various
656
654
KMS and PGP master keys defined in the file.
657
655
656
+ Add the ` ` -i` ` option to write the rotated file back, instead of printing it to
657
+ stdout.
658
+
658
659
.. code:: sh
659
660
660
- $ sops -r example.yaml
661
+ $ sops rotate example.yaml
661
662
662
663
Using .sops.yaml conf to select KMS, PGP and age for new files
663
664
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -741,7 +742,7 @@ Creating a new file with the right keys is now as simple as
741
742
742
743
.. code:: sh
743
744
744
- $ sops <newfile>.prod.yaml
745
+ $ sops edit <newfile>.prod.yaml
745
746
746
747
Note that the configuration file is ignored when KMS or PGP parameters are
747
748
passed on the SOPS command line or in environment variables.
@@ -847,7 +848,7 @@ For example:
847
848
848
849
.. code:: sh
849
850
850
- $ sops --shamir-secret-sharing-threshold 2 example.json
851
+ $ sops edit --shamir-secret-sharing-threshold 2 example.json
851
852
852
853
Alternatively, you can configure the Shamir threshold for each creation rule in the ` ` .sops.yaml` ` config
853
854
with ` ` shamir_threshold` ` :
@@ -880,7 +881,7 @@ with ``shamir_threshold``:
880
881
- pgp:
881
882
- fingerprint5
882
883
883
- And then run ` ` sops example.json` ` .
884
+ And then run ` ` sops edit example.json` ` .
884
885
885
886
The threshold (` ` shamir_threshold` ` ) is set to 2, so this configuration will require
886
887
master keys from two of the three different key groups in order to decrypt the file.
@@ -1348,7 +1349,7 @@ The command below creates a new file with a data key encrypted by KMS and PGP.
1348
1349
1349
1350
.. code:: sh
1350
1351
1351
- $ sops --kms "arn:aws:kms:us-west-2:927034868273:key/fe86dd69-4132-404c-ab86-4269956b4500" --pgp C9CAB0AF1165060DB58D6D6B2653B624D620786D /path/to/new/file.yaml
1352
+ $ sops edit --kms "arn:aws:kms:us-west-2:927034868273:key/fe86dd69-4132-404c-ab86-4269956b4500" --pgp C9CAB0AF1165060DB58D6D6B2653B624D620786D /path/to/new/file.yaml
1352
1353
1353
1354
Encrypting an existing file
1354
1355
~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1448,26 +1449,26 @@ Set a sub-part in a document tree
1448
1449
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1449
1450
1450
1451
SOPS can set a specific part of a YAML or JSON document, by providing
1451
- the path and value in the ``-- set`` command line flag . This is useful to
1452
- set specific values, like keys, without needing an editor.
1452
+ the path and value in the ``set`` command. This is useful to set specific
1453
+ values, like keys, without needing an editor.
1453
1454
1454
1455
.. code:: sh
1455
1456
1456
- $ sops -- set ' [" app2" ][" key" ] " app2keystringvalue" ' ~/git/svc/sops/example.yaml
1457
+ $ sops set ~/git/svc/sops/example.yaml ' [" app2" ][" key" ]' ' " app2keystringvalue" '
1457
1458
1458
1459
The tree path syntax uses regular python dictionary syntax, without the
1459
1460
variable name. Set to keys by naming them, and array elements by
1460
1461
numbering them.
1461
1462
1462
1463
.. code:: sh
1463
1464
1464
- $ sops -- set ' [" an_array" ][1] " secretuser2" ' ~/git/svc/sops/example.yaml
1465
+ $ sops set ~/git/svc/sops/example.yaml ' [" an_array" ][1]' ' " secretuser2" '
1465
1466
1466
1467
The value must be formatted as json.
1467
1468
1468
1469
.. code:: sh
1469
1470
1470
- $ sops -- set ' [" an_array" ][1] {" uid1" :null," uid2" :1000," uid3" :[" bob" ]}' ~/git/svc/sops/example.yaml
1471
+ $ sops set ~/git/svc/sops/example.yaml ' [" an_array" ][1]' ' {" uid1" :null," uid2" :1000," uid3" :[" bob" ]}'
1471
1472
1472
1473
Showing diffs in cleartext in git
1473
1474
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1742,7 +1743,7 @@ when creating a new file:
1742
1743
1743
1744
.. code:: sh
1744
1745
1745
- $ sops --pgp "E60892BB9BD89A69F759A1A0A3D652173B763E8F,84050F1D61AF7C230A12217687DF65059EF093D3,85D77543B3D624B63CEA9E6DBC17301B491B3F21" mynewfile.yaml
1746
+ $ sops edit --pgp "E60892BB9BD89A69F759A1A0A3D652173B763E8F,84050F1D61AF7C230A12217687DF65059EF093D3,85D77543B3D624B63CEA9E6DBC17301B491B3F21" mynewfile.yaml
1746
1747
1747
1748
Threat Model
1748
1749
------------
0 commit comments