Files
Homelabv4/infrastructure/kyverno/policies/disallow-automount-sa-token.yaml
T
Scooby HuskyandClaude Opus 4.6 f8eea2ed45 Remove nessus from cluster configuration
Remove all nessus references: ArgoCD project destination, Istio ambient
enrollment, waypoint gateway, authorization policies, ext-authz policy,
TLS certificate, ingress gateway host, Kyverno exclusion, and Authentik
forward-auth blueprint.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 21:02:45 -05:00

70 lines
2.0 KiB
YAML

apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: disallow-automount-sa-token
annotations:
policies.kyverno.io/title: Disallow Automount Service Account Token
policies.kyverno.io/category: DoD STIG
policies.kyverno.io/severity: medium
policies.kyverno.io/description: >-
STIG V-242382: Pods that do not need to communicate with the
Kubernetes API server should have automountServiceAccountToken
set to false to prevent credential exposure.
pod-policies.kyverno.io/autogen-controllers: none
spec:
validationFailureAction: Audit
background: true
rules:
- name: validate-automount
skipBackgroundRequests: true
match:
any:
- resources:
kinds:
- Pod
exclude:
any:
- resources:
namespaces:
- kube-system
- kube-public
- kube-node-lease
- kyverno
- istio-system
- cert-manager
- cnpg-system
- external-secrets
- vault
- rook-ceph
- prometheus
- argocd
- envoy-gateway-system
- kiali-operator
- mariadb-system
- redis-operator
- reloader
- scylla-operator
- crowdsec
- external-dns
- frigate
- gitlab
- grafana
- guacamole
- home-assistant
- mqtt
- netbird
- nextcloud
- teslamate
- unpoller
- authentik
- checkov
- n8n
validate:
allowExistingViolations: true
message: >-
Pods should set automountServiceAccountToken to false unless API
access is required (STIG V-242382).
pattern:
spec:
automountServiceAccountToken: false