github.com/khulnasoft-lab/defsec@v1.0.5-0.20230827010352-5e9f46893d95/rules/kubernetes/policies/cisbenchmarks/apiserver/etcd_cafile.rego (about) 1 # METADATA 2 # title: "Ensure that the --etcd-cafile argument is set as appropriate" 3 # description: "etcd should be configured to make use of TLS encryption for client connections." 4 # scope: package 5 # schemas: 6 # - input: schema["kubernetes"] 7 # related_resources: 8 # - https://www.cisecurity.org/benchmark/kubernetes 9 # custom: 10 # id: KCV0029 11 # avd_id: AVD-KCV-0029 12 # severity: LOW 13 # short_code: ensure-etcd-cafile-argument-is-set-as-appropriate 14 # recommended_action: "Follow the Kubernetes documentation and set up the TLS connection between the apiserver and etcd. Then, edit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml on the master node and set the etcd certificate authority file parameter." 15 # input: 16 # selector: 17 # - type: kubernetes 18 package builtin.kubernetes.KCV0029 19 20 import data.lib.kubernetes 21 22 check_flag[container] { 23 container := kubernetes.containers[_] 24 kubernetes.is_apiserver(container) 25 not kubernetes.command_has_flag(container.command, "--etcd-cafile") 26 } 27 28 deny[res] { 29 output := check_flag[_] 30 msg := "Ensure that the --etcd-cafile argument is set as appropriate" 31 res := result.new(msg, output) 32 }