- 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
202 lines
7.3 KiB
Plaintext
202 lines
7.3 KiB
Plaintext
.TH LINUX-BACKUPER 8 "October 2026" "linux-backuper 2.0.0" "System Administration Commands"
|
|
.SH NAME
|
|
linux-backuper \- Enterprise Linux system snapshot, configuration backup, and safe restore utility
|
|
.SH SYNOPSIS
|
|
.B linux-backuper
|
|
[\fIOPTIONS\fR] \fICOMMAND\fR [\fIARGS...\fR]
|
|
.SH DESCRIPTION
|
|
.B linux-backuper
|
|
is an enterprise-grade Linux system snapshot and configuration backup utility written in pure Python >= 3.6 with zero mandatory external pip dependencies. It creates deterministic, cryptographically verifiable, and safe-to-restore configuration snapshots across Debian, Ubuntu, RHEL, AlmaLinux, Fedora, and Arch Linux distributions.
|
|
.PP
|
|
Snapshots are self-contained gzip archives (storing permissions, ownership, and timestamps) with an embedded
|
|
.B manifest.json
|
|
at the beginning of the archive stream, enabling sub-millisecond metadata queries without decompressing full archives.
|
|
.PP
|
|
Every snapshot is stored with strict root-only permissions (\fB0600\fR) by default. Restorations feature mandatory dry-run verification, atomic file replacement, automatic pre-restore safety snapshots, dynamic socket/mount protection, and automatic SELinux label restoration.
|
|
|
|
.SH COMMANDS
|
|
.TP
|
|
.B snapshot [\fIOPTIONS\fR]
|
|
Capture a new system state snapshot. Collects comprehensive system metadata (OS distribution, packages, users/groups, kernel parameters, hardware, storage, and networking) and packages specified configuration trees.
|
|
.RS
|
|
.IP "\fB\-\-profile\fR \fINAME\fR"
|
|
Select backup profile: \fBquick\fR (default, covers /etc), \fBsystem\fR (adds /boot and kernel state), \fBfull\fR (adds critical /var paths), or custom profile defined in config.
|
|
.IP "\fB\-\-target\-dir\fR \fIDIR\fR"
|
|
Target backup directory (default: \fI/var/backups/linux-backuper\fR).
|
|
.IP "\fB\-\-paths\fR \fIPATH...\fR"
|
|
Explicit paths to include, overriding profile defaults.
|
|
.IP "\fB\-\-compression\fR {\fBgzip\fR,\fBnone\fR}"
|
|
Compression algorithm (default: \fBgzip\fR).
|
|
.IP "\fB\-\-no\-compression\fR"
|
|
Store plain uncompressed tar archive.
|
|
.IP "\fB\-\-sanitize\fR"
|
|
Redact sensitive credentials, shadow hashes, and private cryptographic keys for diagnostic export.
|
|
.IP "\fB\-\-push\fR \fITARGET\fR"
|
|
Transfer snapshot to remote storage (e.g. \fIuser@host:/path\fR or \fI/mnt/nas\fR) immediately upon creation.
|
|
.IP "\fB\-\-keep\-last\fR \fIN\fR, \fB\-\-keep\-daily\fR \fID\fR, \fB\-\-keep\-weekly\fR \fIW\fR, \fB\-\-keep\-monthly\fR \fIM\fR"
|
|
Prune local snapshots based on retention policies.
|
|
.IP "\fB\-\-remote\-keep\-last\fR \fIN\fR, \fB\-\-remote\-keep\-daily\fR \fID\fR, \fB\-\-remote\-keep\-weekly\fR \fIW\fR, \fB\-\-remote\-keep\-monthly\fR \fIM\fR"
|
|
Prune remote storage snapshots based on independent remote retention policies.
|
|
.RE
|
|
|
|
.TP
|
|
.B list [\fIOPTIONS\fR]
|
|
List existing local snapshots with creation timestamps, profiles, file counts, and archive sizes.
|
|
.RS
|
|
.IP "\fB\-\-target\-dir\fR \fIDIR\fR"
|
|
Directory to scan for snapshot archives.
|
|
.RE
|
|
|
|
.TP
|
|
.B show \fISNAPSHOT_ID\fR [\fIOPTIONS\fR]
|
|
Display detailed manifest, telemetry, and system state recorded in a snapshot.
|
|
.RS
|
|
.IP "\fB\-\-packages\fR"
|
|
List all recorded installed package versions.
|
|
.IP "\fB\-\-files\fR"
|
|
List all archived file paths contained in the snapshot.
|
|
.RE
|
|
|
|
.TP
|
|
.B diff \fISNAPSHOT_ID\fR [\fISNAPSHOT_ID_2\fR] [\fIOPTIONS\fR]
|
|
Compare configuration state. If one snapshot is provided, performs a live diff comparing current host configuration and packages against the snapshot. If two snapshots are provided, compares differences between the two archives.
|
|
.RS
|
|
.IP "\fB\-u\fR, \fB\-\-unified\fR"
|
|
Display unified text diff for modified files.
|
|
.IP "\fB\-\-target\-root\fR \fIROOT\fR"
|
|
Filesystem root to compare against in live diff (default: \fI/\fR).
|
|
.RE
|
|
|
|
.TP
|
|
.B extract \fISNAPSHOT_ID\fR \fB\-\-file\fR \fIPATH\fR \fB\-\-out\fR \fIDEST\fR
|
|
Extract a single file selectively from an archive without unpacking the entire snapshot. Protected against Zip Slip path traversal attacks.
|
|
|
|
.TP
|
|
.B restore \fISNAPSHOT_ID\fR [\fIOPTIONS\fR]
|
|
Restore system configuration from a snapshot.
|
|
.RS
|
|
.IP "\fB\-\-dry\-run\fR"
|
|
Simulate execution plan without modifying filesystem (exits with code 5).
|
|
.IP "\fB\-\-force\fR"
|
|
Execute live restoration. Automatically creates a safety snapshot (\fBpre_restore_<timestamp>\fR) before making any modifications.
|
|
.IP "\fB\-\-include\-fstab\fR"
|
|
Explicitly allow restoring \fI/etc/fstab\fR (skipped by default to prevent mount failures).
|
|
.RE
|
|
|
|
.TP
|
|
.B prune [\fIOPTIONS\fR]
|
|
Prune old snapshots using time-bucket retention algorithms.
|
|
.RS
|
|
.IP "\fB\-\-keep\-last\fR \fIN\fR"
|
|
Keep \fIN\fR most recent snapshots.
|
|
.IP "\fB\-\-keep\-daily\fR \fID\fR"
|
|
Keep most recent snapshot for \fID\fR distinct days.
|
|
.IP "\fB\-\-keep\-weekly\fR \fIW\fR"
|
|
Keep most recent snapshot for \fIW\fR distinct calendar weeks.
|
|
.IP "\fB\-\-keep\-monthly\fR \fIM\fR"
|
|
Keep most recent snapshot for \fIM\fR distinct calendar months.
|
|
.IP "\fB\-\-dry\-run\fR"
|
|
Simulate pruning plan without deleting files.
|
|
.IP "\fB\-\-force\fR"
|
|
Confirm actual file deletion.
|
|
.RE
|
|
|
|
.TP
|
|
.B push \fISNAPSHOT_ID\fR \fB\-\-target\fR \fIDEST\fR [\fIOPTIONS\fR]
|
|
Transfer an existing local snapshot archive and manifest to a remote directory (local/NFS/SMB mount, SSH/rsync, or alias).
|
|
|
|
.TP
|
|
.B verify \fISNAPSHOT_ID\fR
|
|
Verify SHA-256 cryptographic checksum and tar stream integrity of a snapshot archive.
|
|
|
|
.TP
|
|
.B completion {\fBbash\fR,\fBzsh\fR}
|
|
Output shell autocompletion script to standard output.
|
|
|
|
.SH GLOBAL OPTIONS
|
|
.TP
|
|
.B \-\-json
|
|
Format output as machine-readable JSON to standard output.
|
|
.TP
|
|
.B \-\-verbose
|
|
Enable detailed diagnostic and debugging log output.
|
|
.TP
|
|
.B \-h\fR, \fB\-\-help
|
|
Display command usage summary and exit.
|
|
.TP
|
|
.B \-v\fR, \fB\-\-version
|
|
Display version information and exit.
|
|
|
|
.SH EXIT STATUS
|
|
.TP
|
|
.B 0
|
|
Success.
|
|
.TP
|
|
.B 1
|
|
Generic error or exception.
|
|
.TP
|
|
.B 2
|
|
Insufficient permissions (root privileges required).
|
|
.TP
|
|
.B 3
|
|
Pre-flight check failed (missing directories or dependencies).
|
|
.TP
|
|
.B 4
|
|
Archive corruption or integrity check failure.
|
|
.TP
|
|
.B 5
|
|
Dry-run simulation completed (no live changes executed).
|
|
|
|
.SH FILES
|
|
.TP
|
|
.I /var/backups/linux-backuper/
|
|
Default directory storing snapshot archives (\fB0700\fR root-only permissions).
|
|
.TP
|
|
.I /etc/linux-backuper/
|
|
Configuration directory containing custom profiles and remote transport targets.
|
|
.TP
|
|
.I /var/run/linux-backuper.pid
|
|
Lock file preventing concurrent snapshot or restore operations.
|
|
|
|
.SH EXAMPLES
|
|
.PP
|
|
Capture a quick snapshot of system configuration:
|
|
.RS
|
|
.B sudo linux-backuper snapshot --profile quick
|
|
.RE
|
|
.PP
|
|
Preview changes between a snapshot and the current live system:
|
|
.RS
|
|
.B sudo linux-backuper diff backup_host_20261009_120000 --unified
|
|
.RE
|
|
.PP
|
|
Perform a dry-run restoration:
|
|
.RS
|
|
.B sudo linux-backuper restore backup_host_20261009_120000 --dry-run
|
|
.RE
|
|
.PP
|
|
Perform a live restoration (with automated pre-restore safety snapshot):
|
|
.RS
|
|
.B sudo linux-backuper restore backup_host_20261009_120000 --force
|
|
.RE
|
|
.PP
|
|
Transfer snapshot to remote NAS storage with remote retention:
|
|
.RS
|
|
.B sudo linux-backuper snapshot --push lain@nas.wired.intra:/volume1/backups --remote-keep-last 7
|
|
.RE
|
|
.PP
|
|
Install Bash completion:
|
|
.RS
|
|
.B linux-backuper completion bash | sudo tee /usr/share/bash-completion/completions/linux-backuper > /dev/null
|
|
.RE
|
|
|
|
.SH AUTHORS
|
|
Written and maintained by wiredLAB <lain@wired.intra>.
|
|
.SH "REPORTING BUGS"
|
|
Report bugs to: <https://gitea.wired.synology.me/soda64/linux-backuper/issues>
|
|
.SH "SEE ALSO"
|
|
.BR tar (1),
|
|
.BR gzip (1),
|
|
.BR rsync (1),
|
|
.BR ssh (1)
|