|
| 1 | +# Best Practices |
| 2 | + |
| 3 | +1. Deploy the driver and providers into the `kube-system` or a separate |
| 4 | + dedicated namespace. |
| 5 | + |
| 6 | + The driver is installed as a `DaemonSet` with the ability mount kubelet |
| 7 | + `hostPath` volumes and view pod service account tokens. It should be treated |
| 8 | + as privileged and regular cluster users should not have permissions to |
| 9 | + deploy or modify the driver. |
| 10 | + |
| 11 | +1. Do not grant regular cluster users permissions to modify |
| 12 | + `SecretProviderClassPodStatus` resources. |
| 13 | + |
| 14 | + The `SecretProviderClassPodStatus` CRD is used by the driver to keep track |
| 15 | + of mounted resources. Manually editing this resource could have unexpected |
| 16 | + consequences to the system health and in particular modifying |
| 17 | + `SecretProviderClassPodStatus/status` may have security implications. |
| 18 | + |
| 19 | +1. Disable `Secret` sync if not needed. |
| 20 | + |
| 21 | + If you do not intend to use the `Secret` syncing feature, do not install the |
| 22 | + RBAC permissions that allow the driver to access cluster `Secret` objects. |
| 23 | + |
| 24 | + This can be done by setting `syncSecret.enabled = false` when installing |
| 25 | + with helm. |
| 26 | + |
| 27 | +1. Enable KMS application wrapping if using `Secret` sync. |
| 28 | + |
| 29 | + If you need to synchronise your external secrets to Kubernetes `Secret`s |
| 30 | + consider configuring |
| 31 | + [encryption of data at rest](https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/) |
| 32 | + |
| 33 | + This will ensure that data is encrypted before it is stored in `etcd`. |
| 34 | + |
| 35 | +1. Keep the driver up to date. |
| 36 | + |
| 37 | + Subscribe to the |
| 38 | + [`kubernetes-secrets-store-csi-driver`](https://groups.google.com/forum/#!forum/kubernetes-secrets-store-csi-driver) |
| 39 | + mailing list to be notified of new releases and security announcements. |
| 40 | + |
| 41 | + Consider using the |
| 42 | + [Github Watch](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/viewing-your-subscriptions) |
| 43 | + feature to subscribe to releases as well. |
| 44 | + |
| 45 | + Always be sure to review the [release notes](https://github.com/kubernetes-sigs/secrets-store-csi-driver/releases) |
| 46 | + before upgrading. |
| 47 | + |
| 48 | +1. When evaluating this driver consider the following threats: |
| 49 | + |
| 50 | + * When a secret is accessible on the **filesystem**, application |
| 51 | + vulnerabilities like directory traversal attacks can become higher |
| 52 | + severity as the attacker may gain the ability read the secret material. |
| 53 | + * When a secret is consumed through **environment variables**, |
| 54 | + misconfigurations such as enabling a debug endpoints |
| 55 | + or including dependencies that log process environment details may leak |
| 56 | + secrets. |
| 57 | + * When syncing secret material to Kubernetes Secrets, consider whether the |
| 58 | + access controls on that data store are sufficiently narrow in scope. |
| 59 | + |
| 60 | + If possible, directly integrating with a purpose built secrets API may offer |
| 61 | + the best security tradeoffs. |
0 commit comments