You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since key hierarchy is implemented at the KMS plugin level, it should be seamless for the kube-apiserver. So whether the plugin is using a key hierarchy or not, the kube-apiserver should behave the same.
152
152
153
-
What is required of the kube-apiserver is to be able to tell the KMS plugin which KEK (local KEK or KMS KEK) it should use to decrypt the incoming DEK. To do so, upon encryption, the KMS plugin could provide the encrypted local KEK as part of the `annotations` field in the `EncryptResponse`. The kube-apiserver would then store it in etcd next to the DEK. Upon decryption, the kube-apiserver provides the encrypted local KEK in `annotations` and `observed_key_id` from the last encryption when calling Decrypt. In case no encrypted local KEK is provided in the `annotations`, then we can assume key hierarchy is not used. The KMS plugin would query the external KMS to use the remote KEK to decrypt the DEK (same behavior as today). No state coordination is required between different instances of the KMS plugin.
153
+
What is required of the kube-apiserver is to be able to tell the KMS plugin which KEK (local KEK or KMS KEK) it should use to decrypt the incoming DEK. To do so, upon encryption, the KMS plugin could provide the encrypted local KEK as part of the `annotations` field in the `EncryptResponse`. The kube-apiserver would then store it in etcd next to the DEK. Upon decryption, the kube-apiserver provides the encrypted local KEK in `annotations` and `key_id` from the last encryption when calling Decrypt. In case no encrypted local KEK is provided in the `annotations`, then we can assume key hierarchy is not used. The KMS plugin would query the external KMS to use the remote KEK to decrypt the DEK (same behavior as today). No state coordination is required between different instances of the KMS plugin.
154
154
155
155
For the reference KMS plugin, the encrypted local KEK is stored in etcd via the `annotations` field, and once decrypted, it can be stored in memory as part of the KMS plugin cache to be used for encryption and decryption of DEKs. The encrypted local KEK is used as the key and the decrypted local KEK is stored as the value.
156
156
157
157
```proto
158
158
message EncryptResponse {
159
159
// The encrypted data.
160
160
bytes ciphertext = 1;
161
-
// The KMS key ID used for encryption operations.
162
-
// This can be used to drive rotation.
161
+
// The KMS key ID used to encrypt the data. This must always refer to the KMS KEK and not any local KEKs that may be in use.
162
+
// This can be used to inform staleness of data updated via value.Transformer.TransformFromStorage.
163
163
string key_id = 2;
164
164
// Additional metadata to be stored with the encrypted data.
165
-
// The annotations can contain the encrypted local KEK that was used to encrypt the DEK.
166
-
// Stored unencrypted in etcd.
165
+
// This metadata can contain the encrypted local KEK that was used to encrypt the DEK.
166
+
// This data is stored in plaintext in etcd. KMS plugin implementations are responsible for pre-encrypting any sensitive data.
167
167
map<string, bytes> annotations = 3;
168
168
}
169
169
```
170
170
171
-
The `DecryptRequest` passes the same `key_id` and `annotations` returned by the previous `EncryptResponse` of this data as its `observed_key_id` and `metadata` for the decryption request.
171
+
The `DecryptRequest` passes the same `key_id` and `annotations` returned by the previous `EncryptResponse` of this data as its `key_id` and `metadata` for the decryption request.
172
172
173
173
```proto
174
174
message DecryptRequest {
@@ -178,18 +178,14 @@ message DecryptRequest {
178
178
string uid = 2;
179
179
// The keyID that was provided to the apiserver during encryption.
180
180
// This represents the KMS KEK that was used to encrypt the data.
181
-
string observed_key_id = 3;
181
+
string key_id = 3;
182
182
// Additional metadata that was sent by the KMS plugin during encryption.
183
183
map<string, bytes> annotations = 4;
184
184
}
185
185
186
186
message DecryptResponse {
187
187
// The decrypted data.
188
188
bytes plaintext = 1;
189
-
// The KMS key ID used to decrypt the data.
190
-
string key_id = 2;
191
-
// Additional metadata that was sent by the KMS plugin.
192
-
map<string, bytes> annotations = 3;
193
189
}
194
190
195
191
message EncryptRequest {
@@ -230,13 +226,11 @@ To improve health check reliability, the new StatusResponse provides version, he
230
226
message StatusRequest {}
231
227
232
228
message StatusResponse {
233
-
// Version of the KMS plugin API.
229
+
// Version of the KMS plugin API. Must match the configured .resources[].providers[].kms.apiVersion
234
230
string version = 1;
235
-
236
-
// anything other than "ok" is failing healthz
231
+
// Any value other than "ok" is failing healthz. On failure, the associated API server healthz endpoint will contain this value as part of the error message.
237
232
string healthz = 2;
238
-
239
-
// the current write key, can be used to trigger rotation
233
+
// the current write key, used to determine staleness of data updated via value.Transformer.TransformFromStorage.
240
234
string key_id = 3;
241
235
}
242
236
```
@@ -314,7 +308,7 @@ sequenceDiagram
314
308
participant externalkms
315
309
%% if local KEK in annotations, then using hierarchy
316
310
alt encrypted local KEK is in annotations
317
-
kubeapiserver->>kmsplugin: decrypt request <br/> {"ciphertext": "<encrypted DEK>", observed_key_id: "<key_id gotten as part of EncryptResponse>", <br/> "annotations": {"kms.kubernetes.io/local-kek": "<encrypted local KEK>"}}
311
+
kubeapiserver->>kmsplugin: decrypt request <br/> {"ciphertext": "<encrypted DEK>", key_id: "<key_id gotten as part of EncryptResponse>", <br/> "annotations": {"kms.kubernetes.io/local-kek": "<encrypted local KEK>"}}
0 commit comments