feat(keycloak): hourly encrypted dump for the backups #742

Sammanfogat
supernaut sammanfogade 3 incheckningar från feat/keycloak-dump-backup in i main 2026-10-14 11:24:38 +00:00
Ägare

Hourly encrypted Keycloak dump, handed to the backups. Works with Keycloak under the shared user today and under bitborg-id after the isolation move.

  • bitborg-keycloak-dump.timer (:07) runs pg_dump -Fc | age as the user that owns Keycloak's Postgres. Output /var/lib/bitborg-id/keycloak-dump/keycloak.dump.age (dir 2750, file 0640, readable by the backup user only).
  • Daily and hot backups copy it and fail if it is missing or older than 150 min. The shared-Postgres pg_dump of Keycloak is gone.
  • Weekly verify decrypts it and requires user_entity data. The drill decrypts on the host.
  • Alert KeycloakDumpStale (older than 3 h or absent on prod).
  • Removes the prod assert against keycloak_isolated. Prod stays shared until a separate flip PR.

Apply staging --tags keycloak, then prod --tags keycloak,backup,backup-drill,monitoring --limit bitborg-prod,bitborg-monitoring, between :18 and :06.

Refs #670

Hourly encrypted Keycloak dump, handed to the backups. Works with Keycloak under the shared user today and under `bitborg-id` after the isolation move. - `bitborg-keycloak-dump.timer` (:07) runs `pg_dump -Fc | age` as the user that owns Keycloak's Postgres. Output `/var/lib/bitborg-id/keycloak-dump/keycloak.dump.age` (dir 2750, file 0640, readable by the backup user only). - Daily and hot backups copy it and fail if it is missing or older than 150 min. The shared-Postgres `pg_dump` of Keycloak is gone. - Weekly verify decrypts it and requires `user_entity` data. The drill decrypts on the host. - Alert `KeycloakDumpStale` (older than 3 h or absent on prod). - Removes the prod assert against `keycloak_isolated`. Prod stays shared until a separate flip PR. Apply staging `--tags keycloak`, then prod `--tags keycloak,backup,backup-drill,monitoring --limit bitborg-prod,bitborg-monitoring`, between :18 and :06. Refs #670
supernaut lade till 2 incheckningar 2026-10-14 11:11:01 +00:00
The user that runs Keycloak's Postgres dumps it every hour and pipes it
straight into age, encrypted to the backup recipients. The backup jobs copy
the file from a setgid hand-off directory they can read but not change, and
fail on a stale copy. They no longer read Keycloak's database.

Works under the shared user and Postgres today, and under bitborg-id with
keycloak-postgres after the move. The move stops the shared user's timer and
removes its metric. The prod guard against isolation is gone.

Verify and the drill decrypt the dump with the verify identity and require
user_entity data. KeycloakDumpStale fires when the dump is older than 3 h.

Refs #670
fix(keycloak): create the bitborg-id state dir before the dump hand-off dir
Alla kontroller lyckades
ci / ci (pull_request) Successful in 3m10s
5d6f997911
The file module gives missing parents the child's owner and mode. On a host without /var/lib/bitborg-id the parent became gitborg:gitborg 2750, so bitborg-id could not reach its textfile dir or, after the move, the dump dir.
supernaut lade till 1 incheckning 2026-10-14 11:21:19 +00:00
Merge remote-tracking branch 'origin/main' into feat/keycloak-dump-backup
Alla kontroller lyckades
ci / ci (pull_request) Successful in 2m50s
7aad12db8f
# Conflicts:
#	ansible/roles/keycloak/defaults/main.yml
#	ansible/roles/keycloak/tasks/main.yml
supernaut schemalade den här ändringsförfrågan för automatisk sammanfogning när alla kontroller lyckas 2026-10-14 11:21:30 +00:00
supernaut sammanfogade incheckning a6ccdd4ceb till main 2026-10-14 11:24:38 +00:00
supernaut tog bort grenen feat/keycloak-dump-backup 2026-10-14 11:24:38 +00:00
Logga in för att delta i denna konversation.
Inga granskare
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Förfallodatumet är ogiltigt eller utanför gränserna. Använd formatet "åååå-mm-dd".

Inget förfallodatum satt.

Beroenden

Inga beroenden satta

Referens
bitborg/bitborg-infra!742
Ingen beskrivning angiven.