Back to Checks
iac

Ensure that the container network interface file permissions are set to 600 or more restrictive

KCV-0056
Service: kubernetesSeverity: high
OfficialBuilt-inVerified

Ensure that the container network interface file has permissions of 600 or more restrictive.

Run this check with Prowler

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

Recommendation

Change the container network interface file path/to/cni/files permissions of 600 or more restrictive

Check Code

# METADATA
# title: "Ensure that the container network interface file permissions are set to 600 or more restrictive"
# description: "Ensure that the container network interface file has permissions of 600 or more restrictive."
# scope: package
# schemas:
# - input: schema["kubernetes"]
# related_resources:
# - https://www.cisecurity.org/benchmark/kubernetes
# custom:
#   id: KCV-0056
#   long_id: kubernetes-ensure-container-network-interface-file-permissions-set-600-or-more-restrictive
#   aliases:
#     - AVD-KCV-0056
#     - KCV0056
#     - ensure-container-network-interface-file-permissions-set
#     - ensure-container-network-interface-file-permissions-set-600-or-more-restrictive
#     - kubernetes-ensure-container-network-interface-file-permissions-set-600-or-more-restrictive
#   severity: HIGH
#   recommended_action: "Change the container network interface file path/to/cni/files permissions of 600 or more restrictive "
#   input:
#     selector:
#     - type: kubernetes
#       subtypes:
#         - kind: nodeinfo
package builtin.kubernetes.KCV0056

import rego.v1

validate_cni_permission(sp) := {"containerNetworkInterfaceFilePermissions": violation} if {
	sp.kind == "NodeInfo"
	sp.type == "master"
	violation := {permission | permission = sp.info.containerNetworkInterfaceFilePermissions.values[_]; permission > 600}
	count(violation) > 0
}

deny contains res if {
	output := validate_cni_permission(input)
	msg := "Ensure that the Container Network Interface specification file permissions are set to 600 or more restrictive"
	res := result.new(msg, output)
}