id: k8s-etcd-files-set info: name: Ensure etcd cert and key set author: princechaddha severity: medium description: Checks if the etcd-certfile and etcd-keyfile arguments are properly set in the etcd server configuration, crucial for secure communication. impact: | If the etcd-certfile and etcd-keyfile arguments are not set, the etcd server might not encrypt its communications, potentially allowing unauthorized access to sensitive data. remediation: | Configure the etcd server to use etcd-certfile and etcd-keyfile arguments that point to valid certificate and key files respectively. This ensures that communications to and from the etcd server are properly encrypted. reference: - https://etcd.io/docs/v3.4.0/op-guide/security/ tags: cloud,devops,kubernetes,security,devsecops,etcd variables: argument: "etcd-certfile or etcd-keyfile" self-contained: true code: - engine: - sh - bash source: | kubectl get pods -n kube-system -l component=etcd -o jsonpath="{.items[*].spec.containers[*].command}" matchers-condition: and matchers: - type: word words: - 'etcd' - type: word words: - "etcd-certfile" - "etcd-keyfile" negative: true extractors: - type: dsl dsl: - '"etcd server configuration is missing the " + argument + " arguments."' # digest: 4a0a00473045022100cfc23ca747bd1aecd67bf39514f649aaaff7816196d78c5dc95666a03cb4c5090220365eb627df9b1bca710f3a45ef2371ab91d59dd2e43f3d180cd95b119ca758b3:366f2a24c8eb519f6968bd8801c08ebe