Merge pull request 'docs(audit): record the read/write split evidence and the pre-split purge' (#67) from t_d1275a3a-secret-read-metadata into master
This commit is contained in:
commit
3241eaba1c
1 changed files with 48 additions and 2 deletions
|
|
@ -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/<pod>/exec code 101 full command line ResponseStarted + ResponseComplete
|
||||
```
|
||||
|
|
|
|||
Loading…
Reference in a new issue