Secrets in etcd and the audit log
Encrypting Secrets in etcd with a rewrite and cleanup of old revisions, and an audit policy that notices Secret reads without writing their values to the log.
The seventh lesson of the hardening track: secrets on disk and a trace in the log. By default Secrets in etcd are stored as plaintext, and a copy of the control plane disk hands over every password in the cluster, bypassing RBAC. And reading Secrets with a legitimate but stolen token leaves no trace if the apiserver doesn't write an audit log.
Threat model
Two scenarios. In the first the attacker has a copy of the etcd database file: a backup or a snapshot of the node disk. In the second they have the token of the backup ServiceAccount, which is supposed to read all Secrets as part of its job.
Attack path
- The etcd file from the node and a search for the password with an ordinary
grep. - Old revisions in the etcd file, which stay even after encryption is turned on.
- Reading all Secrets with the backup token during the day, without a single record in the log.
Checklist
- The first provider in EncryptionConfiguration is an encrypting one, in production KMS with the key outside etcd.
- After encryption is turned on, all Secrets are rewritten and old revisions are removed with compact and defrag.
- The result is checked by the Secret value in etcd, not by the absence of apiserver errors.
- The audit policy writes Secret access at the
Metadatalevel, and the rules are in the right order. - The log goes to a log collection system, with a rule for Secret reads by the wrong subject.
Practice
Two labs on the shared cluster of the track. In the first you turn on Secret encryption and clean up the etcd history until a copy of the database file stops giving away the password. In the second you write an audit policy after which a Secret read with the backup token shows up in the log, while the values themselves stay out of it.
Done reading?
Mark the lesson as read to move your track progress forward.
Lesson marked as done.
Practice
Fix a local lab. The agent checks your work and gives hints if you get stuck.
Full access to all labs
One payment, no auto-renewal · Terms
Progress saved in this browser
Clear your history or open this on your phone, and the marks will be gone. Leave your email and they'll move to your account. No password needed.
Done. moved to your account. You can see your progress on any device. My progress