Back to Checks
Ensure that the --authorization-mode argument is not set to AlwaysAllow
KCV-0007
Service: kubernetesSeverity: low
OfficialBuilt-inVerified
Do not always authorize all requests.
Run this check with Prowler
Run in Prowler CloudRun
prowler iac --checks KCV-0007Recommendation
Edit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml on the Control Plane node and set the --authorization-mode parameter to values other than AlwaysAllow.
Check Code
# METADATA
# title: "Ensure that the --authorization-mode argument is not set to AlwaysAllow"
# description: "Do not always authorize all requests."
# scope: package
# schemas:
# - input: schema["kubernetes"]
# related_resources:
# - https://www.cisecurity.org/benchmark/kubernetes
# custom:
# id: KCV-0007
# long_id: kubernetes-ensure-authorization-mode-argument-is-not-set-to-alwaysallow
# aliases:
# - AVD-KCV-0007
# - KCV0007
# - ensure-authorization-mode-argument-is-not-set-to-alwaysallow
# - kubernetes-ensure-authorization-mode-argument-is-not-set-to-alwaysallow
# severity: LOW
# recommended_action: "Edit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml on the Control Plane node and set the --authorization-mode parameter to values other than AlwaysAllow. "
# input:
# selector:
# - type: kubernetes
package builtin.kubernetes.KCV0007
import rego.v1
import data.lib.kubernetes
check_flag(container) if {
some i
output := regex.find_all_string_submatch_n(`--authorization-mode=([^\s]+)`, container.command[i], -1)
regex.match("AlwaysAllow", output[0][1])
}
deny contains res if {
container := kubernetes.containers[_]
kubernetes.is_apiserver(container)
check_flag(container)
msg := "Ensure that the --authorization-mode argument is not set to AlwaysAllow"
res := result.new(msg, container)
}