github.com/lrills/helm@v2.8.1+incompatible/docs/provenance.md (about) 1 # Helm Provenance and Integrity 2 3 Helm has provenance tools which help chart users verify the integrity and origin 4 of a package. Using industry-standard tools based on PKI, GnuPG, and well-respected 5 package managers, Helm can generate and verify signature files. 6 7 **Note:** 8 Version 2.0.0-alpha.4 introduced a system for verifying the authenticity of charts. 9 While we do not anticipate that any major changes will be made to the file formats 10 or provenancing algorithms, this portion of Helm is not considered _frozen_ until 11 2.0.0-RC1 is released. The original plan for this feature can be found 12 [at issue 983](https://github.com/kubernetes/helm/issues/983). 13 14 ## Overview 15 16 Integrity is established by comparing a chart to a provenance record. Provenance 17 records are stored in _provenance files_, which are stored alongside a packaged 18 chart. For example, if a chart is named `myapp-1.2.3.tgz`, its provenance file 19 will be `myapp-1.2.3.tgz.prov`. 20 21 Provenance files are generated at packaging time (`helm package --sign ...`), and 22 can be checked by multiple commands, notable `helm install --verify`. 23 24 ## The Workflow 25 26 This section describes a potential workflow for using provenance data effectively. 27 28 Prerequisites: 29 30 - A valid PGP keypair in a binary (not ASCII-armored) format 31 - The `helm` command line tool 32 - GnuPG command line tools (optional) 33 - Keybase command line tools (optional) 34 35 **NOTE:** If your PGP private key has a passphrase, you will be prompted to enter 36 that passphrase for any commands that support the `--sign` option. 37 38 Creating a new chart is the same as before: 39 40 ``` 41 $ helm create mychart 42 Creating mychart 43 ``` 44 45 Once ready to package, add the `--sign` flag to `helm package`. Also, specify 46 the name under which the signing key is known and the keyring containing the corresponding private key: 47 48 ``` 49 $ helm package --sign --key 'helm signing key' --keyring path/to/keyring.secret mychart 50 ``` 51 52 **TIP:** for GnuPG users, your secret keyring is in `~/.gnupg/secring.gpg`. You can 53 use `gpg --list-secret-keys` to list the keys you have. 54 55 At this point, you should see both `mychart-0.1.0.tgz` and `mychart-0.1.0.tgz.prov`. 56 Both files should eventually be uploaded to your desired chart repository. 57 58 You can verify a chart using `helm verify`: 59 60 ``` 61 $ helm verify mychart-0.1.0.tgz 62 ``` 63 64 A failed verification looks like this: 65 66 ``` 67 $ helm verify topchart-0.1.0.tgz 68 Error: sha256 sum does not match for topchart-0.1.0.tgz: "sha256:1939fbf7c1023d2f6b865d137bbb600e0c42061c3235528b1e8c82f4450c12a7" != "sha256:5a391a90de56778dd3274e47d789a2c84e0e106e1a37ef8cfa51fd60ac9e623a" 69 ``` 70 71 To verify during an install, use the `--verify` flag. 72 73 ``` 74 $ helm install --verify mychart-0.1.0.tgz 75 ``` 76 77 If the keyring (containing the public key associated with the signed chart) is not in the default location, you may need to point to the 78 keyring with `--keyring PATH` as in the `helm package` example. 79 80 If verification fails, the install will be aborted before the chart is even pushed 81 up to Tiller. 82 83 ### Using Keybase.io credentials 84 85 The [Keybase.io](https://keybase.io) service makes it easy to establish a chain of 86 trust for a cryptographic identity. Keybase credentials can be used to sign charts. 87 88 Prerequisites: 89 90 - A configured Keybase.io account 91 - GnuPG installed locally 92 - The `keybase` CLI installed locally 93 94 #### Signing packages 95 96 The first step is to import your keybase keys into your local GnuPG keyring: 97 98 ``` 99 $ keybase pgp export -s | gpg --import 100 ``` 101 102 This will convert your Keybase key into the OpenPGP format, and then import it 103 locally into your `~/.gnupg/secring.gpg` file. 104 105 You can double check by running `gpg --list-secret-keys`. 106 107 ``` 108 $ gpg --list-secret-keys 1 ↵ 109 /Users/mattbutcher/.gnupg/secring.gpg 110 ------------------------------------- 111 sec 2048R/1FC18762 2016-07-25 112 uid technosophos (keybase.io/technosophos) <technosophos@keybase.io> 113 ssb 2048R/D125E546 2016-07-25 114 ``` 115 116 Note that your secret key will have an identifier string: 117 118 ``` 119 technosophos (keybase.io/technosophos) <technosophos@keybase.io> 120 ``` 121 122 That is the full name of your key. 123 124 Next, you can package and sign a chart with `helm package`. Make sure you use at 125 least part of that name string in `--key`. 126 127 ``` 128 $ helm package --sign --key technosophos --keyring ~/.gnupg/secring.gpg mychart 129 ``` 130 131 As a result, the `package` command should produce both a `.tgz` file and a `.tgz.prov` 132 file. 133 134 #### Verifying packages 135 136 You can also use a similar technique to verify a chart signed by someone else's 137 Keybase key. Say you want to verify a package signed by `keybase.io/technosophos`. 138 To do this, use the `keybase` tool: 139 140 ``` 141 $ keybase follow technosophos 142 $ keybase pgp pull 143 ``` 144 145 The first command above tracks the user `technosophos`. Next `keybase pgp pull` 146 downloads the OpenPGP keys of all of the accounts you follow, placing them in 147 your GnuPG keyring (`~/.gnupg/pubring.gpg`). 148 149 At this point, you can now use `helm verify` or any of the commands with a `--verify` 150 flag: 151 152 ``` 153 $ helm verify somechart-1.2.3.tgz 154 ``` 155 156 ### Reasons a chart may not verify 157 158 These are common reasons for failure. 159 160 - The prov file is missing or corrupt. This indicates that something is misconfigured 161 or that the original maintainer did not create a provenance file. 162 - The key used to sign the file is not in your keyring. This indicate that the 163 entity who signed the chart is not someone you've already signaled that you trust. 164 - The verification of the prov file failed. This indicates that something is wrong 165 with either the chart or the provenance data. 166 - The file hashes in the provenance file do not match the hash of the archive file. This 167 indicates that the archive has been tampered with. 168 169 If a verification fails, there is reason to distrust the package. 170 171 ## The Provenance File 172 The provenance file contains a chart’s YAML file plus several pieces of 173 verification information. Provenance files are designed to be automatically 174 generated. 175 176 177 The following pieces of provenance data are added: 178 179 180 * The chart file (Chart.yaml) is included to give both humans and tools an easy 181 view into the contents of the chart. 182 * The signature (SHA256, just like Docker) of the chart package (the .tgz file) 183 is included, and may be used to verify the integrity of the chart package. 184 * The entire body is signed using the algorithm used by PGP (see 185 [http://keybase.io] for an emerging way of making crypto signing and 186 verification easy). 187 188 The combination of this gives users the following assurances: 189 190 * The package itself has not been tampered with (checksum package tgz). 191 * The entity who released this package is known (via the GnuPG/PGP signature). 192 193 The format of the file looks something like this: 194 195 ``` 196 -----BEGIN PGP SIGNED MESSAGE----- 197 name: nginx 198 description: The nginx web server as a replication controller and service pair. 199 version: 0.5.1 200 keywords: 201 - https 202 - http 203 - web server 204 - proxy 205 source: 206 - https://github.com/foo/bar 207 home: http://nginx.com 208 209 ... 210 files: 211 nginx-0.5.1.tgz: “sha256:9f5270f50fc842cfcb717f817e95178f” 212 -----BEGIN PGP SIGNATURE----- 213 Version: GnuPG v1.4.9 (GNU/Linux) 214 215 iEYEARECAAYFAkjilUEACgQkB01zfu119ZnHuQCdGCcg2YxF3XFscJLS4lzHlvte 216 WkQAmQGHuuoLEJuKhRNo+Wy7mhE7u1YG 217 =eifq 218 -----END PGP SIGNATURE----- 219 ``` 220 221 Note that the YAML section contains two documents (separated by `...\n`). The 222 first is the Chart.yaml. The second is the checksums, a map of filenames to 223 SHA-256 digests (value shown is fake/truncated) 224 225 The signature block is a standard PGP signature, which provides [tamper 226 resistance](http://www.rossde.com/PGP/pgp_signatures.html). 227 228 ## Chart Repositories 229 230 Chart repositories serve as a centralized collection of Helm charts. 231 232 Chart repositories must make it possible to serve provenance files over HTTP via 233 a specific request, and must make them available at the same URI path as the chart. 234 235 For example, if the base URL for a package is `https://example.com/charts/mychart-1.2.3.tgz`, 236 the provenance file, if it exists, MUST be accessible at `https://example.com/charts/mychart-1.2.3.tgz.prov`. 237 238 From the end user's perspective, `helm install --verify myrepo/mychart-1.2.3` 239 should result in the download of both the chart and the provenance file with no 240 additional user configuration or action. 241 242 ## Establishing Authority and Authenticity 243 244 When dealing with chain-of-trust systems, it is important to be able to 245 establish the authority of a signer. Or, to put this plainly, the system 246 above hinges on the fact that you trust the person who signed the chart. 247 That, in turn, means you need to trust the public key of the signer. 248 249 One of the design decisions with Kubernetes Helm has been that the Helm 250 project would not insert itself into the chain of trust as a necessary 251 party. We don't want to be "the certificate authority" for all chart 252 signers. Instead, we strongly favor a decentralized model, which is part 253 of the reason we chose OpenPGP as our foundational technology. 254 So when it comes to establishing authority, we have left this 255 step more-or-less undefined in Helm 2.0.0. 256 257 However, we have some pointers and recommendations for those interested 258 in using the provenance system: 259 260 - The [Keybase](https://keybase.io) platform provides a public 261 centralized repository for trust information. 262 - You can use Keybase to store your keys or to get the public keys of others. 263 - Keybase also has fabulous documentation available 264 - While we haven't tested it, Keybase's "secure website" feature could 265 be used to serve Helm charts. 266 - The [official Kubernetes Charts project](https://github.com/kubernetes/charts) 267 is trying to solve this problem for the official chart repository. 268 - There is a long issue there [detailing the current thoughts](https://github.com/kubernetes/charts/issues/23). 269 - The basic idea is that an official "chart reviewer" signs charts with 270 her or his key, and the resulting provenance file is then uploaded 271 to the chart repository. 272 - There has been some work on the idea that a list of valid signing 273 keys may be included in the `index.yaml` file of a repository. 274 275 Finally, chain-of-trust is an evolving feature of Helm, and some 276 community members have proposed adapting part of the OSI model for 277 signatures. This is an open line of inquiry in the Helm team. If you're 278 interested, jump on in.