@@ -428,15 +428,12 @@ Now you can encrypt a file using:
428428``` sh
429429$ sops encrypt --azure-kv https://sops.vault.azure.net/keys/sops-key/some-string test.yaml > test.enc.yaml
430430```
431- <<<<<<< HEAD
432- =======
433431
434432or, without the version::
435433
436434``` sh
437435$ sops encrypt --azure-kv https://sops.vault.azure.net/keys/sops-key/ test.yaml > test.enc.yaml
438436```
439- >>>>>>> 26388ac (feat(azkv): Skipping key-version will get latest key)
440437
441438And decrypt it using:
442439
@@ -1381,7 +1378,16 @@ stores:
13811378 indent: 2
13821379` ` `
13831380
1381+ <<< <<< < HEAD
13841382Note: The YAML emitter used by sops only supports values between 2 and 9. If
1383+ =======
1384+ :::: note
1385+ ::: title
1386+ Note
1387+ :::
1388+
1389+ The YAML emitter used by SOPS only supports values between 2 and 9. If
1390+ >>>>>>> ca167d4 (Document (most of) the SOPS config format.)
13851391you specify 1, or 10 and larger, the indent will be 2.
13861392
13871393# # YAML anchors
@@ -1732,6 +1738,303 @@ Note: these six options `--unencrypted-suffix`, `--encrypted-suffix`,
17321738and ` --unencrypted-comment-regex` are mutually exclusive and
17331739cannot all be used in the same file.
17341740
1741+ # Config file format
1742+
1743+ This section describes the format of the SOPS config file.
1744+ The file must be named ` .sops.yaml` (not ` .sops.yml` ! ),
1745+ and SOPS will look for it in the current working directory and its parents,
1746+ using the first ` .sops.yaml` file found.
1747+
1748+ A specific file can be set as the config file by passing the ` --config` global option
1749+ or setting the ` SOPS_CONFIG` environment variable.
1750+
1751+ The config file must be in the [YAML format](https://yaml.org/).
1752+
1753+ The following top-level keys are supported:
1754+
1755+ * ` creation_rules` : a list of creation rule objects.
1756+ * ` destination_rules` : a list of destination rule objects.
1757+ * ` stores` : configuration object for the stores.
1758+
1759+ See the next subsections for how these objects look like.
1760+
1761+ # # Creation rule object
1762+
1763+ A creation rule object has three kind of keys:
1764+
1765+ 1. Keys that determine whether the creation rule matches;
1766+ 1. Keys that determine the (groups of) identities (keys) to encrypt with;
1767+ 1. Keys that determine which parts of and how a file is encrypted.
1768+
1769+ # ## Matching
1770+
1771+ The keys related to file matching are:
1772+
1773+ * ` path_regex` : a regular expression matching files to encrypt.
1774+ If not specified, this creation rule will match all files.
1775+
1776+ # ## Identities
1777+
1778+ One can either directly specify identities for a single key group, or specify a list of key groups.
1779+ If a list of key groups is given, the individual settings are ignored.
1780+
1781+ To directly specify a single key group, you can use the following keys:
1782+
1783+ * ` kms` (comma-separated string, or list of strings): list of AWS master keys.
1784+ * ` aws_profile` (string): AWS profile to use for the AWS KMS keys.
1785+ Example:
1786+
1787+ ` ` ` yaml
1788+ creation_rules:
1789+ - kms:
1790+ - arn:aws:kms:us-east-1:656532927350:key/920aff2e-c5f1-4040-943a-047fa387b27e
1791+ - arn:aws:kms:ap-southeast-1:656532927350:key/9006a8aa-0fa6-4c14-930e-a2dfb916de1d
1792+ aws_profile: foo
1793+ ` ` `
1794+
1795+ * ` age` (comma-separated string, or list of strings): list of Age public keys.
1796+ Example:
1797+
1798+ ` ` ` yaml
1799+ creation_rules:
1800+ - age:
1801+ - age1s3cqcks5genc6ru8chl0hkkd04zmxvczsvdxq99ekffe4gmvjpzsedk23c
1802+ - age1qe5lxzzeppw5k79vxn3872272sgy224g2nzqlzy3uljs84say3yqgvd0sw
1803+ ` ` `
1804+
1805+ * ` pgp` (comma-separated string, or list of strings): list of PGP/GPG key fingerprints.
1806+ Example:
1807+
1808+ ` ` ` yaml
1809+ creation_rules:
1810+ - pgp:
1811+ - 85D77543B3D624B63CEA9E6DBC17301B491B3F21!
1812+ - E60892BB9BD89A69F759A1A0A3D652173B763E8F!
1813+ ` ` `
1814+
1815+ * ` gcp_kms` (comma-separated string, or list of strings): list of GCP KMS ResourceIDs.
1816+ Example:
1817+
1818+ ` ` ` yaml
1819+ creation_rules:
1820+ - gcp_kms:
1821+ - projects/mygcproject/locations/global/keyRings/mykeyring/cryptoKeys/thekey
1822+ ` ` `
1823+
1824+ * ` azure_keyvault` (comma-separated string, or list of strings): list of Azure Key Vault resource identifiers.
1825+ Example:
1826+
1827+ ` ` ` yaml
1828+ creation_rules:
1829+ - azure_keyvault:
1830+ - https://vault.url/keys/key-name/key-version # Key with version
1831+ - https://vault.url/keys/key-name/ # key without version, the latest will be used
1832+ ` ` `
1833+
1834+ * ` hc_vault_transit_uri` (comma-separated string, or list of strings): list of HashiCorp Vault transit URIs.
1835+ Example:
1836+
1837+ ` ` ` yaml
1838+ creation_rules:
1839+ - hc_vault_transit_uri:
1840+ - http://my.vault/v1/sops/keys/secondkey
1841+ ` ` `
1842+
1843+ To specify a list of key groups, you can use the following key:
1844+
1845+ * ` key_groups` (list of key group objects): a list of key group objects.
1846+ See below for how such an object looks like.
1847+ Example:
1848+
1849+ ` ` ` yaml
1850+ creation_rules:
1851+ - key_groups:
1852+ - kms:
1853+ - arn:aws:kms:us-east-1:656532927350:key/920aff2e-c5f1-4040-943a-047fa387b27e
1854+ - arn:aws:kms:ap-southeast-1:656532927350:key/9006a8aa-0fa6-4c14-930e-a2dfb916de1d
1855+ aws_profile: foo
1856+ age:
1857+ - age1s3cqcks5genc6ru8chl0hkkd04zmxvczsvdxq99ekffe4gmvjpzsedk23c
1858+ - age1qe5lxzzeppw5k79vxn3872272sgy224g2nzqlzy3uljs84say3yqgvd0sw
1859+ pgp:
1860+ - 85D77543B3D624B63CEA9E6DBC17301B491B3F21!
1861+ - E60892BB9BD89A69F759A1A0A3D652173B763E8F!
1862+ gcp_kms:
1863+ - projects/mygcproject/locations/global/keyRings/mykeyring/cryptoKeys/thekey
1864+ azure_keyvault:
1865+ - https://vault.url/keys/key-name/key-version # Key with version
1866+ - https://vault.url/keys/key-name/ # key without version, the latest will be used
1867+ hc_vault_transit_uri:
1868+ - http://my.vault/v1/sops/keys/secondkey
1869+
1870+ merge:
1871+ - pgp:
1872+ - 85D77543B3D624B63CEA9E6DBC17301B491B3F21!
1873+ - age:
1874+ - age1s3cqcks5genc6ru8chl0hkkd04zmxvczsvdxq99ekffe4gmvjpzsedk23c
1875+ - gcp_kms:
1876+ - projects/mygcproject/locations/global/keyRings/mykeyring/cryptoKeys/thekey
1877+ azure_keyvault:
1878+ - https://vault.url/keys/key-name/key-version
1879+ ` ` `
1880+
1881+ # # Key group object
1882+
1883+ A key group contains multiple identities (keys), similar to a creation rule object.
1884+ Having more than one key group allows to use [Shamir' s secret sharing](https://en.wikipedia.org/wiki/Shamir%27s_secret_sharing)
1885+ to split the file' s encryption key up into multiple parts,
1886+ requiring more than one identity to access the file.
1887+
1888+ A key group supports the following keys:
1889+
1890+ * ` kms` (list of objects): list of AWS master keys.
1891+ Every object must have the following keys:
1892+
1893+ * ` arn` (string): the ARN of the master key.
1894+
1895+ * ` role` (string, can be omitted): the key' s role.
1896+
1897+ * `context` (object mapping strings to strings): the key' s encryption context.
1898+
1899+ * ` aws_profile` (string): the AWS profile.
1900+
1901+ Example:
1902+
1903+ ` ` ` yaml
1904+ - arn: arn:aws:kms:us-west-2:927034868273:key/fe86dd69-4132-404c-ab86-4269956b4500
1905+ role: arn:aws:iam::927034868273:role/sops-dev-xyz
1906+ context:
1907+ Environment: production
1908+ Role: web-server
1909+ aws_profile: foo
1910+ ` ` `
1911+
1912+ * ` gcp_kms` (list of objects): list of GCP KMS ResourceIDs.
1913+ Every object must have the following key:
1914+
1915+ * ` resource_id` (string): the resource ID.
1916+
1917+ Example:
1918+
1919+ ` ` ` yaml
1920+ - resource_id: projects/mygcproject/locations/global/keyRings/mykeyring/cryptoKeys/thekey
1921+ ` ` `
1922+
1923+ * ` azure_keyvault` ` (list of objects): list of Azure Key Vault resource identifiers.
1924+ Every object must have the following keys:
1925+
1926+ * ` vaultUrl` (string): the vault URL.
1927+
1928+ * ` key` (string): the key name.
1929+
1930+ * ` version` (string, can be empty): the version of the key to use.
1931+ If empty, the latest key will be used on encryption.
1932+
1933+ Example:
1934+
1935+ ` ` ` yaml
1936+ - vaultUrl: https://vault.url
1937+ key: key-name
1938+ version: key-version
1939+ - vaultUrl: https://vault.url
1940+ key: key-name
1941+ version: " "
1942+ ` ` `
1943+
1944+ * ` hc_vault` (list of strings): list of HashiCorp Vault transit URIs.
1945+
1946+ * ` age` (list of strings): list of Age public keys.
1947+
1948+ * ` pgp` (list of strings): list of PGP/GPG key fingerprints.
1949+
1950+ * ` merge` : a list of key group objects.
1951+ These will be merged (by concatenating the keys of the same type) into this key group.
1952+ This key is only there to allow concatenation of key groups using YAML anchors, aliases, and overrides.
1953+
1954+ # ## Settings
1955+
1956+ The following keys configure encryption settings:
1957+
1958+ * ` shamir_threshold` (integer, default ` 0` ): Must be ` 0` (disabled) or an integer greater or equal to 2.
1959+ Determines the number of key groups from whose one key must be present each to decrypt the file' s key.
1960+
1961+ * `mac_only_encrypted` (boolean, default `false`): If set to `true`, only encrypted strings will count towards the file' s MAC.
1962+ If set to ` false` , also unencrypted values will be part of the MAC computation.
1963+
1964+ The following keys configure which values in a file are encrypted.
1965+ Note that at most one of these keys can be used.
1966+
1967+ * ` unencrypted_suffix` (string): A value is encrypted if its key ** does not** end with this suffix.
1968+ All other values are ** encrypted** .
1969+ Comments are always encrypted.
1970+
1971+ * ` encrypted_suffix` (string): A value is encrypted if its key ** does** end with this suffix.
1972+ All other values are ** not encrypted** .
1973+ Comments are always encrypted.
1974+
1975+ * ` unencrypted_regex` (string): A value is encrypted if its key ** does not match** this regular expression.
1976+ All other values are ** encrypted** .
1977+ Comments are always encrypted.
1978+
1979+ * ` encrypted_regex` (string): A value is encrypted if its key ** matches** this regular expression.
1980+ All other values are ** not encrypted** .
1981+ Comments are always encrypted.
1982+
1983+ * ` unencrypted_comment_regex` (string): A value or comment is not encrypted if it has a preceding comment
1984+ (or a trailing comment on the same line) matching this regular expression.
1985+ All other values and comments are encrypted.
1986+
1987+ * ` encrypted_comment_regex` (string): A value or comment is encrypted if it has a preceding comment
1988+ (or a trailing comment on the same line) matching this regular expression.
1989+ All other comments and values are not encrypted.
1990+ The matching comment itself is not encrypted.
1991+
1992+ # # Destination rule object
1993+
1994+ Not yet documented.
1995+
1996+ < ! --
1997+ TODO!
1998+ type destinationRule struct {
1999+ PathRegex string ` yaml:" path_regex" `
2000+ S3Bucket string ` yaml:" s3_bucket" `
2001+ S3Prefix string ` yaml:" s3_prefix" `
2002+ GCSBucket string ` yaml:" gcs_bucket" `
2003+ GCSPrefix string ` yaml:" gcs_prefix" `
2004+ VaultPath string ` yaml:" vault_path" `
2005+ VaultAddress string ` yaml:" vault_address" `
2006+ VaultKVMountName string ` yaml:" vault_kv_mount_name" `
2007+ VaultKVVersion int ` yaml:" vault_kv_version" `
2008+ RecreationRule creationRule ` yaml:" recreation_rule,omitempty" `
2009+ OmitExtensions bool ` yaml:" omit_extensions" `
2010+ } -->
2011+
2012+ # # Stores configuration object
2013+
2014+ The store configuration object can have the following keys:
2015+
2016+ * ` dotenv` : this is an object. Right now no keys are supported.
2017+
2018+ * ` ini` : this is an object. Right now no keys are supported.
2019+
2020+ * ` json_binary` : this is an object, supporting the following keys:
2021+
2022+ * ` indent` (integer; default ` -1` ): the indentation to use in number of spaces.
2023+ ` 0` means no indentation (everything will be in one line),
2024+ and ` -1` means indentation by a single tabulator character.
2025+
2026+ * ` json` : this is an object, supporting the following keys:
2027+
2028+ * ` indent` (integer; default ` -1` ): the indentation to use in number of spaces.
2029+ ` 0` means no indentation (everything will be in one line),
2030+ and ` -1` means indentation by a single tabulator character.
2031+
2032+ * ` yaml` : this is an object, supporting the following keys:
2033+
2034+ * ` indent` (integer; default ` 4` ): the indentation to use in number of spaces.
2035+ The YAML emitter used by sops only supports values between ` 2` and ` 9` .
2036+ If you specify ` 1` , or ` 10` and larger, the indent will be ` 2` .
2037+
17352038# Encryption Protocol
17362039
17372040When SOPS creates a file, it generates a random 256 bit data key and
0 commit comments