Betrieb ohne root #40

Closed
thorsten.spille wants to merge 0 commits from thorsten.spille/feature-11-unprivileged into main AGit

Setzt #11 um. Die Beschränkung des Benutzers auf der Quelle per command= folgt in #39.

Vorab mit echtem ZFS geprüft (Test-VM)

Mit delegierten Rechten (zfs allow) funktioniert alles, was zsync auf Quelle und Ziel tut – Erstreplikation, Delta mit -s, raw-verschlüsselt, refquota, Rollback, Snapshots anlegen/löschen, Hold, Bookmark, receive -A. Ausnahmen:

  • Einhängen darf unter Linux nur root → ohne root zfs receive -u
  • Properties aus send -p brauchen am Ziel jeweils ein eigenes Recht, sonst werden sie stillschweigend weggelassen (gefunden: acltype, xattr eines Container-Subvols) → vollständige Liste in der Anleitung (ohne sharenfs/sharesmb, ohne mlslabel, das es unter Linux nicht gibt)

Änderung

  • ohne root: Empfang mit -u (Erstreplikation und fortgesetzte Erstreplikation)
  • Paket: Gruppe bashclub-zsync; /var/log/bashclub-zsync, /var/lib/bashclub-zsync, /run/bashclub-zsync (tmpfiles.d) gruppenschreibbar; logrotate legt Logs gruppenschreibbar an
  • Status oder checkmk-Spool nicht beschreibbar: eine Warnung statt Fehlern
  • README „Running without root“: kopierbare Blöcke, die Ziel, Quelle und Port aus der Config lesen; Benutzer und Schlüssel, Rechte auf Ziel und Quelle (über den bestehenden root-Zugang), Config und Cronjob umstellen – wörtlich auf der Test-VM ausgeführt, danach Replikation als zsync

Tests

  • Integration unprivileged: Benutzer mit zfs allow repliziert über ssh Proxmox-typische Datasets (Subvol mit refquota/acltype/xattr, zvol, raw-verschlüsselt) mit Snapshot-Engine internal, Holds, Bookmarks, Resume; Properties wie auf der Quelle, nichts eingehängt, Status geschrieben
  • gesamte ZFS-Suite 16/16; same_second wiederholt, bis die Snapshots in derselben Sekunde liegen (vorher unter Last instabil)
  • Paket im Container: Gruppe, Rechte, Update
  • Stub-Szenarien 28/28 identisch zu main, Check-Tests 40/40

Closes #11

🤖 Generated with Claude Code

Setzt #11 um. Die Beschränkung des Benutzers auf der Quelle per `command=` folgt in #39. ## Vorab mit echtem ZFS geprüft (Test-VM) Mit delegierten Rechten (`zfs allow`) funktioniert alles, was zsync auf Quelle und Ziel tut – Erstreplikation, Delta mit `-s`, raw-verschlüsselt, refquota, Rollback, Snapshots anlegen/löschen, Hold, Bookmark, `receive -A`. Ausnahmen: - **Einhängen** darf unter Linux nur root → ohne root `zfs receive -u` - Properties aus `send -p` brauchen am Ziel jeweils ein eigenes Recht, sonst werden sie **stillschweigend weggelassen** (gefunden: `acltype`, `xattr` eines Container-Subvols) → vollständige Liste in der Anleitung (ohne `sharenfs`/`sharesmb`, ohne `mlslabel`, das es unter Linux nicht gibt) ## Änderung - ohne root: Empfang mit `-u` (Erstreplikation und fortgesetzte Erstreplikation) - Paket: Gruppe `bashclub-zsync`; `/var/log/bashclub-zsync`, `/var/lib/bashclub-zsync`, `/run/bashclub-zsync` (tmpfiles.d) gruppenschreibbar; logrotate legt Logs gruppenschreibbar an - Status oder checkmk-Spool nicht beschreibbar: eine Warnung statt Fehlern - README „Running without root“: kopierbare Blöcke, die Ziel, Quelle und Port aus der Config lesen; Benutzer und Schlüssel, Rechte auf Ziel und Quelle (über den bestehenden root-Zugang), Config und Cronjob umstellen – **wörtlich auf der Test-VM ausgeführt**, danach Replikation als `zsync` ## Tests - Integration `unprivileged`: Benutzer mit `zfs allow` repliziert über ssh Proxmox-typische Datasets (Subvol mit refquota/acltype/xattr, zvol, raw-verschlüsselt) mit Snapshot-Engine internal, Holds, Bookmarks, Resume; Properties wie auf der Quelle, nichts eingehängt, Status geschrieben - gesamte ZFS-Suite 16/16; `same_second` wiederholt, bis die Snapshots in derselben Sekunde liegen (vorher unter Last instabil) - Paket im Container: Gruppe, Rechte, Update - Stub-Szenarien 28/28 identisch zu `main`, Check-Tests 40/40 Closes #11 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Run without root on the backup server and the source
All checks were successful
/ build (pull_request) Successful in 25s
/ test (debian-13) (pull_request) Successful in 46s
/ test (ubuntu-26.04) (pull_request) Successful in 53s
/ test (debian-12) (pull_request) Successful in 53s
/ publish (pull_request) Has been skipped
/ package (pull_request) Successful in 0s
/ test (ubuntu-24.04) (pull_request) Successful in 46s
/ integration (pull_request) Successful in 3m10s
a0c50297d2
Checked on the test VM with delegated permissions (zfs allow): everything
zsync does on both sides works as an unprivileged user, except mounting,
which only root may do on Linux. Properties of zfs send -p need their own
permission on the target, otherwise they are silently not received
(acltype and xattr of a container subvol).

- without root, replicas are received with zfs receive -u (initial
  replication and resumed initial replication); unmounting is skipped as the
  replica is not mounted
- the package creates the group bashclub-zsync and makes
  /var/log/bashclub-zsync, /var/lib/bashclub-zsync and /run/bashclub-zsync
  (tmpfiles.d) writable for it; logrotate creates logs group writable
- run status or checkmk spool not writable: one warning instead of errors;
  the pid in the lock file is written only if possible
- README "Running without root": copyable blocks that read target, source and
  port from the configuration, create the users and keys, set the permissions
  on target and source (over the existing root access), switch the
  configuration and the cron job; run verbatim on the test VM

Tests: integration case unprivileged (Proxmox like subvol, zvol, raw
encrypted, engine internal, holds, bookmarks, resume as user, properties as on
the source); same_second retries until the snapshots share a second; package
checked in a container; all stub scenarios identical to main.

A wrapper restricting the source user to zsync commands follows in #39.

Refs #11

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Owner

Manuell nach main gemergt (6b1be13), CI inkl. publish nach testing grün. Schließe den PR.

Manuell nach `main` gemergt (6b1be13), CI inkl. publish nach testing grün. Schließe den PR.
thorsten.spille closed this pull request 2026-10-16 00:11:00 +02:00
All checks were successful
/ build (pull_request) Successful in 25s
/ test (debian-13) (pull_request) Successful in 46s
/ test (ubuntu-26.04) (pull_request) Successful in 53s
/ test (debian-12) (pull_request) Successful in 53s
/ publish (pull_request) Has been skipped
/ package (pull_request) Successful in 0s
/ test (ubuntu-24.04) (pull_request) Successful in 46s
/ integration (pull_request) Successful in 3m10s

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
bug
enhancement
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bashclub/zsync!40
No description provided.