Back to Checks
kubernetes

API server pod does not have --token-auth-file enabled

apiserver_no_token_auth_file
Service: apiserverSeverity: high
OfficialBuilt-inVerified
Categories:cluster-securityidentity-access
Resource Type:Pod

Kubernetes API server configuration is reviewed for use of static token file authentication by inspecting API server containers for the --token-auth-file argument

Risk

Using static bearer tokens undermines CIA:

  • Confidentiality: leaked tokens grant API access
  • Integrity: long-lived tokens enable unauthorized changes
  • Availability: access can't be revoked quickly Tokens are clear-text and lack revocation/rotation, enabling persistent access if exposed.

Run this check with Prowler

Run in Prowler Cloud
Run
prowler kubernetes --checks apiserver_no_token_auth_file

Recommendation

Avoid static token files. Prefer client certificates, OIDC/webhook authenticators, or service accounts with short-lived tokens. Apply least privilege with RBAC, enforce rotation and short expirations, and disable --token-auth-file to support defense in depth and rapid credential revocation.

Remediation

Other

1SSH to each control plane node
2Open /etc/kubernetes/manifests/kube-apiserver.yaml
3In spec.containers[0].command, remove the line containing: --token-auth-file=</path/to/file>
4Save the file; the kubelet will automatically restart the API server
5Repeat on all control plane nodes
6Verify the flag is absent: kubectl -n kube-system get pods -l component=kube-apiserver -o yaml | grep -- --token-auth-file || echo "not present"

Check Code

from prowler.lib.check.models import Check, Check_Report_Kubernetes
from prowler.providers.kubernetes.services.apiserver.apiserver_client import (
    apiserver_client,
)


class apiserver_no_token_auth_file(Check):
    def execute(self) -> Check_Report_Kubernetes:
        findings = []
        for pod in apiserver_client.apiserver_pods:
            report = Check_Report_Kubernetes(metadata=self.metadata(), resource=pod)
            report.status = "PASS"
            report.status_extended = (
                f"API Server does not have token-auth-file enabled in pod {pod.name}."
            )
            for container in pod.containers.values():
                if "--token-auth-file" in str(container.command):
                    report.status = "FAIL"
                    report.status_extended = (
                        f"API Server has token-auth-file enabled in pod {pod.name}."
                    )
                    break
            findings.append(report)
        return findings