github.com/khulnasoft-lab/defsec@v1.0.5-0.20230827010352-5e9f46893d95/rules/kubernetes/policies/cisbenchmarks/apiserver/token_auth_file.rego (about) 1 # METADATA 2 # title: "Ensure that the --token-auth-file parameter is not set" 3 # description: "Do not use token based authentication." 4 # scope: package 5 # schemas: 6 # - input: schema["kubernetes"] 7 # related_resources: 8 # - https://www.cisecurity.org/benchmark/kubernetes 9 # custom: 10 # id: KCV0002 11 # avd_id: AVD-KCV-0002 12 # severity: LOW 13 # short_code: ensure-token-auth-file-parameter-is-not-set 14 # recommended_action: "Follow the documentation and configure alternate mechanisms for authentication. Then, edit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml on the master node and remove the --token-auth-file=<filename> parameter." 15 # input: 16 # selector: 17 # - type: kubernetes 18 package builtin.kubernetes.KCV0002 19 20 import data.lib.kubernetes 21 22 check_flag[container] { 23 container := kubernetes.containers[_] 24 kubernetes.is_apiserver(container) 25 some i 26 regex.match("--token-auth-file", container.command[i]) 27 } 28 29 deny[res] { 30 output := check_flag[_] 31 msg := "Ensure that the --token-auth-file parameter is not set" 32 res := result.new(msg, output) 33 }