Description
EncryptionConfiguration writes each resource with its first provider. If identity comes first, new Secrets are stored in plaintext even if an encryption provider follows.
Potential impact
Exposure of the etcd data can reveal those plaintext Secrets.
Remediation
Put an encryption provider first and keep the providers and keys every API server needs to read existing data. During migration, a later identity entry can read plaintext. Rewrite existing resources and verify encryption before retiring old keys.
Examples
Consider KMS v2 for external key management. For local keys, generate your own and plan restricted access, rotation and recovery. AES-GCM needs automated key rotation. Restrict read access to the configuration and to Secrets through the API.
Before
apiVersion: apiserver.config.k8s.io/v1
kind: EncryptionConfiguration
resources:
- resources:
- secrets
providers:
- identity: {}
- aesgcm:
keys:
- name: key1
secret: c2VjcmV0IGlzIHNlY3VyZQ==
After
apiVersion: apiserver.config.k8s.io/v1
kind: EncryptionConfiguration
resources:
- resources:
- secrets
providers:
- secretbox:
keys:
- name: key1
secret: YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM0NTY=
- identity: {}
- aesgcm:
keys:
- name: key1
secret: c2VjcmV0IGlzIHNlY3VyZQ==
- aescbc:
keys:
- name: key1
secret: c2VjcmV0IGlzIHNlY3VyZQ==
In the second example, secretbox encrypts new writes. The published sample keys are for demonstration only.