@@ -429,7 +429,7 @@ The simplest way to decrypt data from stdin is as follows:
429429
430430.. code :: sh
431431
432- $ cat encrypted-data | sops decrypt > decrypted-data
432+ $ cat encrypted-data | sops decrypt > decrypted-data
433433
434434 By default, ``sops `` determines the input and output format from the provided filename. Since in this case,
435435no filename is provided, ``sops `` will use the binary store which expects JSON input and outputs binary data
@@ -440,8 +440,8 @@ the input and output formats by passing ``--input-type`` and ``--output-type`` a
440440
441441.. code :: sh
442442
443- $ cat encrypted-data | sops decrypt --filename-override filename.yaml > decrypted-data
444- $ cat encrypted-data | sops decrypt --input-type yaml --output-type yaml > decrypted-data
443+ $ cat encrypted-data | sops decrypt --filename-override filename.yaml > decrypted-data
444+ $ cat encrypted-data | sops decrypt --input-type yaml --output-type yaml > decrypted-data
445445
446446 In both cases, ``sops `` will assume that the data you provide is in YAML format, and will encode the decrypted
447447data in YAML as well. The second form allows to use different formats for input and output.
@@ -452,7 +452,7 @@ SOPS which filename to use to match creation rules:
452452
453453.. code :: sh
454454
455- $ echo ' foo: bar' | sops encrypt --filename-override path/filename.sops.yaml > encrypted-data
455+ $ echo ' foo: bar' | sops encrypt --filename-override path/filename.sops.yaml > encrypted-data
456456
457457 SOPS will find a matching creation rule for ``path/filename.sops.yaml `` in ``.sops.yaml `` and use that one to
458458encrypt the data from stdin. This filename will also be used to determine the input and output store. As always,
@@ -461,7 +461,7 @@ the input store type can be adjusted by passing ``--input-type``, and the output
461461
462462.. code :: sh
463463
464- $ echo foo=bar | sops encrypt --filename-override path/filename.sops.yaml --input-type dotenv > encrypted-data
464+ $ echo foo=bar | sops encrypt --filename-override path/filename.sops.yaml --input-type dotenv > encrypted-data
465465
466466
467467 Encrypting using Hashicorp Vault
@@ -1335,7 +1335,7 @@ by configuring ``.sops.yaml`` with:
13351335
13361336.. note::
13371337
1338- The YAML emitter used by sops only supports values between 2 and 9. If you specify 1,
1338+ The YAML emitter used by SOPS only supports values between 2 and 9. If you specify 1,
13391339 or 10 and larger, the indent will be 2.
13401340
13411341YAML anchors
@@ -1681,6 +1681,308 @@ Note: these six options ``--unencrypted-suffix``, ``--encrypted-suffix``, ``--en
16811681` ` --unencrypted-regex` ` , ` ` --encrypted-comment-regex` ` , and ` ` --unencrypted-comment-regex` ` are
16821682mutually exclusive and cannot all be used in the same file.
16831683
1684+ Config file format
1685+ ------------------
1686+
1687+ This section describes the format of the SOPS config file.
1688+ The file must be named ` ` .sops.yaml` ` (not ` ` .sops.yml` ` !),
1689+ and SOPS will look for it in the current working directory and its parents,
1690+ using the first ` ` .sops.yaml` ` file found.
1691+
1692+ A specific file can be set as the config file by passing the ` ` --config` ` global option
1693+ or setting the ` ` SOPS_CONFIG` ` environment variable.
1694+
1695+ The config file must be in the ` YAML format < https://yaml.org/> ` __.
1696+
1697+ The following top-level keys are supported:
1698+
1699+ * ` ` creation_rules` ` : a list of creation rule objects.
1700+ * ` ` destination_rules` ` : a list of destination rule objects.
1701+ * ` ` stores` ` : configuration object for the stores.
1702+
1703+ The following subsections describe how these properties are used.
1704+
1705+ Creation rule object
1706+ ~~~~~~~~~~~~~~~~~~~~
1707+
1708+ A creation rule object has three types of keys:
1709+
1710+ #. Keys that determine whether the creation rule matches.
1711+ #. Keys that determine the (groups of) identities (keys) to encrypt with.
1712+ #. Keys that determine which parts of and how a file is encrypted.
1713+
1714+ Matching
1715+ ********
1716+
1717+ The keys related to file matching are:
1718+
1719+ * ` ` path_regex` ` : a regular expression matching files to encrypt.
1720+ If not specified, this creation rule will match all files.
1721+
1722+ Identities
1723+ **********
1724+
1725+ One can either directly specify identities for a single key group, or specify a list of key groups.
1726+ If a list of key groups is given, the individual settings are ignored.
1727+
1728+ To directly specify a single key group, you can use the following keys:
1729+
1730+ * ` ` kms` ` (comma-separated string, or list of strings): list of AWS master keys.
1731+ * ` ` aws_profile` ` (string): AWS profile to use for the AWS KMS keys.
1732+ Example:
1733+
1734+ .. code:: yaml
1735+
1736+ creation_rules:
1737+ - kms:
1738+ - arn:aws:kms:us-east-1:656532927350:key/920aff2e-c5f1-4040-943a-047fa387b27e
1739+ - arn:aws:kms:ap-southeast-1:656532927350:key/9006a8aa-0fa6-4c14-930e-a2dfb916de1d
1740+ aws_profile: foo
1741+
1742+ * ` ` age` ` (comma-separated string, or list of strings): list of Age public keys.
1743+ Example:
1744+
1745+ .. code:: yaml
1746+
1747+ creation_rules:
1748+ - age:
1749+ - age1s3cqcks5genc6ru8chl0hkkd04zmxvczsvdxq99ekffe4gmvjpzsedk23c
1750+ - age1qe5lxzzeppw5k79vxn3872272sgy224g2nzqlzy3uljs84say3yqgvd0sw
1751+
1752+ * ` ` pgp` ` (comma-separated string, or list of strings): list of PGP/GPG key fingerprints.
1753+ Example:
1754+
1755+ .. code:: yaml
1756+
1757+ creation_rules:
1758+ - pgp:
1759+ - 85D77543B3D624B63CEA9E6DBC17301B491B3F21!
1760+ - E60892BB9BD89A69F759A1A0A3D652173B763E8F!
1761+
1762+ * ` ` gcp_kms` ` (comma-separated string, or list of strings): list of GCP KMS ResourceIDs.
1763+ Example:
1764+
1765+ .. code:: yaml
1766+
1767+ creation_rules:
1768+ - gcp_kms:
1769+ - projects/mygcproject/locations/global/keyRings/mykeyring/cryptoKeys/thekey
1770+
1771+ * ` ` azure_keyvault` ` (comma-separated string, or list of strings): list of Azure Key Vault resource identifiers.
1772+ Example:
1773+
1774+ .. code:: yaml
1775+
1776+ creation_rules:
1777+ - azure_keyvault:
1778+ - https://vault.url/keys/key-name/key-version # Key with version
1779+ - https://vault.url/keys/key-name/ # key without version, the latest will be used
1780+
1781+ * ` ` hc_vault_transit_uri` ` (comma-separated string, or list of strings): list of HashiCorp Vault transit URIs.
1782+ Example:
1783+
1784+ .. code:: yaml
1785+
1786+ creation_rules:
1787+ - hc_vault_transit_uri:
1788+ - http://my.vault/v1/sops/keys/secondkey
1789+
1790+ To specify a list of key groups, you can use the following key:
1791+
1792+ * ` ` key_groups` ` (list of key group objects): a list of key group objects.
1793+ See below for how such a resource should be represented.
1794+ Example:
1795+
1796+ .. code:: yaml
1797+
1798+ creation_rules:
1799+ - key_groups:
1800+ - kms:
1801+ - arn:aws:kms:us-east-1:656532927350:key/920aff2e-c5f1-4040-943a-047fa387b27e
1802+ - arn:aws:kms:ap-southeast-1:656532927350:key/9006a8aa-0fa6-4c14-930e-a2dfb916de1d
1803+ aws_profile: foo
1804+ age:
1805+ - age1s3cqcks5genc6ru8chl0hkkd04zmxvczsvdxq99ekffe4gmvjpzsedk23c
1806+ - age1qe5lxzzeppw5k79vxn3872272sgy224g2nzqlzy3uljs84say3yqgvd0sw
1807+ pgp:
1808+ - 85D77543B3D624B63CEA9E6DBC17301B491B3F21!
1809+ - E60892BB9BD89A69F759A1A0A3D652173B763E8F!
1810+ gcp_kms:
1811+ - projects/mygcproject/locations/global/keyRings/mykeyring/cryptoKeys/thekey
1812+ azure_keyvault:
1813+ - https://vault.url/keys/key-name/key-version # Key with version
1814+ - https://vault.url/keys/key-name/ # key without version, the latest will be used
1815+ hc_vault_transit_uri:
1816+ - http://my.vault/v1/sops/keys/secondkey
1817+
1818+ merge:
1819+ - pgp:
1820+ - 85D77543B3D624B63CEA9E6DBC17301B491B3F21!
1821+ - age:
1822+ - age1s3cqcks5genc6ru8chl0hkkd04zmxvczsvdxq99ekffe4gmvjpzsedk23c
1823+ - gcp_kms:
1824+ - projects/mygcproject/locations/global/keyRings/mykeyring/cryptoKeys/thekey
1825+ azure_keyvault:
1826+ - https://vault.url/keys/key-name/key-version
1827+
1828+ Key group object
1829+ ++++++++++++++++
1830+
1831+ A key group contains multiple identities (keys), similar to a creation rule object.
1832+ Having more than one key group allows for the use of ` Shamir' s secret sharing <https://en.wikipedia.org/wiki/Shamir%27s_secret_sharing>`__
1833+ which splits the file' s encryption key up into multiple parts,
1834+ requiring more than one identity to access the file.
1835+
1836+ A key group supports the following keys:
1837+
1838+ * ` ` kms` ` (list of objects): list of AWS master keys.
1839+ Every object must have the following keys:
1840+
1841+ * ` ` arn` ` (string): the ARN of the master key.
1842+
1843+ * ` ` role` ` (string, can be omitted): the key' s role.
1844+
1845+ * ``context`` (object mapping strings to strings): the key' s encryption context.
1846+
1847+ * ` ` aws_profile` ` (string): the AWS profile.
1848+
1849+ Example:
1850+
1851+ .. code:: yaml
1852+
1853+ - arn: arn:aws:kms:us-west-2:927034868273:key/fe86dd69-4132-404c-ab86-4269956b4500
1854+ role: arn:aws:iam::927034868273:role/sops-dev-xyz
1855+ context:
1856+ Environment: production
1857+ Role: web-server
1858+ aws_profile: foo
1859+
1860+ * ` ` gcp_kms` ` (list of objects): list of GCP KMS resource IDs.
1861+ Every object must have the following key:
1862+
1863+ * ` ` resource_id` ` (string): the resource ID.
1864+
1865+ Example:
1866+
1867+ .. code:: yaml
1868+
1869+ - resource_id: projects/mygcproject/locations/global/keyRings/mykeyring/cryptoKeys/thekey
1870+
1871+ * ` ` azure_keyvault` ` (list of objects): list of Azure Key Vault resource identifiers.
1872+ Every object must have the following keys:
1873+
1874+ * ` ` vaultUrl` ` (string): the vault URL.
1875+
1876+ * ` ` key` ` (string): the key name.
1877+
1878+ * ` ` version` ` (string, can be empty): the version of the key to use.
1879+ If empty, the latest key will be used on encryption.
1880+
1881+ Example:
1882+
1883+ .. code:: yaml
1884+
1885+ - vaultUrl: https://vault.url
1886+ key: key-name
1887+ version: key-version
1888+ - vaultUrl: https://vault.url
1889+ key: key-name
1890+ version: " "
1891+
1892+ * ` ` hc_vault` ` (list of strings): list of HashiCorp Vault transit URIs.
1893+
1894+ * ` ` age` ` (list of strings): list of Age public keys.
1895+
1896+ * ` ` pgp` ` (list of strings): list of PGP/GPG key fingerprints.
1897+
1898+ * ` ` merge` ` : a list of key group objects.
1899+ These will be merged (by concatenating the keys of the same type) into this key group.
1900+ This property allows for the concatenation of key groups using YAML anchors, aliases, and overrides.
1901+
1902+ Settings
1903+ ********
1904+
1905+ The following keys configure encryption settings:
1906+
1907+ * ` ` shamir_threshold` ` (integer, default ` ` 0` ` ): Must be ` ` 0` ` (disabled) or an integer greater or equal to 2.
1908+ Determines the number of key groups that must be present each to decrypt the file' s key.
1909+
1910+ * ``mac_only_encrypted`` (boolean, default ``false``): If set to ``true``, only encrypted strings will count towards the file' s MAC.
1911+ If set to ` ` false` ` , unencrypted values will also be part of the MAC computation.
1912+
1913+ The following keys configure the specific values in a file that should be encrypted.
1914+ Note that at most, one of these keys can be used.
1915+
1916+ * ` ` unencrypted_suffix` ` (string): A value is encrypted if its key ** does not** end with this suffix.
1917+ All other values are ** encrypted** .
1918+ Comments are always encrypted.
1919+
1920+ * ` ` encrypted_suffix` ` (string): A value is encrypted if its key ** does** end with this suffix.
1921+ All other values are ** not encrypted** .
1922+ Comments are always encrypted.
1923+
1924+ * ` ` unencrypted_regex` ` (string): A value is encrypted if its key ** does not match** this regular expression.
1925+ All other values are ** encrypted** .
1926+ Comments are always encrypted.
1927+
1928+ * ` ` encrypted_regex` ` (string): A value is encrypted if its key ** matches** this regular expression.
1929+ All other values are ** not encrypted** .
1930+ Comments are always encrypted.
1931+
1932+ * ` ` unencrypted_comment_regex` ` (string): A value or comment is not encrypted if it has a preceding comment (or a trailing comment on the same line) matching this regular expression.
1933+ All other values and comments are encrypted.
1934+
1935+ * ` ` encrypted_comment_regex` ` (string): A value or comment is encrypted if it has a preceding comment (or a trailing comment on the same line) matching this regular expression.
1936+ All other comments and values are not encrypted.
1937+ The matching comment itself is not encrypted.
1938+
1939+ Destination rule object
1940+ ~ ~~~~~~~~~~~~~~~~~~~~~~
1941+
1942+ Not yet documented.
1943+
1944+ .. TODO!
1945+ .. type destinationRule struct {
1946+ .. PathRegex string ` yaml:" path_regex" `
1947+ .. S3Bucket string ` yaml:" s3_bucket" `
1948+ .. S3Prefix string ` yaml:" s3_prefix" `
1949+ .. GCSBucket string ` yaml:" gcs_bucket" `
1950+ .. GCSPrefix string ` yaml:" gcs_prefix" `
1951+ .. VaultPath string ` yaml:" vault_path" `
1952+ .. VaultAddress string ` yaml:" vault_address" `
1953+ .. VaultKVMountName string ` yaml:" vault_kv_mount_name" `
1954+ .. VaultKVVersion int ` yaml:" vault_kv_version" `
1955+ .. RecreationRule creationRule ` yaml:" recreation_rule,omitempty" `
1956+ .. OmitExtensions bool ` yaml:" omit_extensions" `
1957+ .. }
1958+
1959+ Stores configuration object
1960+ ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~
1961+
1962+ The store configuration object can have the following keys:
1963+
1964+ * ` ` dotenv` ` : this is an object. Right now no keys are supported.
1965+
1966+ * ` ` ini` ` : this is an object. Right now no keys are supported.
1967+
1968+ * ` ` json_binary` ` : this is an object, supporting the following keys:
1969+
1970+ * ` ` indent` ` (integer; default ` ` -1` ` ): the indentation to use in number of spaces.
1971+ ` ` 0` ` means no indentation (everything will be in one line),
1972+ and ` ` -1` ` means indentation by a single tabulator character.
1973+
1974+ * ` ` json` ` : this is an object, supporting the following keys:
1975+
1976+ * ` ` indent` ` (integer; default ` ` -1` ` ): the indentation to use in number of spaces.
1977+ ` ` 0` ` means no indentation (everything will be in one line),
1978+ and ` ` -1` ` means indentation by a single tabulator character.
1979+
1980+ * ` ` yaml` ` : this is an object, supporting the following keys:
1981+
1982+ * ` ` indent` ` (integer; default ` ` 4` ` ): the indentation to use in number of spaces.
1983+ The YAML emitter used by sops only supports values between ` ` 2` ` and ` ` 9` ` .
1984+ If you specify ` ` 1` ` , or ` ` 10` ` and larger, the indent will be ` ` 2` ` .
1985+
16841986Encryption Protocol
16851987-------------------
16861988
0 commit comments