From 723462f3908abd1a9a069b886cd7fd744c40aba1 Mon Sep 17 00:00:00 2001 From: Lance Walters Date: Fri, 27 Nov 2026 00:58:10 -0500 Subject: [PATCH] docs(audit): record the read/write split evidence and the pre-split purge Live proof from the fresh audit.log after the apiserver reload (policy 9f07d333): 263 read verbs all Metadata with 0 responseObject/0 data, 76 write verbs all RequestResponse with requestObject; plus the throwaway-probe create/patch/update/ delete ladder. Documents the purge: pre-split files (39 MB .gz + 15 MB moved live file) deleted, oldest remaining file is the fresh audit.log. --- docs/kube-apiserver-audit-logging.md | 50 ++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/docs/kube-apiserver-audit-logging.md b/docs/kube-apiserver-audit-logging.md index 643bf20..04b6a5c 100644 --- a/docs/kube-apiserver-audit-logging.md +++ b/docs/kube-apiserver-audit-logging.md @@ -98,6 +98,34 @@ encryption/retention story. The Loki/Alloy stack in `infrastructure/logging/` do directory today (`/var/log/pods` + `/var/log/journal` only) — keep it that way unless the pipeline has an encryption story. +## Purge: files written before the split (2026-11-27) + +The bodies already on disk were upstream of the policy fix, so they were cut rather than left to age +out. `truncate -s 0` is wrong here — the apiserver keeps writing at its own offset and the file stays +sparse — so the live file was **moved aside while the apiserver still held its fd** (no bytes lost), +the container was restarted so the new process created a fresh `audit.log` instead of appending, and the +superseded files were then deleted: + +``` +/var/log/kubernetes/audit before: audit-2026-11-27T05-45-22.804.log.gz 39,423,475 + audit-pre-readfix-20261127T055416Z.log 15,037,570 (the moved live file) + audit.log 7,440,332 (fresh, post-change) +after: audit.log 7,440,332 age ~1 min +``` + +Summary of what those files held, extracted before deletion (the only part worth keeping): + +``` +secret events 3,527 (get 1,606, patch 899, watch 721, update 196, delete 49, list 43, create 13) +with responseObject 2,753 | with responseObject.data 2,574 +readers: kubernetes-admin, kustomize-controller, source-controller, kube-prometheus-stack-grafana, + sirius-growth:portal, cert-manager, cnpg-manager, and per-node kubelet identities +``` + +Rotation later in the run only replaces files that were written under the split, so nothing with a read +body can reappear. The `throwaway-probe` values from the write-path proof are the only secret values in +the fresh log, and that secret no longer exists. + ## Verify it is live ```bash @@ -117,11 +145,29 @@ kubectl -n forgejo get secret forgejo-pg-app -o name sudo grep -c forgejo-pg-app /var/log/kubernetes/audit/audit.log ``` -Live proof captured 2026-11-27T05:18Z (final policy): +Live proof — **read/write split, captured 2026-11-27T05:57Z** (policy merged as `9f07d333`, apiserver +restarted to reload it, one fresh `audit.log`): + +``` +verb level secret code body +get Metadata forgejo/forgejo-pg-app 200 none — no requestObject, no responseObject, no `data` substring +create RequestResponse audit-probe/throwaway-probe 201 requestObject.data = {key} +patch RequestResponse audit-probe/throwaway-probe 200 requestObject = {"stringData":{"added":…}} (the patch document) +update RequestResponse audit-probe/throwaway-probe 200 requestObject.data = {added, key, replaced} +delete RequestResponse audit-probe/throwaway-probe 200 DeleteOptions, no object body +get Metadata audit-probe/throwaway-probe 404 objectRef + responseStatus only (post-delete read still recorded) +``` + +Whole-file check over the first 339 secret events of the fresh log: **263 read verbs (`get`/`list`/`watch`), +all `Metadata`, 0 with `responseObject`, 0 with `data`**; 76 write verbs, all `RequestResponse` carrying +`requestObject`. A merge patch's `requestObject` is the patch document itself, which is exactly the +tampering evidence (an attacker's key appears verbatim in `stringData`). + +Earlier proof, 2026-11-27T05:18Z (pre-split policy), kept for the `pods/exec` shape: ``` secret 404 kubernetes-admin get forgejo/pg-superuser code 404 RequestResponse (the audit card's literal command; the secret is named forgejo-pg-app) -secret get kubernetes-admin get forgejo/forgejo-pg-app code 200 request+response (responseObject carries .data) +secret get kubernetes-admin get forgejo/forgejo-pg-app code 200 request+response (responseObject carries .data — PRE-SPLIT; now Metadata with no body) rbac write kubernetes-admin create forgejo/audit-trail-probe (dryRun=All) code 201 RequestResponse pods/exec kubernetes-admin get forgejo//exec code 101 full command line ResponseStarted + ResponseComplete ```