This product is not supported for your selected Datadog site. ().

Metadata

Id: 5da47109-f8d6-4585-9e2b-96a8958a12f5

Cloud Provider: k8s

Platform: Kubernetes

Severity: High

Category: Access Control

Learn More

Description

When running kube-apiserver, the --basic-auth-file flag should not be set. The rule inspects containers and initContainers whose command includes kube-apiserver and reports the resource if the --basic-auth-file flag is present. Basic auth files are insecure and deprecated; use supported authentication mechanisms (for example, client certificates or tokens) instead.

Compliant Code Examples

apiVersion: v1
kind: Pod
metadata:
  name: command-demo
  labels:
    purpose: demonstrate-command
spec:
  containers:
    - name: command-demo-container
      image: gcr.io/google_containers/kube-apiserver-amd64:v1.6.0
      command: ["kube-apiserver"]
  restartPolicy: OnFailure
apiVersion: v1
kind: Pod
metadata:
  name: command-demo
  labels:
    purpose: demonstrate-command
spec:
  containers:
    - name: command-demo-container
      image: gcr.io/google_containers/kube-apiserver-amd64:v1.6.0
      command: ["kube-apiserver"]
      args: []
  restartPolicy: OnFailure

Non-Compliant Code Examples

apiVersion: v1
kind: Pod
metadata:
  name: command-demo
  labels:
    purpose: demonstrate-command
spec:
  containers:
    - name: command-demo-container
      image: gcr.io/google_containers/kube-apiserver-amd64:v1.6.0
      command: ["kube-apiserver"]
      args: ["--basic-auth-file=/path/to/any/file"]
  restartPolicy: OnFailure
apiVersion: v1
kind: Pod
metadata:
  name: command-demo
  labels:
    purpose: demonstrate-command
spec:
  containers:
    - name: command-demo-container
      image: gcr.io/google_containers/kube-apiserver-amd64:v1.6.0
      command: ["kube-apiserver", "--basic-auth-file=/path/to/any/file"]
  restartPolicy: OnFailure