我有一个使用提供程序启用了静态加密的玩具 Kubernetes 集群abs-256-cbc
;我在这里没有使用任何保险库来kms
模拟问题。这意味着加密密钥位于主节点上的纯文本文件中。
apiVersion: apiserver.config.k8s.io/v1
kind: EncryptionConfiguration
resources:
- resources:
- secrets
providers:
- aescbc:
keys:
- name: key1
secret: c2VjcmV0IGlzIHNlY3VyZQ==
- identity: {}
假设加密密钥c2VjcmV0IGlzIHNlY3VyZQ==
被泄露,是否有机会解密存储在中的秘密etcd
?
例子:
秘密创作:
k create secret generic secret1-no-encryption --from-literal foo="admin@123"
secret/secret1-no-encryption created
阅读秘密etcd
时不是加密:
sudo ETCDCTL_API=3 etcdctl --endpoints https://192.168.122.191:2379 --cert=/etc/ssl/etcd/ssl/node-test-kube-controller-1.pem --key=/etc/ssl/etcd/ssl/node-test-kube-controller-1-key.pem --cacert=/etc/ssl/etcd/ssl/ca.pem get /registry/secrets/default/secret1-no-encryption
/registry/secrets/default/secret1-no-encryption
k8s
v1Secret▒
▒
secret1-no-encryptiondefault"*$3d45ddaa-2e34-4605-92d2-ad2ad31592692▒▒▒▒`
kubectl-createUpdatev▒▒▒FieldsV1:,
*{"f:data":{".":{},"f:foo":{}},"f:type":{}}B
foo admin@123Opaque"
当 etcd 加密时尝试读取机密:
sudo ETCDCTL_API=3 etcdctl --endpoints https://192.168.122.191:2379 --cert=/etc/ssl/etcd/ssl/node-test-kube-controller-1.pem --key=/etc/ssl/etcd/ssl/node-test-kube-controller-1-key.pem --cacert=/etc/ssl/etcd/ssl/ca.pem get /registry/secrets/default/secret2-with-encryption
/registry/secrets/default/secret2-with-encryption
k8s:enc:aescbc:v1:key1:n%-▒▒▒▒▒Ԩ▒qB▒x'V▒F▒y`l▒_X▒n
8#EEg▒!▒▒Mnk▒S▒▒KQ▒▒F▒NyJ▒$▒J▒▒Q`▒3m▒▒_▒▒U▒!7ZP▒bm▒x▒▒▒\▒{▒)e▒4▒Q-L▒#▒▒▒ձ▒<8▒▒ndd}Ҏ▒|1k▒▒>▒▒▒J▒R▒.▒▒c▒mɹ▒Q