Document backups and restore
CI / tests (Python 3.10) (pull_request) Successful in 19s
CI / tests (Python 3.11) (pull_request) Successful in 18s
CI / tests (Python 3.12) (pull_request) Successful in 18s
CI / tests (Python 3.13) (pull_request) Successful in 18s
CI / lint (pull_request) Successful in 3s
CI / tests (Python 3.10) (pull_request) Successful in 19s
CI / tests (Python 3.11) (pull_request) Successful in 18s
CI / tests (Python 3.12) (pull_request) Successful in 18s
CI / tests (Python 3.13) (pull_request) Successful in 18s
CI / lint (pull_request) Successful in 3s
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4365ed56e1
commit
42a1b41b01
1 file changed
+22
@@ -438,10 +438,32 @@ sudo kernelwatch list-hosts hosts and when they last reported
|
||||
sudo kernelwatch set-password USER create a user / change password (logs out their sessions)
|
||||
sudo kernelwatch remove-user USER
|
||||
sudo kernelwatch list-users
|
||||
sudo kernelwatch backup PATH write a consistent copy of the database (safe while running)
|
||||
sudo kernelwatch check-alerts check for stale, recovered, reboot and update alerts now
|
||||
sudo kernelwatch test-alert send a test notification to the configured ntfy topic
|
||||
```
|
||||
|
||||
## Backups
|
||||
|
||||
Everything kernelwatch knows lives in one SQLite file, `/var/lib/kernelwatch/kernelwatch.db`:
|
||||
host tokens (hashed), dashboard logins and report history. Without it you'd
|
||||
re-register every host and reinstall its token. Don't copy the file while the
|
||||
server runs, since recent writes can sit in its `-wal` sidecar. Use:
|
||||
|
||||
```sh
|
||||
sudo kernelwatch backup /var/lib/kernelwatch/backups/kernelwatch.db
|
||||
```
|
||||
|
||||
This uses SQLite's online backup, so it's safe while hosts are reporting. It
|
||||
replaces any existing file at that path and writes it mode 0600. It refuses to
|
||||
overwrite the live database. The command runs as the `kernelwatch` user, so the
|
||||
destination directory has to be writable by it (create one with
|
||||
`sudo install -d -o kernelwatch -g kernelwatch -m 0700 /var/lib/kernelwatch/backups`),
|
||||
then copy the result off the machine with your usual backup tool.
|
||||
|
||||
To restore, stop the service, put the file at `db_path` owned by `kernelwatch`
|
||||
(mode 0600), and start it again. The stale-alert state restores with it.
|
||||
|
||||
## Security notes
|
||||
|
||||
- **Host identity comes from the token, not the payload.** A host can only
|
||||
|
||||
Reference in new issue
Block a user