Back to Checks
iac

Ensure that the --peer-cert-file and --peer-key-file arguments are set as appropriate

KCV-0045
Service: kubernetesSeverity: low
OfficialBuilt-inVerified

etcd should be configured to make use of TLS encryption for peer connections.

Run this check with Prowler

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

Recommendation

Follow the etcd service documentation and configure peer TLS encryption as appropriate for your etcd cluster. Then, edit the etcd pod specification file /etc/kubernetes/manifests/etcd.yaml on the master node and set the below parameters.

Check Code

# METADATA
# title: "Ensure that the --peer-cert-file and --peer-key-file arguments are set as appropriate"
# description: "etcd should be configured to make use of TLS encryption for peer connections."
# scope: package
# schemas:
# - input: schema["kubernetes"]
# related_resources:
# - https://www.cisecurity.org/benchmark/kubernetes
# custom:
#   id: KCV-0045
#   long_id: kubernetes-ensure-peer-cert-file-and-peer-key-file-arguments-are-set-as-appropriate
#   aliases:
#     - AVD-KCV-0045
#     - KCV0045
#     - ensure-peer-cert-file-and-peer-key-file-arguments-are-set-as-appropriate
#     - kubernetes-ensure-peer-cert-file-and-peer-key-file-arguments-are-set-as-appropriate
#   severity: LOW
#   recommended_action: "Follow the etcd service documentation and configure peer TLS encryption as appropriate for your etcd cluster. Then, edit the etcd pod specification file /etc/kubernetes/manifests/etcd.yaml on the master node and set the below parameters."
#   input:
#     selector:
#     - type: kubernetes
package builtin.kubernetes.KCV0045

import rego.v1

import data.lib.kubernetes

checkFlag(container) if {
	kubernetes.command_has_flag(container.command, "--peer-cert-file")
	kubernetes.command_has_flag(container.command, "--peer-key-file")
}

checkFlag(container) if {
	kubernetes.command_has_flag(container.args, "--peer-cert-file")
	kubernetes.command_has_flag(container.args, "--peer-key-file")
}

deny contains res if {
	container := kubernetes.containers[_]
	kubernetes.is_etcd(container)
	not checkFlag(container)
	msg := "Ensure that the --peer-cert-file and --peer-key-file arguments are set as appropriate"
	res := result.new(msg, container)
}