Files
soda64 4b3346fd74
Test, Lint and Security Gate / Security Scan and Quality Audits (push) Failing after 8s
Test, Lint and Security Gate / Unit & Security Tests (Coverage >= 80%) (push) Has been skipped
Build and Publish Release / Build Packages and Publish (push) Successful in 1m31s
feat: modernize to Software Factory standards, add AppSec suite, and bump to v2.0.0
- 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
2026-10-23 22:08:15 +02:00

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, commit 7972834)
  • 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 (from bash-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 cryptography for encrypted snapshots.
  • Key Design Decisions from /grill-me Alignment:
    1. Scope & Profiles: Configurable profile system (quick default with /etc/, users/groups, full hardware/kernel/storage/network/package metadata; system adding /boot/ and kernel state; full/dr adding /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).
    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). 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, 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/.
    • Built-in linux-backuper completion [bash|zsh] generator + system-wide package deployment (/usr/share/bash-completion/completions/ and /usr/share/zsh/site-functions/).
  • 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 -h and --help for root and all sub-commands with syntax, argument descriptions, and realistic examples.
  • 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.git on branch main.