homek8s/apps/base/secops/serviceaccount.yaml
Lance Walters 2e52bfad24 apps(secops): scoped read-only auditor ServiceAccount + ClusterRole (F8)
Security runs had no read-only identity: every audit ran as kubernetes-admin
(system:masters), the identity that can delete the cluster, so the auditor was
the largest privilege holder in the environment.

New ns secops with SA secops-auditor bound to a from-scratch ClusterRole:

  get,list,watch  pods services endpoints events configmaps namespaces nodes
  get,list,watch  * in apps, batch, networking.k8s.io,
                    gateway.networking.k8s.io, cilium.io
  get             pods/log

Deliberately absent: secrets (all verbs), pods/exec, pods/attach, every write
verb, impersonate/escalate/bind. Not bound to view/edit/admin (all three carry
Secrets; edit reads Secret data).

The bearer token is a credential and is generated out of band into
~/.kube/secops.yaml (mode 600) — see the SA manifest comment for the one-liner.
2026-11-27 00:08:14 -05:00

18 lines
794 B
YAML

# Read-only audit identity for security runs (netsec design §3.3, audit finding F8).
#
# Security work must NOT run as kubernetes-admin / system:masters: that identity
# can delete the cluster, so an investigator holding it is the largest privilege
# holder in the environment. This SA exists so audit runs are scoped, attributable
# and harmless. It holds no secrets and cannot exec/attach into pods.
#
# The kubeconfig that carries it is generated out of band (a token is a credential
# and must never be committed):
# kubectl -n secops create token secops-auditor --duration=8760h
# and written to ~/.kube/secops.yaml (mode 600) on the operator host.
apiVersion: v1
kind: ServiceAccount
metadata:
name: secops-auditor
namespace: secops
labels:
app.kubernetes.io/part-of: secops