Back to Checks
iac

Ensure that the container network interface file ownership is set to root:root

KCV-0057
Service: kubernetesSeverity: high
OfficialBuilt-inVerified

Ensure that the container network interface file ownership is set to root:root.

Run this check with Prowler

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

Recommendation

Change the container network interface file path/to/cni/files ownership to root:root

Check Code

# METADATA
# title: "Ensure that the container network interface file ownership is set to root:root"
# description: "Ensure that the container network interface file ownership is set to root:root."
# scope: package
# schemas:
# - input: schema["kubernetes"]
# related_resources:
# - https://www.cisecurity.org/benchmark/kubernetes
# custom:
#   id: KCV-0057
#   long_id: kubernetes-ensure-container-network-interface-ownership-set-root:root.
#   aliases:
#     - AVD-KCV-0057
#     - KCV0057
#     - ensure-container-network-interface-ownership-set
#     - ensure-container-network-interface-ownership-set-root:root.
#     - kubernetes-ensure-container-network-interface-ownership-set-root:root.
#   severity: HIGH
#   recommended_action: "Change the container network interface file path/to/cni/files ownership to root:root"
#   input:
#     selector:
#     - type: kubernetes
#       subtypes:
#         - kind: nodeinfo
package builtin.kubernetes.KCV0057

import rego.v1

validate_spec_ownership(sp) := {"containerNetworkInterfaceFileOwnership": violation} if {
	sp.kind == "NodeInfo"
	sp.type == "master"
	violation := {ownership | ownership = sp.info.containerNetworkInterfaceFileOwnership.values[_]; not ownership == "root:root"}
	count(violation) > 0
}

deny contains res if {
	output := validate_spec_ownership(input)
	msg := "Ensure that the container network interface file ownership is set to root:root"
	res := result.new(msg, output)
}