docs(plans): incorporate grill-me architectural refinements and packaging workflows

This commit is contained in:
soda64 committed 2026-10-09 18:30:15 +02:00
1 parent 07185a9833
commit 0aed5bb003
3 files changed
+26 -12

No files matched your search

+10 -2
View File
@@ -27,10 +27,18 @@
2. Metadata Collection: Users/groups (`/etc/passwd`, `/etc/group`, subuid/subgid), kernel parameters (`sysctl -a`, `/proc/cmdline`, `lsmod`), hardware (`lscpu`, `lshw`, `lspci`, `lsusb`, `dmidecode`, RAM/meminfo), storage (`lsblk`, `df`, LVM `pvs/vgs/lvs`, `/etc/fstab`), network (`ip a`, `ip r`, `/etc/resolv.conf`), packages (`rpm -qa`, `dpkg-query`, `pacman -Q`).
3. Compression: Built-in standard library `gzip` (`.tar.gz`) enabled by default. Zero external compression binaries required. Optional `--no-compression` flag.
4. Security & Encryption: Strict `0600` root-only archive permissions. Optional AES-256 encryption (`--encrypt`). Diagnostic sanitization (`--sanitize`) redacting `/etc/shadow` and private keys. Fully documented.
5. Remote Storage & NAS Sync: Local-first architecture (always written locally to `/var/backups/linux-backuper/` first). Optional `--push` flag or profile remote targets (SSH/SFTP, rsync, mounted directory) with independent remote retention.
5. Remote Storage & NAS Sync: Local-first architecture (always written locally to `/var/backups/linux-backuper/` first). Zero mandatory pip dependencies: system CLI `rsync`, `ssh/scp/sftp` via `subprocess` or mounted directory by default, with optional `paramiko` fallback if installed. Independent remote retention.
6. Safe Restore Strategy:
- Primary: Selective extraction (`extract <id> --file <path> --out <dest>`) and live system diff (`diff <id>` and `diff <id1> <id2>`).
- Full restore (`restore <id>`): Guardrailed by default `--dry-run`, mandatory `--force`, automatic `pre-restore-safety-snapshot`, and exclusion of volatile sockets/dynamic symlinks.
- Full restore (`restore <id>`): Guardrailed by default `--dry-run`, mandatory `--force`, automatic `pre-restore-safety-snapshot`, atomic file replacement (`os.replace`), automatic `restorecon -R` execution on SELinux systems (RHEL/Alma/Fedora), and exclusion of volatile sockets/dynamic symlinks (`/etc/resolv.conf`, `/etc/mtab`, `/run/`).
- Symlink Safety: Tarball stores relative/absolute symlinks (`dereference=False`), extract engine strictly blocks Path Traversal (Zip Slip) outside target root.
7. Single-File Format & Fast List:
- Exactly one `.tar.gz` per snapshot (no loose companion files).
- `manifest.json` placed as the first member of the tar stream, enabling `linux-backuper list` to read metadata in milliseconds without decompressing full archives.
- Filesystem guard: `--one-file-system` by default, interactive prompt on files > 50 MB in TTY mode, automated skip with warning in batch/cron mode.
8. Packaging & Gitea Package Registry CI/CD:
- Automated build of `.rpm`, `.deb`, and `.tar.gz`.
- Gitea Actions workflow (`.gitea/workflows/release.yml`) publishing directly to Gitea RPM & Debian Package Registries and Release Assets via `PACKAGES_GENERATION` token.
- Shell Tab Completion Standard (Bash & Zsh):
- Subcommands and flags auto-completion (`snapshot`, `list`, `show`, `diff`, `verify`, `extract`, `restore`, `prune`, `completion`).
- Dynamic completion: `show`, `diff`, `verify`, `extract`, `restore` auto-complete snapshot IDs from `/var/backups/linux-backuper/`.
+15 -8
View File
@@ -81,11 +81,13 @@ To ensure complete reconstruction even on a fresh OS install, every snapshot gat
## 4. Snapshot Archive Format & Manifest Schema
Each snapshot is packaged as a `.tar.gz` archive with strict `0600` permissions (readable/writeable only by root) inside `/var/backups/linux-backuper/` (`0700` directory).
Each snapshot is packaged as a single `.tar.gz` archive with strict `0600` permissions (readable/writeable only by root) inside `/var/backups/linux-backuper/` (`0700` directory). No loose companion files are generated.
To guarantee instant performance of `linux-backuper list`, **`manifest.json` is always written as the very first entry** in the archive. Reading metadata takes < 10ms by reading only the first tar member from the gzip stream without decompressing the rest of the archive.
```text
backup_enterprise_20261002_211500.tar.gz
├── manifest.json # Machine-readable metadata document
├── manifest.json # FIRST member: machine-readable metadata & file SHA-256 table
├── meta/ # Deep telemetry command dumps
│ ├── hardware.json / .txt
│ ├── storage.json / .txt
@@ -123,13 +125,15 @@ backup_enterprise_20261002_211500.tar.gz
"compressed_bytes": 14881024,
"file_count": 1420
},
"checksums": {
"archive_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"manifest_sha256": "4b227777d4dd1fc61c6f884f48641d02b4d121d3fd328cb08b5531fcacdabf8a"
"files_sha256": {
"meta/packages.txt": "a823f...",
"data/etc/nginx/nginx.conf": "b712c..."
}
}
```
*Integrity Verification:* `linux-backuper verify <id>` validates gzip stream CRC integrity and recalculates the SHA-256 for all indexed files against `manifest.json`. Local catalog index (`/var/lib/linux-backuper/catalog.json`) caches the post-write archive SHA-256 for quick reference.
---
## 5. Compression & Security Architecture
@@ -158,9 +162,11 @@ Restoring configuration on a live Linux system carries critical operational risk
- `linux-backuper diff <id>`: Compares the live `/etc/` and installed packages against the snapshot, reporting modified, added, and missing files and packages.
- `linux-backuper diff <id1> <id2>`: Compares two snapshots against each other.
3. **Full Live Restore (`restore <id>`):**
- **Default Dry-Run:** Running `linux-backuper restore <id>` without `--force` prints a comprehensive change plan and exits without modifying the filesystem.
- **Default Dry-Run:** Running `linux-backuper restore <id>` without `--force` prints a comprehensive change plan and exits without modifying the filesystem (exit code 5).
- **Automatic Pre-Restore Safety Snapshot:** When `--force` is specified, `linux-backuper` **automatically captures a safety snapshot** (`pre_restore_<timestamp>`) before modifying a single file on disk. If anything goes wrong, immediate rollback is guaranteed.
- **Strict Exclusion Guardrails:** Automatically skips dynamic sockets (`*.sock`), named pipes (FIFOs), temporary lock files (`*.lock`, `*.pid`), and dynamic mount links (`/etc/resolv.conf`, `/etc/mtab`).
- **Atomic File Replacement:** Files are written to a temporary sibling file in the same directory (`.tmp.<file>`) with target permissions and atomically swapped via `os.replace` to prevent half-written configuration files from being read by running daemons.
- **SELinux Context Restoration:** On systems where SELinux is active (detected via `/sys/fs/selinux`), the restore engine automatically executes `restorecon -R` across all restored paths to guarantee correct SELinux context and prevent daemon permission denials.
- **Strict Exclusion & Symlink Guardrails:** Automatically skips dynamic sockets (`*.sock`), named pipes (FIFOs), temporary lock files (`*.lock`, `*.pid`), and dynamic mount links (`/etc/resolv.conf`, `/etc/mtab`, `/run/`). Symlinks pointing outside the restore root are strictly blocked to protect against Zip Slip / Directory Traversal attacks.
---
@@ -168,7 +174,8 @@ Restoring configuration on a live Linux system carries critical operational risk
1. **Local-First Guarantee:** Snapshots are always committed locally first in `/var/backups/linux-backuper/` with verified checksums. Network interruptions cannot leave corrupted local backups.
2. **Push Sync (`--push [target]`):**
- Transports supported: SFTP (via `paramiko`), `rsync`, or direct filesystem write to mounted NFS/SMB shares.
- **Zero Mandatory Pip Dependencies:** Primary transport utilizes system CLI tools (`rsync`, `ssh/scp/sftp` via `subprocess`) or direct file copy to mounted NFS/SMB shares using the Python standard library.
- **Optional Paramiko Backend:** If the `paramiko` library is installed on the system, an internal pure-Python SFTP backend can be utilized.
- Remote configurations defined in `/etc/linux-backuper.json` (e.g. `nas`, `cloud`).
- **Independent Remote Retention:** Remote target maintains its own retention policy (e.g. keep last 30 on NAS while keeping last 7 locally).
+1 -2
View File
@@ -98,8 +98,7 @@ This roadmap defines the implementation order for `linux-backuper` in thin, inde
- Shell Tab Completion: Native Bash (`completions/bash/linux-backuper`) and Zsh (`completions/zsh/_linux-backuper`) scripts supporting subcommands, flags, profiles, and dynamic snapshot ID completion.
- `linux-backuper completion [bash|zsh]` generator sub-command.
- Interactive CLI Help: Complete `-h` and `--help` for root and all sub-commands with usage examples.
- Packaging integration: Install completion scripts to `/usr/share/bash-completion/completions/` and `/usr/share/zsh/site-functions/`.
- `.gitea/workflows/release.yml`: Gitea Actions pipeline targeting `runs-on: fedora`, running tests, building `.rpm`/`.deb`, publishing to Gitea Package Registry and Release assets.
- `.gitea/workflows/release.yml`: Gitea Actions pipeline targeting `runs-on: fedora` (hostexecutor runner `giteaworker`), running tests (`python3 -m unittest discover tests`), building `.rpm`/`.deb`/`.tar.gz`, publishing to Gitea RPM (`/api/packages/{owner}/rpm/upload`) & Debian (`/api/packages/{owner}/debian/pool/stable/main/upload`) Package Registries, linking packages via `PACKAGES_GENERATION` token, and uploading Release assets.
- **Verification:** Unit tests verifying `linux-backuper -h`, sub-command `--help`, shell completion scripts generation (`linux-backuper completion bash` / `zsh`), and man page syntax verification with `man -l man/linux-backuper.8`.