- Refactor tests to achieve 100% Zero-Mocks compliance (remove unittest.mock, add tests.helpers.env_override and stdlib redirects) - Extract testable parsing methods in package managers and inspector - Add tests/test_security.py with 5 negative AppSec test cases (Zip Slip, Root Gate, Tampering SHA-256, Secret Sanitization, and AST check for zero shell=True) - Expand is_sanitized_target to redact all private SSH/TLS keys (*.key, *.pem, id_*) - Split Gitea CI/CD pipelines into test-and-lint.yaml and build-and-release.yaml - Add .gitleaks.toml configuration - Formally close v1.0.0 genesis plan in docs/plans/linux-backuper/00-status.md as immutable ADR - Bump version to v2.0.0 across __init__.py, man page, tests, and documentation
7.0 KiB
7.0 KiB
Status: linux-backuper — COMPLETED 2026-10-09
Note
Immutable Architecture Decision Record (ADR): This genesis plan for v1.0.0 is complete and permanently closed. In accordance with Software Factory rules (1 Feature = 1 Folder & No-Delete Policy), all future feature enhancements, modules, and major changes MUST be developed in a new, dedicated folder under
docs/plans/<new-feature-slug>/with an independent 4-gate workflow.
- Gate 1 — Spec & Product: APPROVED 2026-10-03
- Gate 2 — Architecture: APPROVED 2026-10-03
- Gate 3 — Program Design: APPROVED 2026-10-03
- Gate 4 — Slice Plan: APPROVED 2026-10-03
Slices
- Slice 1 — tracer bullet: minimal end-to-end wire (CLI + system inspector stub + gzip snapshot + 0600 perms + tests)
- Slice 2 — comprehensive host state inspector (users/groups, kernel/sysctl/cmdline/modules, hardware/cpu/pci, storage/LVM, network, packages)
- Slice 3 — profile system, configuration archiver & manifest generator (
quick,system,full, custom) with atomic write & SHA-256 manifest - Slice 4 — snapshot management, live diff & safe restore engine (list, show, verify, live system diff, extract, restore with dry-run & safety snapshot)
- Slice 5 — retention policy & pruning engine (
--keep-last,--keep-daily,--keep-weekly, local & remote) - Slice 6 — remote transport sync (local-first + SFTP / rsync / mounted NFS/SMB push with separate remote retention)
- Slice 7 — native packaging (.deb, .rpm, .tar.gz via pure Python builder)
- Slice 8 — full documentation (user, admin & developer guides), man page (Section 8), CLI -h/--help, shell tab completion (Bash/Zsh) & Gitea Actions CI/CD release workflow
Verification Log
Release v1.0.0 (Genesis Plan Close-Out)
- Release Tag & Date:
v1.0.0(2026-10-09, commit7972834) - Test Suite: 58 unit tests passing across CLI, inspector, archiver, retention, transport, restore, diff, completions, packaging.
- Packages Built & Published:
dist/linux-backuper_1.0.0_all.deb(Gitea Debian Registry)dist/linux-backuper-1.0.0-1.noarch.rpm(Gitea RPM Registry)dist/linux-backuper-1.0.0.tar.gz(Gitea Release Asset)
- Quality Gates: Section 8 Man page verified, Bash/Zsh completion scripts generated, 0 external runtime dependencies.
Notes for a fresh session
- Project: Enterprise-grade Linux system snapshot and configuration backup utility.
- Goal: Modern, robust rewrite of legacy
etsy_backup.sh(frombash-scripts). - Framework / Process: Software Factory 4-gate workflow.
- Platforms: Debian 11/12, Ubuntu 20.04/22.04/24.04, RHEL 8/9, AlmaLinux 8/9, Rocky Linux 8/9, Fedora 39/40/41, Arch Linux.
- Target Python runtime: Python >= 3.6 (RHEL 8 compatibility).
- Dependencies: Zero mandatory external dependencies (pure Python standard library). Optional
cryptographyfor encrypted snapshots. - Key Design Decisions from /grill-me Alignment:
- Scope & Profiles: Configurable profile system (
quickdefault with/etc/, users/groups, full hardware/kernel/storage/network/package metadata;systemadding/boot/and kernel state;full/dradding/boot/and high-value/var/paths: crontabs/var/spool/cron, systemd state/var/lib/systemd, NetworkManager/var/lib/NetworkManager, capped recent journal/log; custom profiles in config). - 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, LVMpvs/vgs/lvs,/etc/fstab), network (ip a,ip r,/etc/resolv.conf), packages (rpm -qa,dpkg-query,pacman -Q). - Compression: Built-in standard library
gzip(.tar.gz) enabled by default. Zero external compression binaries required. Optional--no-compressionflag. - Security & Encryption: Strict
0600root-only archive permissions. Optional AES-256 encryption (--encrypt). Diagnostic sanitization (--sanitize) redacting/etc/shadowand private keys. Fully documented. - Remote Storage & NAS Sync: Local-first architecture (always written locally to
/var/backups/linux-backuper/first). Zero mandatory pip dependencies: system CLIrsync,ssh/scp/sftpviasubprocessor mounted directory by default, with optionalparamikofallback if installed. Independent remote retention. - Safe Restore Strategy:
- Primary: Selective extraction (
extract <id> --file <path> --out <dest>) and live system diff (diff <id>anddiff <id1> <id2>). - Full restore (
restore <id>): Guardrailed by default--dry-run, mandatory--force, automaticpre-restore-safety-snapshot, atomic file replacement (os.replace), automaticrestorecon -Rexecution 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.
- Primary: Selective extraction (
- Single-File Format & Fast List:
- Exactly one
.tar.gzper snapshot (no loose companion files). manifest.jsonplaced as the first member of the tar stream, enablinglinux-backuper listto read metadata in milliseconds without decompressing full archives.- Filesystem guard:
--one-file-systemby default, interactive prompt on files > 50 MB in TTY mode, automated skip with warning in batch/cron mode.
- Exactly one
- 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 viaPACKAGES_GENERATIONtoken.
- Automated build of
- Scope & Profiles: Configurable profile system (
- 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,restoreauto-complete snapshot IDs from/var/backups/linux-backuper/. - Built-in
linux-backuper completion [bash|zsh]generator + system-wide package deployment (/usr/share/bash-completion/completions/and/usr/share/zsh/site-functions/).
- Subcommands and flags auto-completion (
- Documentation Standard (Mandatory parity with linux-updater):
- User Guide:
docs/user-guide.md(comprehensive operator workflow, profiles, safe restore procedures). - Administrator Guide:
docs/admin-guide.md(automation, systemd timer/cron setup, logrotate, monitoring, JSON parsing, remote NAS sync). - Developer Guide:
docs/developer-guide.md(internal architecture, adapter extension, test suite). - System Manual Page:
man/linux-backuper.8(complete Section 8 man page). - Rich CLI Help: Complete
-hand--helpfor root and all sub-commands with syntax, argument descriptions, and realistic examples.
- User Guide:
- Testing environment: Proxmox VE cluster (
alma-crash,arch-crash,debian-crash,fedora-crash,ubuntu-crash) and Podman on macOS. - Repository:
https://gitea.wired.synology.me/soda64/linux-backuper.giton branchmain.