Back to Checks
iac

Ensure that the --audit-log-path argument is set

KCV-0019
Service: kubernetesSeverity: low
OfficialBuilt-inVerified

Enable auditing on the Kubernetes API Server and set the desired audit log path.

Run this check with Prowler

Run in Prowler Cloud
Run
prowler iac --checks KCV-0019

Recommendation

Edit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml on the Control Plane node and set the --audit-log-path parameter.

Check Code

# METADATA
# title: "Ensure that the --audit-log-path argument is set"
# description: "Enable auditing on the Kubernetes API Server and set the desired audit log path."
# scope: package
# schemas:
# - input: schema["kubernetes"]
# related_resources:
# - https://www.cisecurity.org/benchmark/kubernetes
# custom:
#   id: KCV-0019
#   long_id: kubernetes-ensure-audit-log-path-argument-is-set
#   aliases:
#     - AVD-KCV-0019
#     - KCV0019
#     - ensure-audit-log-path-argument-is-set
#     - kubernetes-ensure-audit-log-path-argument-is-set
#   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 --audit-log-path parameter."
#   input:
#     selector:
#     - type: kubernetes
package builtin.kubernetes.KCV0019

import rego.v1

import data.lib.kubernetes

check_flag(container) if {
	kubernetes.command_has_flag(container.command, "--audit-log-path")
}

check_flag(container) if {
	kubernetes.command_has_flag(container.args, "--audit-log-path")
}

deny contains res if {
	container := kubernetes.containers[_]
	kubernetes.is_apiserver(container)
	not check_flag(container)
	msg := "Ensure that the --audit-log-path argument is set"
	res := result.new(msg, container)
}