github.com/khulnasoft-lab/defsec@v1.0.5-0.20230827010352-5e9f46893d95/rules/kubernetes/policies/cisbenchmarks/kubelet/kubelet_make_iptables_util_chains.rego (about) 1 # METADATA 2 # title: "Ensure that the --make-iptables-util-chains argument is set to true" 3 # description: "Allow Kubelet to manage iptables." 4 # scope: package 5 # schemas: 6 # - input: schema["kubernetes"] 7 # related_resources: 8 # - https://www.cisecurity.org/benchmark/kubernetes 9 # custom: 10 # id: KCV0084 11 # avd_id: AVD-KCV-0084 12 # severity: HIGH 13 # short_code: ensure-make-iptables-util-chains-argument-set-true 14 # recommended_action: "If using a Kubelet config file, edit the file to set makeIPTablesUtilChains: true" 15 # input: 16 # selector: 17 # - type: kubernetes 18 package builtin.kubernetes.KCV0084 19 20 import data.lib.kubernetes 21 22 types := ["master", "worker"] 23 24 validate_kubelet_iptables_util_chains_set(sp) := {"kubeletMakeIptablesUtilChainsArgumentSet": violation} { 25 sp.kind == "NodeInfo" 26 sp.type == types[_] 27 violation := {iptables_util_chains | iptables_util_chains = sp.info.kubeletMakeIptablesUtilChainsArgumentSet.values[_]; not iptables_util_chains == "true"} 28 count(violation) > 0 29 } 30 31 deny[res] { 32 output := validate_kubelet_iptables_util_chains_set(input) 33 msg := "Ensure that the --make-iptables-util-chains argument is set to true" 34 res := result.new(msg, output) 35 }