Repository navigation
Add periodic S3 recovery backups - #10
Merged
Merged
Conversation
Contributor
Author
|
Updated S3 layout: |
added 4 commits
November 9, 2026 15:23
Upload recovery files individually instead of a single archive, encrypt each object with a configured backup key, delete objects older than retention_days, and add kouja-restore for S3 prefixes, local plain backups, and legacy archives.
Add error-path and helper coverage for backup, restore, PKI, agent options, and admin UI error mapping; raise the internal coverage floor to 80%.
Run periodic local/S3 backups from a systemd timer instead of inside kouja-agent. The worker snapshots SQLite through a read-only connection, snapshots the revocation journal as a file, and leaves the serving agent with no backup loop. Core config validation is separated so invalid backup-only settings do not block agent startup.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds periodic S3 persistence of the existing recovery set, with per-file client-side encryption, retention cleanup, a restore command, and a separate backup worker.
Process separation
kouja-agentno longer owns a backup goroutine, S3 client, backup ticker, or backup-only config validation.kouja-backupis a one-shot worker run bykouja-backup.timer.VACUUM INTOconnection, so the serving agent is not opened or migrated by the backup process.systemdunits and installer wiring are included.S3 layout
Recovery files are uploaded individually rather than as a single opaque archive:
state.db— consistent SQLite snapshotsecret.key,host-id,revoked-serials.logconfig.yaml,emergency.logrestore.jsonmanifest with per-file SHA-256 checksumsWith
per_backup_folder: true(default):With
per_backup_folder: false, files use timestamped names directly under the prefix.Behavior
state.backup_interval_seconds.AES256) and SSE-KMS (aws:kms).encryption_key_fileis set, every object is encrypted client-side with AES-256-GCM and uploaded with a.encsuffix.retention_days(default 7) deletes old backup objects under the configured prefix after each successful upload.kouja-restoreaccepts an S3 prefix, a local plain-file directory, or a legacy archive. It verifies checksums, decrypts, and restores files to the paths in the backup's config.Verification
make testmake lintmake coverage-check(80.4%, floor 80%)A live S3 upload was not run because no bucket/credentials were available in this environment.
Config