3 ms·
Check your secrets into Git [video]
- mooreds 3y agotl;didn't watch (because it is, after all, an hour): * best you can do for secrets if you don't control the secret consuming service (such as an API) is to use a key management service, encrypt your secret and check that into git. Then, when you need to use the secret, call into the key management service, decrypt it, and present it to the service. * if you do control the service consuming secret, then you can have the production server create a public private keypair, send the public key up to the service, and encrypt and store the private key in a KMS. Then, when you need to access the service, decrypt the private key, use it to sign something (like a JWT), and present it to the service. The service can verify the caller is who gave them the public key. Slides here: https://docs.google.com/presentation/d/e/2PACX-1vSlrYb8nmtlH8HcVgBRhCnF3-A-Av8WG5YHe6Nte5ly49uL-Ug2JK7wQnPJ6FYi5VZ69vt49y3emLtj/pub?start=false&loop=false&delayms=30000&slide=id.p https://docs.google.com/presentation/d/e/2PACX-1vSlrYb8nmtlH... Disclosure: I work for a competitor of the presenter.
- dharmab 3y agoI'm not a fan of this approach. I think the Secrets Store CSI Driver (https://github.com/kubernetes-sigs/secrets-store-csi-driver https://github.com/kubernetes-sigs/secrets-store-csi-driver) has a better approach. It mounts secrets directly from a KMS (e.g. Vault, AWS KMS, GCP KMS, Azure Key Vault) into your application's file system. Why not environment variables? Because files have stronger access control mechanisms than environment variables. Someone in the same PID namespace as your process can see your environment variables, but they can't necessarily see your files.(Although the driver does support environment variables for compatibility: https://secrets-store-csi-driver.sigs.k8s.io/topics/set-as-env-var https://secrets-store-csi-driver.sigs.k8s.io/topics/set-as-e...)
- montroser 3y agoBasically, the simpler the better -- just encrypt your secrets and check them in to version control. We use SOPS[0] for this, and have found it to be pretty nice. [0]: https://github.com/getsops/sops https://github.com/getsops/sops